Changeset 2826bb97 in Klonkt for src/services/ActivityPubService.js
- Timestamp:
- 06/24/2026 12:52:51 PM (3 months ago)
- Branches:
- main
- Children:
- 7f46112b
- Parents:
- 594cc50
- File:
-
- 1 edited
-
src/services/ActivityPubService.js (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/services/ActivityPubService.js
r594cc50 r2826bb97 121 121 for (const m of body.matchAll(/<img\b[^>]*\bsrc="([^"]+)"[^>]*>/gi)) urls.push(abs(m[1])); 122 122 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, ''); 123 126 const seen = new Set(); 124 127 const attachment = urls.filter(Boolean) … … 488 491 const actor = await fetchActor(actorUri).catch(() => null); 489 492 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); 490 497 return { 491 498 object_uri: note.id, … … 495 502 actor_name: ai.name, 496 503 actor_icon: ai.icon, 504 url: note.url || url, 505 content: HtmlSanitizerService.sanitize(rawHtml), // full, sanitized 506 images, 497 507 preview: HtmlSanitizerService.toPlainText(note.content || '').slice(0, 240), 498 508 };
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)