Vencord/browser/background.js

25 lines
746 B
JavaScript
Raw Normal View History

2022-10-15 14:56:21 -04:00
if (typeof browser === "undefined") {
var browser = chrome;
}
browser.webRequest.onHeadersReceived.addListener(({ responseHeaders, url }) => {
const cspIdx = responseHeaders.findIndex(h => h.name === "content-security-policy");
if (cspIdx !== -1)
responseHeaders.splice(cspIdx, 1);
if (url.endsWith(".css")) {
const contentType = responseHeaders.find(h => h.name === "content-type");
if (contentType)
contentType.value = "text/css";
else
responseHeaders.push({
name: "content-type",
2022-11-09 10:08:11 -05:00
value: "text/css"
2022-10-15 14:56:21 -04:00
});
}
return {
responseHeaders
};
}, { urls: ["*://*.discord.com/*"] }, ["blocking", "responseHeaders"]);