Changeset 5bf63b7 in Klonkt for src/routes/posts.js


Ignore:
Timestamp:
06/24/2026 10:35:48 AM (3 months ago)
Author:
Robin Genis <roboburr@…>
Branches:
main
Children:
dd1028a
Parents:
6bd25d1
Message:

feat(activitypub): phase 1b — Follow/Accept, HTTP Signatures, delivery

Inbox handles Follow (store follower + send signed Accept) and Undo Follow;
incoming requests are signature-verified (best-effort). Outgoing POSTs to inboxes
are signed (draft-cavage RSA-SHA256). New published public posts are delivered as
Create(Note) to followers' inboxes. Makes a Klonkt actor truly followable from
Mastodon; live interop test pending with Bart.

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/routes/posts.js

    r6bd25d1 r5bf63b7  
    1919import { audioUrl } from '../services/AudioStreamService.js';
    2020import { toWebp } from '../services/ImageWebpService.js';
     21import ActivityPubService from '../services/ActivityPubService.js';
    2122
    2223const __dirname = path.dirname(fileURLToPath(import.meta.url));
     
    230231      ).run(HtmlSanitizerService.toPlainText(cleanContent), title || '', req.session.user.username, postId);
    231232    } catch (e) { /* FTS index issues are non-fatal */ }
     233
     234    // ActivityPub: federate a freshly published public post to followers.
     235    if (!fanOnly) {
     236      ActivityPubService.deliverCreate(site, {
     237        id: postId, slug: finalSlug, title: title || finalSlug,
     238        content: cleanContent, published_at: publishedAt, created_at: now,
     239      }).catch(() => { /* best-effort */ });
     240    }
    232241  }
    233242
Note: See TracChangeset for help on using the changeset viewer.