Changeset c66cbb4 in Klonkt for src/routes
- Timestamp:
- 07/25/2026 08:22:15 AM (7 weeks ago)
- Branches:
- main
- Children:
- 8f520e0
- Parents:
- ad6f62a
- File:
-
- 1 edited
-
src/routes/activitypub.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/activitypub.js
rad6f62a rc66cbb4 79 79 80 80 // ── Outbox ──────────────────────────────────────────────────────── 81 router.get('/ap/users/:slug/outbox', (req, res) => {81 router.get('/ap/users/:slug/outbox', async (req, res) => { 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']) { 89 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)"; 84 93 const posts = db.prepare( 85 94 `SELECT id, slug, title, content, cover_image_url, cover_video_url, nsfw, content_warning, published_at, created_at 86 FROM posts WHERE site_id = ? AND status = 'published' AND (fan_only IS NULL OR fan_only = 0)95 FROM posts WHERE site_id = ? AND status = 'published' ${fanClause} 87 96 ORDER BY COALESCE(published_at, created_at) DESC LIMIT 20` 88 97 ).all(site.id); 89 AP.sendAP(res, AP.buildOutbox(baseUrl(req), site, posts) );98 AP.sendAP(res, AP.buildOutbox(baseUrl(req), site, posts), asGuardian ? 'private, no-store' : undefined); 90 99 }); 91 100
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)