Changeset 73a10c2 in Klonkt for src/routes/activitypub.js
- Timestamp:
- 07/30/2026 08:40:28 AM (6 weeks ago)
- Branches:
- main
- Children:
- aa189d1
- Parents:
- 094f7d0
- File:
-
- 1 edited
-
src/routes/activitypub.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/activitypub.js
r094f7d0 r73a10c2 82 82 const site = publicSite(req.params.slug); 83 83 if (!site) return res.status(404).end(); 84 // Authorized fetch (FEP-633c §5.3 note): a committed guardian doing a SIGNED 85 // GET may read the ward's fan-only history too, without appearing as a 86 // follower. Unsigned / non-guardian callers get the public collection only. 87 let asGuardian = false; 88 if (req.headers['signature']) { 84 // Authorized fetch (30-7): who is asking decides what they see. 85 // - the owner's own app (bearer) and a verified accepted follower or 86 // guardian get the friends-only history too, so a NEW friend's backfill 87 // brings the past along (Robins besluit: vrienden krijgen de 88 // geschiedenis mee); 89 // - a verified caller this instance BLOCKS gets an EMPTY collection, not 90 // even the public set: a block is a closed door, and a signed fetch is 91 // the caller knocking with their name on it; 92 // - everyone else gets the public collection, exactly as before. 93 const bearer = OAuth.verifyBearer(req.headers.authorization); 94 let verifiedActor = null; 95 if (!bearer && req.headers['signature']) { 89 96 const verified = await AP.verifyRequest(req).catch(() => null); 90 asGuardian = !!(verified && AP.isWardGuardian(req.params.slug, verified.id)); 91 } 92 const fanClause = asGuardian ? '' : "AND (fan_only IS NULL OR fan_only = 0)"; 97 verifiedActor = verified && verified.id; 98 } 99 const audience = AP.outboxAudience(req.params.slug, { 100 bearerSlug: bearer ? bearer.site.slug : null, 101 verifiedActor, 102 }); 103 if (audience === 'blocked') { 104 return AP.sendAP(res, AP.buildOutbox(baseUrl(req), site, []), 'private, no-store'); 105 } 106 const fanClause = audience === 'friend' ? '' : "AND (fan_only IS NULL OR fan_only = 0)"; 93 107 const posts = db.prepare( 94 108 `SELECT id, slug, title, content, cover_image_url, cover_video_url, nsfw, content_warning, published_at, created_at … … 96 110 ORDER BY COALESCE(published_at, created_at) DESC LIMIT 20` 97 111 ).all(site.id); 98 AP.sendAP(res, AP.buildOutbox(baseUrl(req), site, posts), a sGuardian? 'private, no-store' : undefined);112 AP.sendAP(res, AP.buildOutbox(baseUrl(req), site, posts), audience === 'friend' ? 'private, no-store' : undefined); 99 113 }); 100 114
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)