PEE/firefox/bepis.js

23 lines
842 B
JavaScript
Raw Normal View History

2022-12-22 23:46:30 +00:00
const filts = {
urls: ["https://desuarchive.org/*",
"https://arch.b4k.co/*",
"https://kohlchan.net/*"
],
types: ["main_frame", "sub_frame", "csp_report", "object", "other", "ping"]
};
chrome.webRequest.onHeadersReceived.addListener(details => {
const nuke = ['https://arch.b4k.co/', 'https://kohlchan.net/'];
if (nuke.some(u => details.url.startsWith(u)) && details.type == "main_frame") {
const e = details.responseHeaders.findIndex(e => e.name.toLowerCase() == "content-security-policy");
if (e >= 0)
details.responseHeaders[e].value = "";
return {
responseHeaders: [
...details.responseHeaders,
{ name: 'access-control-allow-origin', value: '*' }
]
};
}
}, filts, ['blocking', 'responseHeaders']);