Changeset f1e0c1f in Klonkt
- Timestamp:
- 06/25/2026 07:08:31 AM (3 months ago)
- Branches:
- main
- Children:
- 5085b1d
- Parents:
- 75bda38
- Location:
- src
- Files:
-
- 2 edited
-
routes/posts.js (modified) (1 diff)
-
services/ActivityPubService.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/posts.js
r75bda38 rf1e0c1f 365 365 if (post.status !== 'published') ActivityPubService.deliverCreate(site, apPost).catch(() => { /* best-effort */ }); 366 366 else ActivityPubService.deliverUpdate(site, apPost).catch(() => { /* best-effort */ }); 367 } 368 369 // Pin/unpin changed → push an actor Update so Mastodon re-fetches the featured 370 // (pinned) collection promptly instead of waiting for its own actor refresh. 371 if ((post.pinned || 0) !== parsePinnedRank(pinned)) { 372 ActivityPubService.deliverActorUpdate(site).catch(() => { /* best-effort */ }); 367 373 } 368 374 -
src/services/ActivityPubService.js
r75bda38 rf1e0c1f 651 651 type: 'Update', actor: me, to: [PUBLIC], cc: [`${me}/followers`], 652 652 object: note, 653 }; 654 for (const inbox of inboxes) deliverWithRetry(site.slug, inbox, update, `${me}#main-key`, keys.private_pem); 655 } 656 657 // Tell followers the ACTOR changed (Update + Person) so Mastodon re-processes the 658 // account AND re-fetches the featured (pinned) collection — there is no standard 659 // "featured changed" activity, so this is how a pin/unpin propagates promptly. 660 export async function deliverActorUpdate(site) { 661 const base = (process.env.PUBLIC_BASE_URL || '').replace(/\/+$/, ''); 662 if (!base || !site || !site.slug) return; 663 const followers = fStmts().list.all(site.slug); 664 if (!followers.length) return; 665 const inboxes = [...new Set(followers.map((f) => f.shared_inbox || f.inbox).filter(Boolean))]; 666 const keys = getOrCreateKeys(site.slug); 667 const me = actorId(base, site.slug); 668 const update = { 669 '@context': ['https://www.w3.org/ns/activitystreams', 'https://w3id.org/security/v1'], 670 id: `${me}#update-${Date.now()}`, 671 type: 'Update', actor: me, to: [PUBLIC], cc: [`${me}/followers`], 672 object: buildActor(base, site), 653 673 }; 654 674 for (const inbox of inboxes) deliverWithRetry(site.slug, inbox, update, `${me}#main-key`, keys.private_pem); … … 985 1005 getOrCreateKeys, apWants, sendAP, actorId, noteId, 986 1006 buildActor, buildNote, buildCreate, buildOutbox, buildFollowers, buildFeatured, 987 followerCount, deliver, fetchActor, verifyRequest, handleInbox, deliverCreate, deliverDelete, deliverUpdate, 1007 followerCount, deliver, fetchActor, verifyRequest, handleInbox, deliverCreate, deliverDelete, deliverUpdate, deliverActorUpdate, 988 1008 getInteractions, getInteractionById, buildReplyNote, getOutboxNote, deliverReply, resolveRemoteNote, 989 1009 listOutbox, deliverOutboxDelete,
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)