Changeset 49edc72 in Klonkt for src/routes
- Timestamp:
- 06/25/2026 08:13:32 PM (3 months ago)
- Branches:
- main
- Children:
- 75ab393
- Parents:
- bf4596d
- File:
-
- 1 edited
-
src/routes/activitypub.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/activitypub.js
rbf4596d r49edc72 97 97 // Could be one of OUR outbound replies (ap_outbox), not a post. 98 98 const note = AP.getOutboxNote(baseUrl(req), req.params.id); 99 if (note) return AP.sendAP(res, { '@context': 'https://www.w3.org/ns/activitystreams', ...note }); 100 return res.status(404).end(); 99 if (!note) return res.status(404).end(); 100 if (!AP.apWants(req)) { 101 // A browser hit a reply's AP URL → send them to the source it replies to 102 // (where the post + its reactions live), falling back to the site home. 103 const src = (typeof note.inReplyTo === 'string' && /^https?:\/\//i.test(note.inReplyTo)) 104 ? note.inReplyTo : (baseUrl(req) + '/'); 105 return res.redirect(302, src); 106 } 107 return AP.sendAP(res, { '@context': 'https://www.w3.org/ns/activitystreams', ...note }); 101 108 } 102 109 const site = db.prepare('SELECT * FROM sites WHERE id = ?').get(post.site_id); 103 110 if (!site) return res.status(404).end(); 104 AP.sendAP(res, { '@context': 'https://www.w3.org/ns/activitystreams', ...AP.buildNote(baseUrl(req), site, post) }); 111 const note = AP.buildNote(baseUrl(req), site, post); 112 if (!AP.apWants(req)) { 113 // A browser hit a post's AP note URL → send them to the human post page 114 // (which shows the post + its "from the fediverse" reactions). 115 return res.redirect(302, note.url || (baseUrl(req) + '/')); 116 } 117 AP.sendAP(res, { '@context': 'https://www.w3.org/ns/activitystreams', ...note }); 105 118 }); 106 119
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)