Changeset d3a1abd in Klonkt


Ignore:
Timestamp:
07/30/2026 09:22:06 AM (6 weeks ago)
Author:
Robin <roboburr@…>
Branches:
main
Children:
a9da2c0
Parents:
aa189d1
Message:

Gefedereerde content is schoon van media-tags

Robins schermafdrukken (30-7): twee videos in de Shaer-reader, een kapot. De
wortel zat hier: buildNote stript img-tags al uit de uitgaande content, maar
de video- en audio-tags van de nieuwe composer-posts niet. Elke remote lezer
kreeg de tag (relatieve /media-src, overal dood behalve op ons eigen web) EN
het attachment (absoluut, werkend): een kapotte speler boven de goede.

Video en audio verlaten de gefedereerde content nu op dezelfde manier als
afbeeldingen: ze rijden als AS2-attachments. Het web houdt zijn tags; de
strip is federatie-only.

Changed files:
src/services/ActivityPubService.js

  • buildNote stript video/audio-tags uit de uitgaande body

test/c2s-compose.test.js

  • de note-content is schoon van media-tags

remarks: 341 tests groen. De app-kant (defensieve strip voor oude notes en
oude servers) zit in de app-repos (android 83791cb, iOS fddb122).

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

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/services/ActivityPubService.js

    raa189d1 rd3a1abd  
    400400  }
    401401  body = body.replace(/<img\b[^>]*>/gi, '');
     402  // Video and audio tags leave the federated content the same way (30-7):
     403  // they ride as AS2 attachments (c2s_attachments), and the tag itself
     404  // carries a RELATIVE /media src that is dead everywhere but our own web.
     405  // Leaving it in showed every remote reader a broken player above the
     406  // working one. The web keeps its tags: this strip is federation-only.
     407  body = body.replace(/<video\b[^>]*>[\s\S]*?<\/video>/gi, '').replace(/<video\b[^>]*\/?>/gi, '');
     408  body = body.replace(/<audio\b[^>]*>[\s\S]*?<\/audio>/gi, '').replace(/<audio\b[^>]*\/?>/gi, '');
    402409  // Audio shortcodes: do NOT federate the raw audio file — Klonkt deliberately
    403410  // gates audio (the /audio/stream URL has friction), and shipping it as an AP
  • test/c2s-compose.test.js

    raa189d1 rd3a1abd  
    4444
    4545  const note = AP.buildNote('https://test.example', site, post);
     46  // The FEDERATED content carries no media tags: they ride as attachments,
     47  // and the tags' relative /media srcs are dead everywhere but our own web.
     48  // Leaving them in showed every remote reader a broken player above the
     49  // working one (Robins schermafdruk, 30-7).
     50  assert.ok(!/<(video|audio|img)\b/i.test(note.content), 'the note content is clean of media tags');
    4651  const att = note.attachment || [];
    4752  const img = att.find((a) => a.url.endsWith('/media/reply-media/foto.jpg'));
Note: See TracChangeset for help on using the changeset viewer.