Changeset 2d6a9c3 in Klonkt for src/services


Ignore:
Timestamp:
07/16/2026 12:20:51 PM (8 weeks ago)
Author:
Robin <roboburr@…>
Branches:
main
Children:
af21002
Parents:
8878814
git-author:
Robin <roboburr@…> (07/13/2026 05:21:50 AM)
git-committer:
Robin <roboburr@…> (07/16/2026 12:20:51 PM)
Message:

Spoor A step 1: bake post display HTML at save (ActivityPub source model)

Introduce the source/rendered split: posts.content stays the raw source (what
the editor round-trips), a new content_rendered column holds the baked display
HTML. bakePostContent() runs the linkify pipeline once at create/edit and
caches it; the render route serves content_rendered (falling back to an
on-the-fly bake for not-yet-baked posts) and no longer re-linkifies every view.
Verified: baked and fallback paths render byte-identically and a baked lone URL
still becomes an embed. This is the seam for step 2 (resolve @mentions once at
save instead of per page view) and removes the per-render linkify cost.

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/services/ActivityPubService.js

    r8878814 r2d6a9c3  
    14641464}
    14651465
     1466// Bake a post's raw source into its display HTML (the ActivityPub `source` model): done ONCE
     1467// at save and cached in posts.content_rendered, so page views serve it statically instead of
     1468// re-linkifying every render. Step 1 = #hashtags + bare URLs (cheap, no network). Step 2 will
     1469// resolve @mentions here too (webfinger once at save instead of per page view).
     1470export function bakePostContent(source) {
     1471  return linkifyBody('', source || '');
     1472}
     1473
    14661474// Extract the AP Hashtag tag objects from already-linked reply content.
    14671475function hashtagTags(base, content) {
     
    24632471  deliverWithRetry, enqueueDelivery, processDeliveryQueue, startDeliveryWorker,
    24642472  getReplyUris, markNotificationsSeen, countUnseenNotifications, hasPlayableAudio,
    2465   linkifyBody, listFollowers, removeFollower,
     2473  linkifyBody, bakePostContent, listFollowers, removeFollower,
    24662474};
Note: See TracChangeset for help on using the changeset viewer.