Changeset 0aa23cf in Klonkt for src/routes


Ignore:
Timestamp:
06/24/2026 05:48:48 PM (3 months ago)
Author:
Robin Genis <roboburr@…>
Branches:
main
Children:
2279f80
Parents:
6bee3ec
Message:

fix(fediverse): ⭐ star now actually likes (was landing on the reply page)

The interaction page was reply-only, so clicking ⭐ (which bounces to
/authorize_interaction) dumped you on the reply composer. Added a ⭐ Like button
(+ POST /authorize_interaction/like → sendInteraction) and a 'liked' confirmation,
so the star flow completes with a real Like. Reply stays as a secondary action.

Co-Authored-By: Claude <noreply@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/routes/posts.js

    r6bee3ec r0aa23cf  
    522522  if (!sent) { try { target = await ActivityPubService.resolveRemoteNote(uri); } catch { /* ignore */ } }
    523523  renderPage(req, res, 'pages/authorize-interaction', {
    524     pageTitle: 'Reageer via de fediverse',
     524    pageTitle: 'Interacteer via de fediverse',
    525525    bodyClass: 'on-special',
    526526    uri,
    527527    target,
    528528    sent,
     529    liked: !!req.query.liked,
    529530    siteTitle: site ? site.title : '',
    530531  });
     532});
     533
     534// ⭐ Like a remote post from your own site (the star flow lands here).
     535router.post('/authorize_interaction/like', requireSiteManager, (req, res) => {
     536  const site = res.locals.site;
     537  const uri = (req.body.uri || '').toString();
     538  if (site && uri) {
     539    ActivityPubService.resolveRemoteNote(uri)
     540      .then((note) => note && ActivityPubService.sendInteraction(site, 'like', note.object_uri || uri, note.actor_uri))
     541      .catch((e) => console.warn('[AP] remote like failed:', e.message));
     542  }
     543  res.redirect('/authorize_interaction?liked=1&uri=' + encodeURIComponent(uri));
    531544});
    532545
Note: See TracChangeset for help on using the changeset viewer.