Changeset 0101d0a in Klonkt for src/services/ActivityPubService.js
- Timestamp:
- 07/28/2026 08:22:37 AM (6 weeks ago)
- Branches:
- main
- Children:
- c52dc82
- Parents:
- b258a79
- File:
-
- 1 edited
-
src/services/ActivityPubService.js (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/services/ActivityPubService.js
rb258a79 r0101d0a 2849 2849 // during a flux window, e.g. a fleet-wide update), and drops notes that are gone 2850 2850 // (404/410). Bump SELFHEAL_VERSION only on a release that warrants a re-sync. 2851 const SELFHEAL_VERSION = 1 5; // v15: re-capture emoji_json/link_json for boosts that arrived before the Announce-path tag fix2851 const SELFHEAL_VERSION = 16; // v16: resolve external link previews (embed_json) for posts that predate the embed pipeline 2852 2852 async function fetchNoteAP(url) { 2853 2853 try { … … 3159 3159 if (cur >= SELFHEAL_VERSION) return; // already healed for this version — skip on normal boots 3160 3160 let rows = []; 3161 try { rows = db.prepare('SELECT id, slug, content, media_json, nsfw, cw, url, emoji_json, link_json, quote_json, author_uri, author_name, author_emoji_json, reblog_name, reblog_handle, reblog_emoji_json FROM ap_timeline ORDER BY rowid DESC LIMIT 200').all(); } catch { /* no table */ }3161 try { rows = db.prepare('SELECT id, slug, content, media_json, nsfw, cw, url, emoji_json, link_json, quote_json, author_uri, author_name, author_emoji_json, reblog_name, reblog_handle, reblog_emoji_json, embed_json FROM ap_timeline ORDER BY rowid DESC LIMIT 200').all(); } catch { /* no table */ } 3162 3162 let healed = 0, failed = 0; 3163 3163 for (const r of rows) { … … 3185 3185 const ai = actorInfo(await fetchActor(r.author_uri), r.author_uri); 3186 3186 if (ai.emojis) { try { db.prepare('UPDATE ap_timeline SET author_emoji_json = ? WHERE id = ?').run(JSON.stringify(ai.emojis), r.id); } catch { /* ignore */ } } 3187 } 3188 // v16: link previews. A post from before the embed pipeline has no 3189 // card at all, which is why nothing showed. Only for rows that have no 3190 // quote (a quote already IS the card) and no embed yet, so this costs 3191 // one page fetch per candidate and never repeats. 3192 if (!r.quote_json && !r.embed_json) { 3193 const ej = await resolveExternalEmbed(html || r.content).catch(() => null); 3194 if (ej) { try { db.prepare('UPDATE ap_timeline SET embed_json = ? WHERE id = ?').run(ej, r.id); } catch { /* ignore */ } } 3187 3195 } 3188 3196 // v14: same for the booster's display name ("X boosted"). The row stores
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)