From 76929a87634d594de1441ed1cb76992db2f1a5d9 Mon Sep 17 00:00:00 2001 From: Lotus CI Date: Wed, 23 Sep 2026 22:09:34 -0400 Subject: [PATCH] docs(embeds): SoundCloud short links already embed via og:url (#200) The comment said on.soundcloud.com links need an oEmbed round-trip. They don't: Synapse follows the redirect for the preview and the og:url fallback re-parses the canonical track URL. Checked with a real short link (the play facade loads the w.soundcloud player). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01PPmy3tPq869XDW4njjVaKA --- src/app/utils/videoEmbed.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/app/utils/videoEmbed.ts b/src/app/utils/videoEmbed.ts index 1999ab64a..9bf1bcf8c 100644 --- a/src/app/utils/videoEmbed.ts +++ b/src/app/utils/videoEmbed.ts @@ -363,9 +363,11 @@ const SOUNDCLOUD_PROFILE_TABS = new Set([ export function isSoundCloudTrack(url: string): boolean { try { const { hostname, pathname } = new URL(url); - // NOTE: on.soundcloud.com short links are NOT handled here — the w.soundcloud - // widget resolver doesn't follow the redirect; supporting them needs an oEmbed - // round-trip (soundcloud.com/oembed is CORS-enabled) to get the canonical URL. + // on.soundcloud.com short links are not matched here (the w.soundcloud widget + // doesn't follow the redirect), but they still embed: Synapse follows the + // redirect when building the preview, and UrlPreviewCard's og:url fallback + // re-parses the canonical soundcloud.com// URL (verified with + // a real short link, Gitea #200). if (hostname.replace(/^www\./, '') !== 'soundcloud.com') return false; // // — at least two segments, not a bare profile const parts = pathname