Changeset 8b07c12 in Klonkt
- Timestamp:
- 07/22/2026 12:26:08 AM (7 weeks ago)
- Branches:
- main
- Children:
- dc4aa08
- Parents:
- 4c70ecb
- Files:
-
- 4 edited
-
src/routes/activitypub.js (modified) (1 diff)
-
src/services/ActivityPubService.js (modified) (1 diff)
-
test/activitypub-as2.test.js (modified) (1 diff)
-
test/c2s-block.test.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/activitypub.js
r4c70ecb r8b07c12 87 87 ).all(site.id); 88 88 AP.sendAP(res, AP.buildOutbox(baseUrl(req), site, posts)); 89 }); 90 91 // ── Blocked collection (owner only, AP §5.6) ────────────────────── 92 // The server blocklist is the source of truth for Shaer's "in Orbit": 93 // clients read it here instead of keeping their own state. Actor-kind 94 // blocks only (domain blocks are instance policy, not an Orbit member). 95 router.get('/ap/users/:slug/blocked', (req, res) => { 96 const auth = OAuth.verifyBearer(req.headers.authorization); 97 if (!auth || auth.site.slug !== req.params.slug) return res.status(403).end(); 98 const base = baseUrl(req); 99 const items = AP.listBlocks(auth.site.slug) 100 .filter((b) => b.kind === 'actor') 101 .map((b) => b.target); 102 AP.sendAP(res, { 103 '@context': AP.AP_CONTEXT, 104 id: `${base}/ap/users/${auth.site.slug}/blocked`, 105 type: 'OrderedCollection', 106 totalItems: items.length, 107 orderedItems: items, 108 }); 89 109 }); 90 110 -
src/services/ActivityPubService.js
r4c70ecb r8b07c12 167 167 following: `${id}/following`, 168 168 featured: `${id}/featured`, 169 // AP §5.6: the private blocked collection (owner-only GET). The server 170 // list is the source of truth for Shaer's "in Orbit"; clients keep no 171 // separate state. 172 blocked: `${id}/blocked`, 169 173 // C2S clients (Shaer apps) discover auth + upload here — no hardcoded paths. 170 174 // All four are ActivityPub-spec `endpoints` terms. Dynamic client registration -
test/activitypub-as2.test.js
r4c70ecb r8b07c12 30 30 'totalItems', 'orderedItems', 'items', 'first', 'last', 'partOf', 'next', 'prev', 31 31 'preferredUsername', 'inbox', 'outbox', 'followers', 'following', 'endpoints', 'sharedInbox', 32 // ActivityPub §5.6: the private blocked collection (owner-only GET). 33 'blocked', 32 34 // ActivityPub §4.1 `endpoints` vocabulary (same category as sharedInbox), used for C2S. 33 35 'oauthAuthorizationEndpoint', 'oauthTokenEndpoint', 'uploadMedia', -
test/c2s-block.test.js
r4c70ecb r8b07c12 43 43 assert.equal(out.status, 400); 44 44 }); 45 46 test('the actor advertises the blocked collection (AP 5.6)', () => { 47 site.primary_slug = 'me'; 48 const actor = AP.buildActor('https://test.example', site); 49 assert.equal(actor.blocked, 'https://test.example/ap/users/me/blocked'); 50 }); 51 52 test('actor-kind blocks form the collection items; domain blocks stay out', async () => { 53 await AP.ingestOutboxActivity(site, user, { type: 'Block', object: BULLY }); 54 await AP.blockTarget(site, 'nare-server.example'); // domain block 55 const items = AP.listBlocks('me').filter((b) => b.kind === 'actor').map((b) => b.target); 56 assert.deepEqual(items, [BULLY]); 57 });
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)