Changeset 7922694 in Klonkt for src/routes


Ignore:
Timestamp:
07/20/2026 11:03:52 PM (7 weeks ago)
Author:
Robin <roboburr@…>
Branches:
main
Children:
5143ccf
Parents:
155c24e
git-author:
Robin <roboburr@…> (07/20/2026 11:03:51 PM)
git-committer:
Robin <roboburr@…> (07/20/2026 11:03:52 PM)
Message:

Feature: owner followers/following carry name + avatar (shaer-aa3)

The C2S owner view of followers and following returned bare actor
URIs, so a client could only show ids. Each entry is now an AS2 actor
reference { id, type: Person, name, preferredUsername, icon } built
from the best cached display Klonkt already holds: the follower's own
row (now cached at Follow time), then ap_following, interactions,
timeline, mentions, falling back to a handle derived from the URI.
Priority is the set display name, then the chosen username, then the
id. ap_followers gains name/handle/icon, populated when an inbound
Follow is accepted (fetchActor already runs there).

Changed files:
src/config/database.js

  • additive columns ap_followers.name/handle/icon

src/services/ActivityPubService.js

  • cache follower display on inbound Follow
  • actorDisplay(slug, uri): best cached display across the caches
  • buildActorRef(slug, uri): AS2 actor reference with display

src/routes/activitypub.js

  • owner followers/following map URIs through buildActorRef

New file:
test/c2s-contacts.test.js

  • name/username/id priority + interaction-cache fallback

-robo
Co-Authored-By: Claude Opus 4.8 <noreply@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/routes/activitypub.js

    r155c24e r7922694  
    175175  if (!site) return res.status(404).end();
    176176  if (owner) {
    177     const items = db.prepare('SELECT actor_uri FROM ap_followers WHERE slug = ? ORDER BY created_at').all(site.slug).map((r) => r.actor_uri);
     177    const uris = db.prepare('SELECT actor_uri FROM ap_followers WHERE slug = ? ORDER BY created_at').all(site.slug).map((r) => r.actor_uri);
     178    const items = uris.map((u) => AP.buildActorRef(site.slug, u));   // name + avatar (shaer-aa3)
    178179    return AP.sendAP(res, AP.buildFollowers(baseUrl(req), site, items.length, items));
    179180  }
     
    190191  if (owner) {
    191192    let items = [];
    192     try { items = db.prepare("SELECT actor_uri FROM ap_following WHERE slug = ? AND status = 'accepted' ORDER BY created_at").all(site.slug).map((r) => r.actor_uri); } catch { /* table may not exist */ }
     193    try { items = db.prepare("SELECT actor_uri FROM ap_following WHERE slug = ? AND status = 'accepted' ORDER BY created_at").all(site.slug).map((r) => AP.buildActorRef(site.slug, r.actor_uri)); } catch { /* table may not exist */ }
    193194    return AP.sendAP(res, AP.buildFollowing(baseUrl(req), site, items.length, items));
    194195  }
Note: See TracChangeset for help on using the changeset viewer.