Changeset 0cea12b in Klonkt for src/routes
- Timestamp:
- 07/20/2026 08:19:20 PM (7 weeks ago)
- Branches:
- main
- Children:
- 81b2e1e
- Parents:
- 513ba82
- git-author:
- Robin <roboburr@…> (07/20/2026 08:18:21 PM)
- git-committer:
- Robin <roboburr@…> (07/20/2026 08:19:20 PM)
- File:
-
- 1 edited
-
src/routes/activitypub.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/activitypub.js
r513ba82 r0cea12b 84 84 }); 85 85 86 // ── Inbox read (owner only, AP C2S) ─────────────────────────────── 87 // GET on the inbox is part of ActivityPub C2S: the account owner (a bearer 88 // scoped to this site) reads recent inbound posts (the timeline: accounts 89 // they follow) as Create(Note) items, so an app (Shaer) can build a unified 90 // feed. Anyone else gets 403; the inbox stays write-only for the public. 91 router.get('/ap/users/:slug/inbox', (req, res) => { 92 const auth = OAuth.verifyBearer(req.headers.authorization); 93 if (!auth || auth.site.slug !== req.params.slug) return res.status(403).end(); 94 const base = baseUrl(req); 95 const items = AP.getTimeline(auth.site.slug, 60).map((t) => ({ 96 id: `${t.id}#create`, 97 type: 'Create', 98 actor: t.author_uri, 99 published: t.published || t.created_at || undefined, 100 object: { 101 id: t.id, 102 type: 'Note', 103 attributedTo: t.author_uri, 104 content: t.content, 105 url: t.url || undefined, 106 published: t.published || t.created_at || undefined, 107 sensitive: !!t.nsfw, 108 summary: t.cw || undefined, 109 }, 110 })); 111 AP.sendAP(res, { 112 '@context': AP.AP_CONTEXT, 113 id: `${base}/ap/users/${auth.site.slug}/inbox`, 114 type: 'OrderedCollection', 115 totalItems: items.length, 116 orderedItems: items, 117 }); 118 }); 119 86 120 // ── Followers (count-only public, full for the owner) ───────────── 87 121 // A C2S bearer scoped to this site (the account owner) gets the real actor
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)