Changeset eb852c5 in Klonkt
- Timestamp:
- 06/24/2026 11:22:49 AM (3 months ago)
- Branches:
- main
- Children:
- c16e0a5
- Parents:
- 5a93ac0
- Location:
- src
- Files:
-
- 2 edited
-
routes/posts.js (modified) (1 diff)
-
services/ActivityPubService.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/posts.js
r5a93ac0 reb852c5 369 369 if (!PermissionsService.canDeletePost(req.session.user, post, site)) { 370 370 return res.status(403).send('No permission'); 371 } 372 373 // ActivityPub: tell followers the post is gone (Delete + Tombstone), but only 374 // if it was actually federated (published + not fan-only). Fire before the row 375 // is removed — we still have post.id (= the Note id). 376 if (post.status === 'published' && !post.fan_only) { 377 ActivityPubService.deliverDelete(site, post).catch(() => { /* best-effort */ }); 371 378 } 372 379 -
src/services/ActivityPubService.js
r5a93ac0 reb852c5 288 288 } 289 289 290 // Tell followers a post is gone (Delete + Tombstone) so it's removed from their feeds. 291 export async function deliverDelete(site, post) { 292 const base = (process.env.PUBLIC_BASE_URL || '').replace(/\/+$/, ''); 293 if (!base || !site || !site.slug || !post || !post.id) return; 294 const followers = fStmts().list.all(site.slug); 295 if (!followers.length) return; 296 const inboxes = [...new Set(followers.map((f) => f.shared_inbox || f.inbox).filter(Boolean))]; 297 const keys = getOrCreateKeys(site.slug); 298 const me = actorId(base, site.slug); 299 const nid = noteId(base, post.id); 300 const del = { 301 '@context': 'https://www.w3.org/ns/activitystreams', 302 id: `${nid}#delete-${Date.now()}`, 303 type: 'Delete', 304 actor: me, 305 to: [PUBLIC], 306 object: { id: nid, type: 'Tombstone' }, 307 }; 308 for (const inbox of inboxes) deliver(inbox, del, `${me}#main-key`, keys.private_pem).catch(() => { /* best-effort */ }); 309 } 310 290 311 export default { 291 312 getOrCreateKeys, apWants, sendAP, actorId, noteId, 292 313 buildActor, buildNote, buildCreate, buildOutbox, buildFollowers, 293 followerCount, deliver, fetchActor, verifyRequest, handleInbox, deliverCreate, 314 followerCount, deliver, fetchActor, verifyRequest, handleInbox, deliverCreate, deliverDelete, 294 315 };
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)