aboutsummaryrefslogtreecommitdiff
path: root/browser
diff options
context:
space:
mode:
authorV <vendicated@riseup.net>2023-09-21 18:56:58 +0200
committerV <vendicated@riseup.net>2023-09-21 18:56:58 +0200
commit97b6699afefe373d510dda5589a0754a4b380153 (patch)
tree112c8dd963aa4ed64702c9444738fbcca9d4674a /browser
parent7e91edc7577ba65fab08bc45c07cbd6f1756bd6f (diff)
downloadVencord-97b6699afefe373d510dda5589a0754a4b380153.tar.gz
Vencord-97b6699afefe373d510dda5589a0754a4b380153.tar.bz2
Vencord-97b6699afefe373d510dda5589a0754a4b380153.zip
Fuck you Mozilla
Diffstat (limited to 'browser')
-rw-r--r--browser/background.js32
-rw-r--r--browser/manifestv2.json6
2 files changed, 1 insertions, 37 deletions
diff --git a/browser/background.js b/browser/background.js
deleted file mode 100644
index 1f2d5ec..0000000
--- a/browser/background.js
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * @template T
- * @param {T[]} arr
- * @param {(v: T) => boolean} predicate
- */
-function removeFirst(arr, predicate) {
- const idx = arr.findIndex(predicate);
- if (idx !== -1) arr.splice(idx, 1);
-}
-
-chrome.webRequest.onHeadersReceived.addListener(
- ({ responseHeaders, type, url }) => {
- if (!responseHeaders) return;
-
- if (type === "main_frame") {
- // In main frame requests, the CSP needs to be removed to enable fetching of custom css
- // as desired by the user
- removeFirst(responseHeaders, h => h.name.toLowerCase() === "content-security-policy");
- } else if (type === "stylesheet" && url.startsWith("https://raw.githubusercontent.com/")) {
- // Most users will load css from GitHub, but GitHub doesn't set the correct content type,
- // so we fix it here
- removeFirst(responseHeaders, h => h.name.toLowerCase() === "content-type");
- responseHeaders.push({
- name: "Content-Type",
- value: "text/css"
- });
- }
- return { responseHeaders };
- },
- { urls: ["https://raw.githubusercontent.com/*", "*://*.discord.com/*"], types: ["main_frame", "stylesheet"] },
- ["blocking", "responseHeaders"]
-);
diff --git a/browser/manifestv2.json b/browser/manifestv2.json
index 3cac945..a6feada 100644
--- a/browser/manifestv2.json
+++ b/browser/manifestv2.json
@@ -26,11 +26,7 @@
}
],
- "background": {
- "scripts": ["background.js"]
- },
-
- "web_accessible_resources": ["dist/Vencord.js", "dist/Vencord.css"],
+ "web_accessible_resources": ["dist/*", "third-party/*"],
"browser_specific_settings": {
"gecko": {