Ignore:
Timestamp:
06/24/2026 12:52:51 PM (3 months ago)
Author:
Robin Genis <roboburr@…>
Branches:
main
Children:
7f46112b
Parents:
594cc50
Message:

feat(activitypub): full post on reply page + strip audio shortcodes from federation

buildNote strips album|playlist shortcodes (they federated raw).
resolveRemoteNote returns the full sanitized content + image attachments; the
authorize_interaction compose page shows the whole post + images + a 'view full
post + comments on the source' link.

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/services/ActivityPubService.js

    r594cc50 r2826bb97  
    121121  for (const m of body.matchAll(/<img\b[^>]*\bsrc="([^"]+)"[^>]*>/gi)) urls.push(abs(m[1]));
    122122  body = body.replace(/<img\b[^>]*>/gi, '');
     123  // Strip Klonkt audio shortcodes ([[track:…]] etc.) — they'd federate raw as
     124  // ugly text (audio federation itself is a later phase).
     125  body = body.replace(/\[\[(track|album|playlist):[^\]]+\]\]/gi, '');
    123126  const seen = new Set();
    124127  const attachment = urls.filter(Boolean)
     
    488491  const actor = await fetchActor(actorUri).catch(() => null);
    489492  const ai = actorInfo(actor, actorUri);
     493  const rawHtml = String(note.content || '').replace(/\[\[(track|album|playlist):[^\]]+\]\]/gi, '');
     494  const images = (Array.isArray(note.attachment) ? note.attachment : [])
     495    .filter((a) => a && a.url && (!a.mediaType || /^image\//i.test(a.mediaType)))
     496    .map((a) => a.url);
    490497  return {
    491498    object_uri: note.id,
     
    495502    actor_name: ai.name,
    496503    actor_icon: ai.icon,
     504    url: note.url || url,
     505    content: HtmlSanitizerService.sanitize(rawHtml),       // full, sanitized
     506    images,
    497507    preview: HtmlSanitizerService.toPlainText(note.content || '').slice(0, 240),
    498508  };
Note: See TracChangeset for help on using the changeset viewer.