Changeset 3d7312a in Klonkt for src/routes
- Timestamp:
- 06/24/2026 12:44:21 PM (3 months ago)
- Branches:
- main
- Children:
- 594cc50
- Parents:
- 82079ad
- File:
-
- 1 edited
-
src/routes/posts.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/posts.js
r82079ad r3d7312a 86 86 'tag', 'type', 'user', 'users', 'artiesten', 'leden', 'favorieten', 'feed.xml', 'atom.xml', 'sitemap.xml', 87 87 'manifest.webmanifest', 'sw.js', 'favicon.ico', 'favicon.svg', 'assets', 88 'authorize_interaction', 88 89 ]); 89 90 … … 509 510 return { newerPost, olderPost }; 510 511 } 512 513 // ==================== REMOTE INTERACTION (reply to a fediverse post as your site) ==================== 514 // Standard fediverse "reply from your own server" landing endpoint. A post page 515 // elsewhere bounces the visitor here with ?uri=<remote post>; the site owner 516 // composes a reply that federates back to that post. 517 router.get('/authorize_interaction', requireSiteManager, async (req, res) => { 518 const site = res.locals.site; 519 const uri = (req.query.uri || '').toString(); 520 let target = null; 521 try { target = await ActivityPubService.resolveRemoteNote(uri); } catch { /* ignore */ } 522 renderPage(req, res, 'pages/authorize-interaction', { 523 pageTitle: 'Reageer via de fediverse', 524 bodyClass: 'on-special', 525 uri, 526 target, 527 siteTitle: site ? site.title : '', 528 }); 529 }); 530 531 router.post('/authorize_interaction', requireSiteManager, async (req, res) => { 532 const site = res.locals.site; 533 const uri = (req.body.uri || '').toString(); 534 const text = (req.body.text || '').toString(); 535 if (site && uri && text.trim()) { 536 try { 537 const parent = await ActivityPubService.resolveRemoteNote(uri); 538 if (parent) await ActivityPubService.deliverReply(site, { postId: '', postSlug: null, parent, text }); 539 } catch (e) { console.warn('[AP] remote reply failed:', e.message); } 540 } 541 // Send them to the post they replied to so they can see the thread. 542 res.redirect(uri && /^https?:\/\//i.test(uri) ? uri : (res.locals.siteUrlBase || '/')); 543 }); 511 544 512 545 // ==================== VIEW POST (last route — catches /:slug) ====================
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)