blob: 9c5ed96c3083ad89fad5a8342c0700a97039d680 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
function setContentTypeOnStylesheets(details) {
if (details.type === 'stylesheet') {
details.responseHeaders.push({name: 'Content-Type', value: 'text/css'})
}
return {responseHeaders: details.responseHeaders }
}
var cspHeaders = [
'content-security-policy',
'content-security-policy-report-only',
]
function removeCSPHeaders(details) {
return {responseHeaders: details.responseHeaders.filter(header =>
!cspHeaders.includes(header.name.toLowerCase()))}
}
browser.webRequest.onHeadersReceived.addListener(
setContentTypeOnStylesheets, {urls: ["https://raw.githubusercontent.com/*"]}, ['blocking']
)
browser.webRequest.onHeadersReceived.addListener(
removeCSPHeaders, {urls: ["https://raw.githubusercontent.com/*", "*://*.discord.com/*"]}, ['blocking', 'responseHeaders']
)
|