fix(embeds): animate GIF previews; add Mixcloud/Deezer; misc embed fixes
GIF previews rendered but never played: Synapse's /thumbnail endpoint flattens animated GIFs to a still first frame. GifCard and the generic OG card now request the original via /download (no width/height) for GIFs, so they animate. Guarded with shouldServeGifOriginal(): a matrix:image:size cap (10 MB) keeps a huge self-hosted GIF on the frozen thumbnail, and the generic card's eager <img> gains loading="lazy" (it was the one preview image missing it) so originals stay off the wire until near the viewport. Also adds Mixcloud + Deezer inline media embeds (iframe widgets via parseMediaEmbed/MediaEmbedCard, matching the existing click-to-play pattern), and fixes Deezer podcast links: they live at /show/<id>, not /podcast/<id> (the latter 404s on Deezer's own oEmbed) — verified against the live API. Reviewed by two agents; both findings (Deezer /show, GIF eager-load) fixed and covered by tests. Desktop Tauri frame-src CSP updated separately. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -24,6 +24,9 @@ import {
|
||||
getBlueskyEmbed,
|
||||
getLoomId,
|
||||
getKickChannel,
|
||||
getMixcloudFeed,
|
||||
getDeezerEmbed,
|
||||
deezerEmbedHeight,
|
||||
getSteamTarget,
|
||||
steamWidgetEmbedUrl,
|
||||
buildVideoEmbedUrl,
|
||||
@@ -210,6 +213,58 @@ test('Apple Music: album vs single song height, embed host swap', () => {
|
||||
assert.equal(getAppleMusicEmbed('https://example.com/album/x/1'), null);
|
||||
});
|
||||
|
||||
test('Mixcloud: cloudcast feed vs profile/section', () => {
|
||||
assert.equal(
|
||||
getMixcloudFeed('https://www.mixcloud.com/NTSRadio/some-show-2024/'),
|
||||
'https://www.mixcloud.com/NTSRadio/some-show-2024/',
|
||||
);
|
||||
assert.equal(getMixcloudFeed('https://www.mixcloud.com/NTSRadio/'), null); // bare profile
|
||||
assert.equal(getMixcloudFeed('https://www.mixcloud.com/NTSRadio/uploads/'), null); // profile tab
|
||||
assert.equal(getMixcloudFeed('https://www.mixcloud.com/discover/house/'), null); // site section
|
||||
assert.equal(getMixcloudFeed('https://example.com/a/b/'), null);
|
||||
assert.ok(
|
||||
parseMediaEmbed('https://www.mixcloud.com/NTSRadio/some-show/', HOST)?.embedUrl.startsWith(
|
||||
'https://www.mixcloud.com/widget/iframe/?feed=',
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
test('Deezer: track / album / playlist (+ locale prefix)', () => {
|
||||
assert.deepEqual(getDeezerEmbed('https://www.deezer.com/track/3135556'), {
|
||||
type: 'track',
|
||||
id: '3135556',
|
||||
});
|
||||
assert.deepEqual(getDeezerEmbed('https://deezer.com/en/album/302127'), {
|
||||
type: 'album',
|
||||
id: '302127',
|
||||
});
|
||||
assert.deepEqual(getDeezerEmbed('https://www.deezer.com/us/playlist/1479458365?utm=x'), {
|
||||
type: 'playlist',
|
||||
id: '1479458365',
|
||||
});
|
||||
// Podcasts live at /show/<id>; /podcast/<id> is not a real Deezer path.
|
||||
assert.deepEqual(getDeezerEmbed('https://www.deezer.com/us/show/1002330852'), {
|
||||
type: 'show',
|
||||
id: '1002330852',
|
||||
});
|
||||
assert.deepEqual(getDeezerEmbed('https://www.deezer.com/us/episode/897651701'), {
|
||||
type: 'episode',
|
||||
id: '897651701',
|
||||
});
|
||||
assert.equal(getDeezerEmbed('https://www.deezer.com/us/podcast/1002330852'), null);
|
||||
assert.equal(getDeezerEmbed('https://www.deezer.com/'), null);
|
||||
assert.equal(getDeezerEmbed('https://www.deezer.com/track/notanid'), null);
|
||||
assert.equal(deezerEmbedHeight('track'), 152);
|
||||
assert.equal(deezerEmbedHeight('episode'), 152);
|
||||
assert.equal(deezerEmbedHeight('show'), 352);
|
||||
assert.equal(deezerEmbedHeight('album'), 352);
|
||||
assert.ok(
|
||||
parseMediaEmbed('https://www.deezer.com/track/3135556', HOST)?.embedUrl.startsWith(
|
||||
'https://widget.deezer.com/widget/dark/track/3135556',
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
test('getSteamTarget: app / news / bundle / non-content', () => {
|
||||
assert.deepEqual(getSteamTarget('https://store.steampowered.com/app/739630/Phasmophobia/'), {
|
||||
kind: 'app',
|
||||
|
||||
Reference in New Issue
Block a user