Hey, can you also offer jsdeliver for the codemirror if the script detects that cloudflare cant load?
Cloudflare doesnt load here as it’s in one of our dns filter lists.
Thanks
I tried the following code:
fetch(“https://cdnjs.cloudflare.com/”).then((response) => {
if (response.ok) {
return response.json();
} else {
throw new Error(‘Something went wrong’);
}
})
.then((responseJson) => {
// Do something with the response
})
.catch((error) => {
console.log(“aww”)
const fixCdn = setInterval(() => {
fetch()
if (CodeMirror.modeURL) {
clearInterval(fixCdn);
CodeMirror.modeURL = “https://cdn.jsdelivr.net/npm/codemirror/mode/%N/%N.js”
}
}, 999)
});
but get blocked:
loadmode.js:46 Refused to load the script ‘https://cdn.jsdelivr.net/npm/codemirror/mode/jsx/jsx.js’ because it violates the following Content Security Policy directive: "script-src ‘self’
https://apis.google.com
https://cdnjs.cloudflare.com
https://cdn.segment.com
https://ajax.googleapis.com
https://*.woopra.com
'sha256-aROmP5KBVON8dHdF7kTobxNwhI67hJuBpk+jNh/jbM4='
'sha256-lIXJkTrfgeKmujhwsIkqzNbMkplZdPFm1ERXsf46uOw='
'sha256-To0Iwo79L42agXa29pvaAn64gM4rwT1BflbRPGdqcUg='
'sha256-IWN+DH0UXsSKPql06C66AvLM8/jMYbOe+wVRfPlzHDY='
http://www.luckyorange.com https://ssl.luckyorange.com https://d10lpsik1i8c69.cloudfront.net
https://cdn.amplitude.com". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.
try making your own that should work
My own glitch.com? Its a cdn issue with codemirror and my end
I was able to implement that using
and a glitch project https://glitch.com/~glitch-resources
Link does not seem to be working for me @blubbll
Is CloudFlare blocked by your ISP? If so it would be a good idea to make a topic on the CloudFlare community as they’ll probably have your ISP remove the block. Also if your ISP blocks CloudFlare CDN/DNS then you’re a bit screwed for a lot of sites…
Also to note that jsdelivr just falls back on 3 CDN providers anyway:
- Stackpath
- CloudFlare
- fastly
Sorry if I didn’t understand your topic that much, it seems a little confusing.
it was an early try to proxy glitch.com but failed.
the codemirror is blocked cuz its loaded by cloudflare. cloudflare is blocked by our network admins atm. i guess i just gonna use a chrome taste with security disabled to override the over-aggresive csp and then just use the js in the second post…
Ah. It’s a bit odd that your network admins decided to block the CloudFlare CDN… If you have a little server (e.g A Raspberry Pi) at your house you could run a basic VPN on it. The only issue then is you wouldn’t be able to access any network drives on the network (not your home network).
nevermind, cloudflare got unblocked after a lot of weeks and calls.