Changeset f278df9 in Klonkt for src/routes/posts.js


Ignore:
Timestamp:
06/26/2026 07:47:20 AM (2 months ago)
Author:
Robin Genis <roboburr@…>
Branches:
main
Children:
ce0bedf
Parents:
283f618
Message:

feat(fediverse): auto-boost a followed account ('feature an artist')

Phase 1 of the Cirkels-on-AP rework. A followed account can be marked auto-boost:
their new top-level posts are automatically re-Announced (boosted) to your own
followers. Toggle in the /tijdlijn following list + a checkbox on the follow box.
ap_following.auto_boost column (migrated), setAutoBoost(), hook in handleInbox's
timeline loop, POST /tijdlijn/autoboost. nl/en/de.

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/routes/posts.js

    r283f618 rf278df9  
    578578  if (site && handle.trim()) {
    579579    try {
    580       const r = await ActivityPubService.followActor(site, handle);
     580      const r = await ActivityPubService.followActor(site, handle, !!req.body.auto_boost);
    581581      if (r && r.error) q = 'error=' + encodeURIComponent(r.error === 'not_found' ? 'Account niet gevonden' : (r.error === 'unreachable' ? 'Server onbereikbaar' : 'Volgen mislukt'));
    582582      else q = 'success=' + encodeURIComponent('Je volgt nu ' + ((r && r.name) || handle));
     
    591591  if (site && actorUri) { try { await ActivityPubService.unfollowActor(site, actorUri); } catch (e) { /* ignore */ } }
    592592  res.redirect('/tijdlijn?success=' + encodeURIComponent('Ontvolgd'));
     593});
     594
     595// Toggle auto-boost ("feature this artist") on an account you already follow.
     596router.post('/tijdlijn/autoboost', requireSiteManager, (req, res) => {
     597  const site = res.locals.site;
     598  const actorUri = (req.body.actor_uri || '').toString();
     599  if (site && actorUri) ActivityPubService.setAutoBoost(site.slug, actorUri, !!req.body.auto_boost);
     600  res.redirect('/tijdlijn?success=' + encodeURIComponent(req.body.auto_boost ? 'Auto-boost aan 🔁' : 'Auto-boost uit'));
    593601});
    594602
Note: See TracChangeset for help on using the changeset viewer.