diff options
| author | CenTdemeern1 <timo.herngreen@gmail.com> | 2024-10-16 19:26:33 +0200 |
|---|---|---|
| committer | CenTdemeern1 <timo.herngreen@gmail.com> | 2024-12-08 19:15:41 +0100 |
| commit | 354bed1c32ebc03debf0d4467d1e9c8fd4948f2c (patch) | |
| tree | 36f7333c411710743f26f606c0ce33c5b5f9965a /packages/frontend/src | |
| parent | Add a missing import (diff) | |
| download | sharkey-354bed1c32ebc03debf0d4467d1e9c8fd4948f2c.tar.gz sharkey-354bed1c32ebc03debf0d4467d1e9c8fd4948f2c.tar.bz2 sharkey-354bed1c32ebc03debf0d4467d1e9c8fd4948f2c.zip | |
Commit to raw.esm.sh
This commit also adds an error message for when the Content Security Policy is likely at fault for blocking it.
Diffstat (limited to 'packages/frontend/src')
| -rw-r--r-- | packages/frontend/src/components/SkFlashPlayer.vue | 13 | ||||
| -rw-r--r-- | packages/frontend/src/index.html | 4 |
2 files changed, 13 insertions, 4 deletions
diff --git a/packages/frontend/src/components/SkFlashPlayer.vue b/packages/frontend/src/components/SkFlashPlayer.vue index aa6dfdc642..4fc54fcc2a 100644 --- a/packages/frontend/src/components/SkFlashPlayer.vue +++ b/packages/frontend/src/components/SkFlashPlayer.vue @@ -106,7 +106,7 @@ async function loadRuffle() { window.RufflePlayer.config = { // Options affecting the whole page - 'publicPath': `https://esm.sh/@ruffle-rs/ruffle@${packageInfo.dependencies['@ruffle-rs/ruffle']}/`, + 'publicPath': `https://raw.esm.sh/@ruffle-rs/ruffle@${packageInfo.dependencies['@ruffle-rs/ruffle']}/`, 'polyfills': false, // Options affecting files only @@ -171,7 +171,16 @@ function loadContent() { loadingStatus.value = 'Loading Flash file'; player.value.load(url.value).then(() => { loadingStatus.value = undefined; - }).catch(handleError); + }).catch(error => { + fetch('https://raw.esm.sh/', { + mode: 'cors', + }).then(() => { + handleError(error); // Unexpected error + }).catch(() => { + // Must be CSP because esm.sh should be online if `loadRuffle()` didn't fail + handleError('raw.esm.sh could not be accessed, meaning this instance\'s Content Security Policy is likely out of date. Please contact your instance administrators.'); + }); + }); } function playPause() { diff --git a/packages/frontend/src/index.html b/packages/frontend/src/index.html index 55d6b6cffd..c03902f505 100644 --- a/packages/frontend/src/index.html +++ b/packages/frontend/src/index.html @@ -18,11 +18,11 @@ http-equiv="Content-Security-Policy" content="default-src 'self' https://newassets.hcaptcha.com/ https://challenges.cloudflare.com/ http://localhost:7493/; worker-src 'self' blob:; - script-src 'self' 'unsafe-eval' https://*.hcaptcha.com https://challenges.cloudflare.com https://esm.sh https://cdn.jsdelivr.net; + script-src 'self' 'unsafe-eval' https://*.hcaptcha.com https://challenges.cloudflare.com https://esm.sh https://cdn.jsdelivr.net https://raw.esm.sh; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob: www.google.com xn--931a.moe localhost:3000 localhost:5173 127.0.0.1:5173 127.0.0.1:3000 activitypub.software secure.gravatar.com avatars.githubusercontent.com; media-src 'self' localhost:3000 localhost:5173 127.0.0.1:5173 127.0.0.1:3000; - connect-src 'self' localhost:3000 localhost:5173 127.0.0.1:5173 127.0.0.1:3000 https://newassets.hcaptcha.com https://api.listenbrainz.org https://api.friendlycaptcha.com; + connect-src 'self' localhost:3000 localhost:5173 127.0.0.1:5173 127.0.0.1:3000 https://newassets.hcaptcha.com https://api.listenbrainz.org https://api.friendlycaptcha.com https://raw.esm.sh; frame-src *;" /> <meta property="og:site_name" content="[DEV BUILD] Misskey" /> |