Changeset 16b0c00 in Klonkt for src/server.js


Ignore:
Timestamp:
06/20/2026 02:52:15 AM (3 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
2873b30
Parents:
5f47671
Message:

fix(embed): Spotify API via CSP whitelist + faster fallback

Diagnosis (measured live): the loader open.spotify.com (200) loads the real
API bundle from embed-cdn.spotifycdn.com, which was NOT in our CSP scriptSrc
→ API never init → 8s wait before the bare iframe = "sluggish". Not an
ad-blocker issue.

  • CSP: *.spotifycdn.com added to scriptSrc + connectSrc (+ *.scdn.co).
  • Spotify API timeout 8s → 4s so the iframe fallback appears quickly if the API still doesn't initialise (CDN 503 / origin gating).

buster embed-player.js?v=5.

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/server.js

    r5f47671 r16b0c00  
    9393        "https://s.ytimg.com",       // YouTube player-assets
    9494        "https://w.soundcloud.com",  // SoundCloud Widget API (api.js)
    95         "https://open.spotify.com",  // Spotify iFrame API
     95        "https://open.spotify.com",  // Spotify iFrame API (loader)
     96        "https://*.spotifycdn.com",  // Spotify iFrame API (echte bundle: embed-cdn.spotifycdn.com)
    9697      ],
    9798      // Helmet's default zet script-src-attr op 'none', wat ALLE inline event-
     
    103104      styleSrc: ["'self'", "'unsafe-inline'"],
    104105      imgSrc: ["'self'", "data:", "https:"],
    105       connectSrc: ["'self'", "wss:", "ws:"],
     106      connectSrc: ["'self'", "wss:", "ws:", "https://*.spotifycdn.com", "https://*.scdn.co"],
    106107      // blob: is required for the audio player — it fetch()es track bytes and
    107108      // plays from a blob: object URL (Spotify-style). Without blob: here the
Note: See TracChangeset for help on using the changeset viewer.