Changeset 98688c6 in Klonkt for src/services


Ignore:
Timestamp:
06/26/2026 10:23:33 AM (2 months ago)
Author:
Robin Genis <roboburr@…>
Branches:
main
Children:
5783c67
Parents:
cbe4f4e
Message:

feat(fediverse): follow a site by its bare domain (site.com), not only @handle

followActor now resolves a bare domain via the site root's AP content-negotiation
(reuses resolveApActor), so a single-actor site (Klonkt etc.) can be followed by
just its domain. Placeholder updated.

Co-Authored-By: Claude <noreply@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/services/ActivityPubService.js

    rcbe4f4e r98688c6  
    11601160  const base = (process.env.PUBLIC_BASE_URL || '').replace(/\/+$/, '');
    11611161  if (!base || !site || !site.slug) return { error: 'config' };
    1162   // Accept either an @user@host handle (WebFinger) or a profile/actor URL directly
    1163   // (the authorize_interaction Follow flow passes a URL).
     1162  // Accept any of: a profile/actor URL, an @user@host handle (WebFinger), or a
     1163  // bare site domain (site.com) — for a single-actor site (Klonkt etc.) the root
     1164  // resolves to its AP actor, so you can follow a site by just its domain.
    11641165  const s = String(handle || '').trim();
    1165   const actorUrl = /^https?:\/\//i.test(s) ? (safeUrl(s) || null) : await webfingerResolve(s);
     1166  let actorUrl;
     1167  if (/^https?:\/\//i.test(s)) actorUrl = safeUrl(s) || null;
     1168  else if (s.includes('@')) actorUrl = await webfingerResolve(s);
     1169  else if (/^[a-z0-9.-]+\.[a-z]{2,}/i.test(s)) actorUrl = await resolveApActor('https://' + s.replace(/^\/+|\/+$/g, ''));
     1170  else actorUrl = null;
    11661171  if (!actorUrl) return { error: 'not_found' };
    11671172  const actor = await fetchActor(actorUrl).catch(() => null);
Note: See TracChangeset for help on using the changeset viewer.