Changeset 41a7637 in Klonkt for src/routes/posts.js
- Timestamp:
- 06/24/2026 01:04:50 PM (3 months ago)
- Branches:
- main
- Children:
- cc24fa1
- Parents:
- 7f46112b
- File:
-
- 1 edited
-
src/routes/posts.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/posts.js
r7f46112b r41a7637 518 518 const site = res.locals.site; 519 519 const uri = (req.query.uri || '').toString(); 520 const sent = !!req.query.sent; 520 521 let target = null; 521 try { target = await ActivityPubService.resolveRemoteNote(uri); } catch { /* ignore */}522 if (!sent) { try { target = await ActivityPubService.resolveRemoteNote(uri); } catch { /* ignore */ } } 522 523 renderPage(req, res, 'pages/authorize-interaction', { 523 524 pageTitle: 'Reageer via de fediverse', … … 525 526 uri, 526 527 target, 528 sent, 527 529 siteTitle: site ? site.title : '', 528 530 }); 529 531 }); 530 532 531 router.post('/authorize_interaction', requireSiteManager, async(req, res) => {533 router.post('/authorize_interaction', requireSiteManager, (req, res) => { 532 534 const site = res.locals.site; 533 535 const uri = (req.body.uri || '').toString(); 534 536 const text = (req.body.text || '').toString(); 535 537 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 || '/')); 538 // Resolve + deliver in the background so Send responds instantly. 539 ActivityPubService.resolveRemoteNote(uri) 540 .then((parent) => parent && ActivityPubService.deliverReply(site, { postId: '', postSlug: null, parent, text })) 541 .catch((e) => console.warn('[AP] remote reply failed:', e.message)); 542 } 543 res.redirect('/authorize_interaction?sent=1&uri=' + encodeURIComponent(uri)); 543 544 }); 544 545
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)