aboutsummaryrefslogtreecommitdiff
path: root/browser
diff options
context:
space:
mode:
Diffstat (limited to 'browser')
-rw-r--r--browser/background.js28
-rw-r--r--browser/manifestv2.json35
-rw-r--r--browser/manifestv3.json (renamed from browser/manifest.json)0
3 files changed, 63 insertions, 0 deletions
diff --git a/browser/background.js b/browser/background.js
new file mode 100644
index 0000000..9c5ed96
--- /dev/null
+++ b/browser/background.js
@@ -0,0 +1,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']
+)
diff --git a/browser/manifestv2.json b/browser/manifestv2.json
new file mode 100644
index 0000000..f18443c
--- /dev/null
+++ b/browser/manifestv2.json
@@ -0,0 +1,35 @@
+{
+ "manifest_version": 2,
+ "name": "Vencord Web",
+ "description": "Yeee",
+ "version": "1.0.0",
+ "author": "Vendicated",
+ "homepage_url": "https://github.com/Vendicated/Vencord",
+ "host_permissions": [
+ "*://*.discord.com/*",
+ "https://raw.githubusercontent.com/*"
+ ],
+ "permissions": [
+ "webRequest",
+ "webRequestBlocking"
+ ],
+ "content_scripts": [
+ {
+ "run_at": "document_start",
+ "matches": [
+ "*://*.discord.com/*"
+ ],
+ "js": [
+ "content.js"
+ ]
+ }
+ ],
+ "web_accessible_resources": [
+ "dist/Vencord.js"
+ ],
+ "background": {
+ "scripts": [
+ "background.js"
+ ]
+ }
+}
diff --git a/browser/manifest.json b/browser/manifestv3.json
index ea79d12..ea79d12 100644
--- a/browser/manifest.json
+++ b/browser/manifestv3.json