Changeset 16b0c00 in Klonkt for src/assets/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/assets/js/embed-player.js

    r5f47671 r16b0c00  
    101101      };
    102102      loadScript('https://open.spotify.com/embed/iframe-api/v1').catch(reject);
    103       setTimeout(() => reject(new Error('Spotify API timeout')), API_TIMEOUT);
     103      // Korter dan API_TIMEOUT: Spotify's bundle initialiseert snel óf helemaal
     104      // niet (CDN 503 / origin-gating). Niet 8s wachten vóór de iframe-fallback.
     105      setTimeout(() => reject(new Error('Spotify API timeout')), 4000);
    104106    });
    105107    return scripts.sp;
Note: See TracChangeset for help on using the changeset viewer.