Changeset 4b5223f in Klonkt


Ignore:
Timestamp:
06/25/2026 09:36:24 AM (3 months ago)
Author:
Robin Genis <roboburr@…>
Branches:
main
Children:
3dd99d3
Parents:
55bba23
Message:

fediverse: federate external embeds as a bare URL link (Mastodon renders its own card)

A post's [[embed:url]] shortcode (YouTube/Spotify/SoundCloud) federated as raw shortcode
text. buildNote now emits the bare URL as a link so Mastodon generates its own preview/
player card.

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/services/ActivityPubService.js

    r55bba23 r4b5223f  
    156156  } catch { /* non-fatal */ }
    157157  body = body.replace(/\[\[(track|album|playlist):[^\]]+\]\]/gi, '');
     158  // External embeds ([[embed:url]]) → emit the bare URL as a link so Mastodon
     159  // renders its OWN preview/player card (YouTube/Spotify/SoundCloud/etc) instead
     160  // of federating the raw shortcode text.
     161  body = body.replace(/\[\[embed:([^\]]+)\]\]/gi, (mm, raw) => {
     162    const u = esc(raw.trim().replace(/&amp;/g, '&'));
     163    return `<p><a href="${u}">${u}</a></p>`;
     164  });
    158165  if (hadAudio) {
    159166    const lbl = audioLabels.length ? esc(audioLabels.slice(0, 4).join(', ')) : '';
Note: See TracChangeset for help on using the changeset viewer.