Changeset 98688c6 in Klonkt


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@…>

Location:
src
Files:
2 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);
  • src/views/pages/volgend.ejs

    rcbe4f4e r98688c6  
    77
    88  <form method="post" action="/tijdlijn/follow" class="tl-follow">
    9     <input type="text" name="handle" placeholder="@naam@server.social" autocomplete="off" spellcheck="false" required>
     9    <input type="text" name="handle" placeholder="@naam@server.social of site.com" autocomplete="off" spellcheck="false" required>
    1010    <button type="submit" class="btn btn-primary"><%= t('tl.follow_btn') %></button>
    1111    <label class="tl-follow-ab" title="<%= t('tl.autoboost_hint') %>"><input type="checkbox" name="auto_boost" value="1"> 🔁 <%= t('tl.autoboost_follow') %></label>
Note: See TracChangeset for help on using the changeset viewer.