Changeset af6e085 in Klonkt


Ignore:
Timestamp:
07/26/2026 08:23:26 AM (6 weeks ago)
Author:
Robin Genis <roboburr@…>
Branches:
main
Children:
46a30f0
Parents:
6fd0e20
Message:

Quote-kaart snapshot: media als array + emoji-map van de geciteerde post

De geresolvede snapshot bewaarde media als JSON-string (dubbel gecodeerd) en gaf
de FEP-9098 emoji's van de geciteerde post niet mee. Nu is media een echte array
en zit de emoji-map (shortcode -> url) erbij, zodat de geneste quote-kaart een
thumbnail toont en :shortcode: als emoji rendert. Self-heal v11 -> v12 zodat de
al geresolvede snapshots de nieuwe vorm krijgen.

Changed files:
src/services/ActivityPubService.js

  • resolveQuote: media als array (JSON.parse), emojis-map uit q.tag
  • SELFHEAL_VERSION 11 -> 12

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/services/ActivityPubService.js

    r6fd0e20 raf6e085  
    27612761// during a flux window, e.g. a fleet-wide update), and drops notes that are gone
    27622762// (404/410). Bump SELFHEAL_VERSION only on a release that warrants a re-sync.
    2763 const SELFHEAL_VERSION = 11; // v11: also resolve the FEP-044f embedded quote card (quote_json) onto already-cached posts
     2763const SELFHEAL_VERSION = 12; // v12: quote card snapshot media as array + quoted-post emojis
    27642764async function fetchNoteAP(url) {
    27652765  try {
     
    27942794    : (q.attributedTo && typeof q.attributedTo.id === 'string' ? q.attributedTo.id : null);
    27952795  const ai = authorUri ? actorInfo(await fetchActor(authorUri), authorUri) : null;
     2796  // The quoted post's own FEP-9098 emojis, so :shortcode: renders in the card.
     2797  const emojis = {};
     2798  try {
     2799    for (const e of JSON.parse(extractEmojiTags(q.tag) || '[]')) {
     2800      const u = e.icon && (e.icon.url || (Array.isArray(e.icon) && e.icon[0] && e.icon[0].url));
     2801      if (typeof e.name === 'string' && u) emojis[e.name] = u;
     2802    }
     2803  } catch { /* ignore */ }
     2804  let media = []; try { media = JSON.parse(mediaFromNote(q)); } catch { /* ignore */ }
    27962805  const snapshot = {
    27972806    url: safeUrl(q.url || q.id || url) || url,
     
    27992808    content: HtmlSanitizerService.sanitize(q.content || ''),
    28002809    published: q.published || null,
    2801     media: mediaFromNote(q),
     2810    media,
     2811    emojis: Object.keys(emojis).length ? emojis : undefined,
    28022812  };
    28032813  return JSON.stringify(snapshot);
Note: See TracChangeset for help on using the changeset viewer.