Changeset 8ad1784 in Klonkt for src/routes
- Timestamp:
- 06/25/2026 09:08:20 PM (3 months ago)
- Branches:
- main
- Children:
- 7c62efb
- Parents:
- 4c12783
- File:
-
- 1 edited
-
src/routes/posts.js (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/posts.js
r4c12783 r8ad1784 485 485 const uri = (req.query.uri || '').toString(); 486 486 const sent = !!req.query.sent; 487 let target = null; 488 if (!sent) { try { target = await ActivityPubService.resolveRemoteNote(uri); } catch { /* ignore */ } } 487 const followed = !!req.query.followed; 488 let target = null, followTarget = null; 489 if (!sent && !followed && uri) { 490 try { target = await ActivityPubService.resolveRemoteNote(uri); } catch { /* ignore */ } 491 // Not a post? Maybe the URI is a profile/actor → offer Follow, not reply. 492 if (!target) { try { followTarget = await ActivityPubService.resolveRemoteActor(uri); } catch { /* ignore */ } } 493 } 489 494 renderPage(req, res, 'pages/authorize-interaction', { 490 495 pageTitle: 'Interacteer via de fediverse', … … 492 497 uri, 493 498 target, 499 followTarget, 494 500 sent, 501 followed, 495 502 liked: !!req.query.liked, 496 503 siteTitle: site ? site.title : '', … … 508 515 } 509 516 res.redirect('/authorize_interaction?liked=1&uri=' + encodeURIComponent(uri)); 517 }); 518 519 // Follow a remote actor from your own site (when the target is a profile, not a post). 520 router.post('/authorize_interaction/follow', requireSiteManager, (req, res) => { 521 const site = res.locals.site; 522 const uri = (req.body.uri || '').toString(); 523 if (site && uri) { 524 ActivityPubService.followActor(site, uri) 525 .catch((e) => console.warn('[AP] remote follow failed:', e.message)); 526 } 527 res.redirect('/authorize_interaction?followed=1&uri=' + encodeURIComponent(uri)); 510 528 }); 511 529
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)