Changeset 5085b1d in Klonkt for src


Ignore:
Timestamp:
06/25/2026 07:11:20 AM (3 months ago)
Author:
Robin Genis <roboburr@…>
Branches:
main
Children:
2af2e69
Parents:
f1e0c1f
Message:

fediverse: cache-buster on music listen-link to force a fresh SQUARE player card

Mastodon caches the player-card dimensions per URL and won't re-crawl a recent card,
so existing posts kept the old landscape ratio. Appending ?fc=<ver> to the listen-link
(playable posts only) makes Mastodon treat it as a new card URL and re-crawl it at
480x480. Link text stays clean; the page ignores the param. Bump FEDI_CARD_VER on
future dimension changes.

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/services/ActivityPubService.js

    rf1e0c1f r5085b1d  
    2222const PUBLIC = 'https://www.w3.org/ns/activitystreams#Public';
    2323const MAX_OUTBOX = 20;
     24// Cache-buster for the music listen-link → forces Mastodon to re-crawl a FRESH
     25// (square) player card. Bump this whenever the twitter:player card dimensions change.
     26const FEDI_CARD_VER = '2';
    2427
    2528// ── RSA keys per actor (lazy, cached in DB) ───────────────────────
     
    155158  if (hadAudio) {
    156159    const lbl = audioLabels.length ? esc(audioLabels.slice(0, 4).join(', ')) : '';
    157     body += `<p>🎵 ${lbl ? `<strong>${lbl}</strong> — ` : ''}<a href="${human}">listen on ${esc(site.title || 'the site')}</a></p>`;
     160    // For playable posts, append a version param to the listen-link so Mastodon
     161    // sees a NEW card URL and re-crawls it (fresh SQUARE player card) instead of
     162    // reusing the cached landscape one. Invisible: the link TEXT stays clean, the
     163    // page ignores the param. Bump FEDI_CARD_VER when the card dimensions change.
     164    const listenHref = playable ? `${human}?fc=${FEDI_CARD_VER}` : human;
     165    body += `<p>🎵 ${lbl ? `<strong>${lbl}</strong> — ` : ''}<a href="${listenHref}">listen on ${esc(site.title || 'the site')}</a></p>`;
    158166  }
    159167  const seen = new Set();
Note: See TracChangeset for help on using the changeset viewer.