Changeset 2708282 in Klonkt
- Timestamp:
- 07/28/2026 10:45:26 AM (6 weeks ago)
- Branches:
- main
- Children:
- d9ad6c5
- Parents:
- 65abc85
- Files:
-
- 3 edited
-
src/routes/guardian.js (modified) (1 diff)
-
src/services/ActivityPubService.js (modified) (2 diffs)
-
test/gated-settings.test.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/guardian.js
r65abc85 r2708282 317 317 return res.json({ ok: true, allow, state: r.state, need: r.need, of: r.of }); 318 318 } 319 AP.deliverTo (site, uri, offer).catch(() => { /* queued, best-effort */ });319 AP.deliverToActor(site, uri, offer).catch(() => { /* queued, best-effort */ }); 320 320 res.json({ ok: true, allow, state: 'open', federated: true }); 321 321 }); -
src/services/ActivityPubService.js
r65abc85 r2708282 3647 3647 // { delivered, inbox }: delivered=false means the account could not be 3648 3648 // resolved at all (a bad handle) — the offer stays recorded regardless. 3649 async function deliverToActor(site, actorUri, activity) {3649 export async function deliverToActor(site, actorUri, activity) { 3650 3650 const me = selfActorId(site.slug); 3651 3651 const keys = getOrCreateKeys(site.slug); … … 3708 3708 getInteractions, getInteractionById, setInteractionBoosted, setInteractionLiked, setMyReaction, getMyReactions, buildReplyNote, getOutboxNote, deliverReply, resolveRemoteNote, 3709 3709 listOutbox, deliverOutboxDelete, deliverOutboxUpdate, deliverDirectNote, 3710 webfingerResolve, followActor, resolveRemoteActor, unfollowActor, listFollowing, setAutoBoost, backfillFromOutbox, getTimeline, timelineAttachments, timelineEmojis, timelineObjectLinks, timelineQuote, timelineEmbed, applyQuoteProps, sendInteraction, voteOnPoll, voteOnRemotePoll,3710 webfingerResolve, followActor, resolveRemoteActor, unfollowActor, listFollowing, setAutoBoost, backfillFromOutbox, getTimeline, timelineAttachments, timelineEmojis, timelineObjectLinks, timelineQuote, timelineEmbed, applyQuoteProps, deliverToActor, sendInteraction, voteOnPoll, voteOnRemotePoll, 3711 3711 acceptGatedFollow, rejectGatedFollow, isWardGuardian, sendFollowDecision, 3712 3712 parseOwnPoll, pollTally, ownPollView, deliverPollUpdate, maybeCrawlThread, sendReport, localMentionSlugs, -
test/gated-settings.test.js
r65abc85 r2708282 61 61 assert.equal(featureColumn('external_embeds = 1; DROP TABLE sites'), null); 62 62 }); 63 64 // Guard against the mistake that made the button do nothing: the route called 65 // AP.deliverTo, which existed only as a key in the guardianship deps object and 66 // not as an export. It threw a TypeError, Express answered 500, and the button 67 // silently reset. A grep hit is not an export. 68 test('the guardian route can reach every ActivityPub helper it calls', async () => { 69 const AP = (await import('../src/services/ActivityPubService.js')).default; 70 for (const fn of ['actorId', 'deliverToActor', 'followActor', 'backfillFromOutbox', 'getTimeline']) { 71 assert.equal(typeof AP[fn], 'function', `AP.${fn} must be exported, the guardian route calls it`); 72 } 73 }); 74 75 test('a gated-setting Offer carries ward, feature and value', async () => { 76 const { buildGatedOffer, parseGatedSetting } = await import('../src/services/guardianship/gated.js'); 77 const o = buildGatedOffer('https://a/gated/1', 'https://a/g1', 'https://b/ward', 'shaer:externalEmbeds', true); 78 assert.equal(o.type, 'Offer'); 79 assert.deepEqual(o.to, ['https://b/ward'], 'addressed to the ward server, which tallies'); 80 const parsed = parseGatedSetting(o.object); 81 assert.deepEqual(parsed, { ward: 'https://b/ward', feature: 'shaer:externalEmbeds', value: true }); 82 assert.equal(parseGatedSetting({ type: 'Relationship' }), null, 'a different Offer is not ours'); 83 });
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)