aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAjay <[email protected]>2024-06-19 22:37:29 +0530
committerAjay <[email protected]>2024-06-19 22:37:29 +0530
commita95020dda3d3f05691f5277e69688f05ac59dc1e (patch)
treef7a571aeaf0493b4e84b4aec1ff32b5133948ce5
parent98ac2fc618e8a74a5f467ffb5f0ea37e8aeba38c (diff)
downloadSponsorBlock-a95020dda3d3f05691f5277e69688f05ac59dc1e.tar.gz
SponsorBlock-a95020dda3d3f05691f5277e69688f05ac59dc1e.zip
Manifest v3 without invidious working
-rw-r--r--manifest/chrome-manifest-extra.json152
-rw-r--r--manifest/firefox-manifest-extra.json3
-rw-r--r--manifest/manifest-v2-extra.json133
-rw-r--r--manifest/manifest.json138
-rw-r--r--manifest/safari-manifest-extra.json3
-rw-r--r--src/background.ts4
-rw-r--r--src/utils/logger.ts18
7 files changed, 295 insertions, 156 deletions
diff --git a/manifest/chrome-manifest-extra.json b/manifest/chrome-manifest-extra.json
index 9cb5082d..4af7eb82 100644
--- a/manifest/chrome-manifest-extra.json
+++ b/manifest/chrome-manifest-extra.json
@@ -1,12 +1,150 @@
{
- "optional_permissions": [
- "declarativeContent",
- "webNavigation"
+ "host_permissions": [
+ "https://*.youtube.com/*",
+ "https://sponsor.ajay.app/*"
],
+ "optional_host_permissions": [
+ "*://*/*"
+ ],
+ "web_accessible_resources": [{
+ "resources": [
+ "icons/LogoSponsorBlocker256px.png",
+ "icons/IconSponsorBlocker256px.png",
+ "icons/PlayerStartIconSponsorBlocker.svg",
+ "icons/PlayerStopIconSponsorBlocker.svg",
+ "icons/PlayerUploadIconSponsorBlocker.svg",
+ "icons/PlayerUploadFailedIconSponsorBlocker.svg",
+ "icons/PlayerCancelSegmentIconSponsorBlocker.svg",
+ "icons/clipboard.svg",
+ "icons/settings.svg",
+ "icons/pencil.svg",
+ "icons/check.svg",
+ "icons/check-smaller.svg",
+ "icons/upvote.png",
+ "icons/downvote.png",
+ "icons/thumbs_down.svg",
+ "icons/thumbs_down_locked.svg",
+ "icons/thumbs_up.svg",
+ "icons/help.svg",
+ "icons/report.png",
+ "icons/close.png",
+ "icons/skipIcon.svg",
+ "icons/refresh.svg",
+ "icons/beep.ogg",
+ "icons/pause.svg",
+ "icons/stop.svg",
+ "icons/skip.svg",
+ "icons/heart.svg",
+ "icons/visible.svg",
+ "icons/not_visible.svg",
+ "icons/sort.svg",
+ "icons/money.svg",
+ "icons/segway.png",
+ "icons/close-smaller.svg",
+ "icons/right-arrow.svg",
+ "icons/campaign.svg",
+ "icons/star.svg",
+ "icons/lightbulb.svg",
+ "icons/bolt.svg",
+ "icons/stopwatch.svg",
+ "icons/music-note.svg",
+ "icons/import.svg",
+ "icons/export.svg",
+ "icons/PlayerInfoIconSponsorBlocker.svg",
+ "icons/PlayerDeleteIconSponsorBlocker.svg",
+ "icons/dearrow.svg",
+ "popup.html",
+ "popup.css",
+ "content.css",
+ "shared.css",
+ "js/document.js",
+ "libs/Source+Sans+Pro.css",
+ "libs/6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwlxdu.woff2",
+ "libs/6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwmRduz8A.woff2",
+ "libs/6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwmBduz8A.woff2",
+ "libs/6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwlBduz8A.woff2"
+ ],
+ "matches": ["<all_urls>"]
+ }],
+ "content_scripts": [
+ {
+ "world": "MAIN",
+ "js": [
+ "./js/document.js"
+ ],
+ "matches": [
+ "https://*.youtube.com/*",
+ "https://www.youtube-nocookie.com/embed/*"
+ ],
+ "all_frames": true,
+ "run_at": "document_start"
+ },
+ {
+ "world": "ISOLATED",
+ "js": [
+ "./js/content.js"
+ ],
+ "css": [
+ "content.css",
+ "shared.css"
+ ],
+ "matches": [
+ "https://*.youtube.com/*",
+ "https://www.youtube-nocookie.com/embed/*"
+ ],
+ "all_frames": true,
+ "run_at": "document_start"
+ }
+ ],
+ "action": {
+ "default_title": "SponsorBlock",
+ "default_popup": "popup.html",
+ "default_icon": {
+ "16": "icons/IconSponsorBlocker16px.png",
+ "32": "icons/IconSponsorBlocker32px.png",
+ "64": "icons/IconSponsorBlocker64px.png",
+ "128": "icons/IconSponsorBlocker128px.png"
+ },
+ "theme_icons": [
+ {
+ "light": "icons/IconSponsorBlocker16px.png",
+ "dark": "icons/IconSponsorBlocker16px.png",
+ "size": 16
+ },
+ {
+ "light": "icons/IconSponsorBlocker32px.png",
+ "dark": "icons/IconSponsorBlocker32px.png",
+ "size": 32
+ },
+ {
+ "light": "icons/IconSponsorBlocker64px.png",
+ "dark": "icons/IconSponsorBlocker64px.png",
+ "size": 64
+ },
+ {
+ "light": "icons/IconSponsorBlocker128px.png",
+ "dark": "icons/IconSponsorBlocker128px.png",
+ "size": 128
+ },
+ {
+ "light": "icons/IconSponsorBlocker256px.png",
+ "dark": "icons/IconSponsorBlocker256px.png",
+ "size": 256
+ },
+ {
+ "light": "icons/IconSponsorBlocker512px.png",
+ "dark": "icons/IconSponsorBlocker512px.png",
+ "size": 512
+ },
+ {
+ "light": "icons/IconSponsorBlocker1024px.png",
+ "dark": "icons/IconSponsorBlocker1024px.png",
+ "size": 1024
+ }
+ ]
+ },
"background": {
- "persistent": false
+ "service_worker": "./js/background.js"
},
- "permissions": [
- "https://*.youtube.com/*"
- ]
+ "manifest_version": 3
}
diff --git a/manifest/firefox-manifest-extra.json b/manifest/firefox-manifest-extra.json
index 9f9468bc..d7788721 100644
--- a/manifest/firefox-manifest-extra.json
+++ b/manifest/firefox-manifest-extra.json
@@ -11,9 +11,6 @@
"background": {
"persistent": false
},
- "permissions": [
- "scripting"
- ],
"browser_action": {
"default_area": "navbar"
}
diff --git a/manifest/manifest-v2-extra.json b/manifest/manifest-v2-extra.json
new file mode 100644
index 00000000..1ab9b242
--- /dev/null
+++ b/manifest/manifest-v2-extra.json
@@ -0,0 +1,133 @@
+{
+ "web_accessible_resources": [
+ "icons/LogoSponsorBlocker256px.png",
+ "icons/IconSponsorBlocker256px.png",
+ "icons/PlayerStartIconSponsorBlocker.svg",
+ "icons/PlayerStopIconSponsorBlocker.svg",
+ "icons/PlayerUploadIconSponsorBlocker.svg",
+ "icons/PlayerUploadFailedIconSponsorBlocker.svg",
+ "icons/PlayerCancelSegmentIconSponsorBlocker.svg",
+ "icons/clipboard.svg",
+ "icons/settings.svg",
+ "icons/pencil.svg",
+ "icons/check.svg",
+ "icons/check-smaller.svg",
+ "icons/upvote.png",
+ "icons/downvote.png",
+ "icons/thumbs_down.svg",
+ "icons/thumbs_down_locked.svg",
+ "icons/thumbs_up.svg",
+ "icons/help.svg",
+ "icons/report.png",
+ "icons/close.png",
+ "icons/skipIcon.svg",
+ "icons/refresh.svg",
+ "icons/beep.ogg",
+ "icons/pause.svg",
+ "icons/stop.svg",
+ "icons/skip.svg",
+ "icons/heart.svg",
+ "icons/visible.svg",
+ "icons/not_visible.svg",
+ "icons/sort.svg",
+ "icons/money.svg",
+ "icons/segway.png",
+ "icons/close-smaller.svg",
+ "icons/right-arrow.svg",
+ "icons/campaign.svg",
+ "icons/star.svg",
+ "icons/lightbulb.svg",
+ "icons/bolt.svg",
+ "icons/stopwatch.svg",
+ "icons/music-note.svg",
+ "icons/import.svg",
+ "icons/export.svg",
+ "icons/PlayerInfoIconSponsorBlocker.svg",
+ "icons/PlayerDeleteIconSponsorBlocker.svg",
+ "icons/dearrow.svg",
+ "popup.html",
+ "popup.css",
+ "content.css",
+ "shared.css",
+ "js/document.js",
+ "libs/Source+Sans+Pro.css",
+ "libs/6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwlxdu.woff2",
+ "libs/6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwmRduz8A.woff2",
+ "libs/6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwmBduz8A.woff2",
+ "libs/6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwlBduz8A.woff2"
+ ],
+ "permissions": [
+ "https://sponsor.ajay.app/*"
+ ],
+ "optional_permissions": [
+ "*://*/*"
+ ],
+ "browser_action": {
+ "default_title": "SponsorBlock",
+ "default_popup": "popup.html",
+ "default_icon": {
+ "16": "icons/IconSponsorBlocker16px.png",
+ "32": "icons/IconSponsorBlocker32px.png",
+ "64": "icons/IconSponsorBlocker64px.png",
+ "128": "icons/IconSponsorBlocker128px.png"
+ },
+ "theme_icons": [
+ {
+ "light": "icons/IconSponsorBlocker16px.png",
+ "dark": "icons/IconSponsorBlocker16px.png",
+ "size": 16
+ },
+ {
+ "light": "icons/IconSponsorBlocker32px.png",
+ "dark": "icons/IconSponsorBlocker32px.png",
+ "size": 32
+ },
+ {
+ "light": "icons/IconSponsorBlocker64px.png",
+ "dark": "icons/IconSponsorBlocker64px.png",
+ "size": 64
+ },
+ {
+ "light": "icons/IconSponsorBlocker128px.png",
+ "dark": "icons/IconSponsorBlocker128px.png",
+ "size": 128
+ },
+ {
+ "light": "icons/IconSponsorBlocker256px.png",
+ "dark": "icons/IconSponsorBlocker256px.png",
+ "size": 256
+ },
+ {
+ "light": "icons/IconSponsorBlocker512px.png",
+ "dark": "icons/IconSponsorBlocker512px.png",
+ "size": 512
+ },
+ {
+ "light": "icons/IconSponsorBlocker1024px.png",
+ "dark": "icons/IconSponsorBlocker1024px.png",
+ "size": 1024
+ }
+ ]
+ },
+ "background": {
+ "scripts":[
+ "./js/background.js"
+ ]
+ },
+ "content_scripts": [{
+ "run_at": "document_start",
+ "matches": [
+ "https://*.youtube.com/*",
+ "https://www.youtube-nocookie.com/embed/*"
+ ],
+ "all_frames": true,
+ "js": [
+ "./js/content.js"
+ ],
+ "css": [
+ "content.css",
+ "shared.css"
+ ]
+ }],
+ "manifest_version": 2
+}
diff --git a/manifest/manifest.json b/manifest/manifest.json
index 5a513095..a30bfb64 100644
--- a/manifest/manifest.json
+++ b/manifest/manifest.json
@@ -5,137 +5,6 @@
"default_locale": "en",
"description": "__MSG_Description__",
"homepage_url": "https://sponsor.ajay.app",
- "content_scripts": [{
- "run_at": "document_start",
- "matches": [
- "https://*.youtube.com/*",
- "https://www.youtube-nocookie.com/embed/*"
- ],
- "all_frames": true,
- "js": [
- "./js/content.js"
- ],
- "css": [
- "content.css",
- "shared.css"
- ]
- }],
- "web_accessible_resources": [
- "icons/LogoSponsorBlocker256px.png",
- "icons/IconSponsorBlocker256px.png",
- "icons/PlayerStartIconSponsorBlocker.svg",
- "icons/PlayerStopIconSponsorBlocker.svg",
- "icons/PlayerUploadIconSponsorBlocker.svg",
- "icons/PlayerUploadFailedIconSponsorBlocker.svg",
- "icons/PlayerCancelSegmentIconSponsorBlocker.svg",
- "icons/clipboard.svg",
- "icons/settings.svg",
- "icons/pencil.svg",
- "icons/check.svg",
- "icons/check-smaller.svg",
- "icons/upvote.png",
- "icons/downvote.png",
- "icons/thumbs_down.svg",
- "icons/thumbs_down_locked.svg",
- "icons/thumbs_up.svg",
- "icons/help.svg",
- "icons/report.png",
- "icons/close.png",
- "icons/skipIcon.svg",
- "icons/refresh.svg",
- "icons/beep.ogg",
- "icons/pause.svg",
- "icons/stop.svg",
- "icons/skip.svg",
- "icons/heart.svg",
- "icons/visible.svg",
- "icons/not_visible.svg",
- "icons/sort.svg",
- "icons/money.svg",
- "icons/segway.png",
- "icons/close-smaller.svg",
- "icons/right-arrow.svg",
- "icons/campaign.svg",
- "icons/star.svg",
- "icons/lightbulb.svg",
- "icons/bolt.svg",
- "icons/stopwatch.svg",
- "icons/music-note.svg",
- "icons/import.svg",
- "icons/export.svg",
- "icons/PlayerInfoIconSponsorBlocker.svg",
- "icons/PlayerDeleteIconSponsorBlocker.svg",
- "icons/dearrow.svg",
- "popup.html",
- "popup.css",
- "content.css",
- "shared.css",
- "js/document.js",
- "libs/Source+Sans+Pro.css",
- "libs/6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwlxdu.woff2",
- "libs/6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwmRduz8A.woff2",
- "libs/6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwmBduz8A.woff2",
- "libs/6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwlBduz8A.woff2"
- ],
- "permissions": [
- "storage",
- "https://sponsor.ajay.app/*"
- ],
- "optional_permissions": [
- "*://*/*"
- ],
- "browser_action": {
- "default_title": "SponsorBlock",
- "default_popup": "popup.html",
- "default_icon": {
- "16": "icons/IconSponsorBlocker16px.png",
- "32": "icons/IconSponsorBlocker32px.png",
- "64": "icons/IconSponsorBlocker64px.png",
- "128": "icons/IconSponsorBlocker128px.png"
- },
- "theme_icons": [
- {
- "light": "icons/IconSponsorBlocker16px.png",
- "dark": "icons/IconSponsorBlocker16px.png",
- "size": 16
- },
- {
- "light": "icons/IconSponsorBlocker32px.png",
- "dark": "icons/IconSponsorBlocker32px.png",
- "size": 32
- },
- {
- "light": "icons/IconSponsorBlocker64px.png",
- "dark": "icons/IconSponsorBlocker64px.png",
- "size": 64
- },
- {
- "light": "icons/IconSponsorBlocker128px.png",
- "dark": "icons/IconSponsorBlocker128px.png",
- "size": 128
- },
- {
- "light": "icons/IconSponsorBlocker256px.png",
- "dark": "icons/IconSponsorBlocker256px.png",
- "size": 256
- },
- {
- "light": "icons/IconSponsorBlocker512px.png",
- "dark": "icons/IconSponsorBlocker512px.png",
- "size": 512
- },
- {
- "light": "icons/IconSponsorBlocker1024px.png",
- "dark": "icons/IconSponsorBlocker1024px.png",
- "size": 1024
- }
- ]
- },
- "background": {
- "scripts":[
- "./js/background.js"
- ]
- },
"icons": {
"16": "icons/IconSponsorBlocker16px.png",
"32": "icons/IconSponsorBlocker32px.png",
@@ -145,9 +14,12 @@
"512": "icons/IconSponsorBlocker512px.png",
"1024": "icons/IconSponsorBlocker1024px.png"
},
+ "permissions": [
+ "storage",
+ "scripting"
+ ],
"options_ui": {
"page": "options/options.html",
"open_in_tab": true
- },
- "manifest_version": 2
+ }
}
diff --git a/manifest/safari-manifest-extra.json b/manifest/safari-manifest-extra.json
index 1706b2c3..902381c9 100644
--- a/manifest/safari-manifest-extra.json
+++ b/manifest/safari-manifest-extra.json
@@ -2,9 +2,6 @@
"background": {
"persistent": false
},
- "permissions": [
- "scripting"
- ],
"optional_permissions": [
"webNavigation"
]
diff --git a/src/background.ts b/src/background.ts
index 23914f46..e14f8e48 100644
--- a/src/background.ts
+++ b/src/background.ts
@@ -7,10 +7,6 @@ import { sendRealRequestToCustomServer, setupBackgroundRequestProxy } from "../m
import { setupTabUpdates } from "../maze-utils/src/tab-updates";
import { generateUserID } from "../maze-utils/src/setup";
-// Make the config public for debugging purposes
-
-window.SB = Config;
-
import Utils from "./utils";
import { getExtensionIdsToImportFrom } from "./utils/crossExtension";
import { isFirefoxOrSafari } from "../maze-utils/src";
diff --git a/src/utils/logger.ts b/src/utils/logger.ts
index 2d3a1b92..76a5fb6b 100644
--- a/src/utils/logger.ts
+++ b/src/utils/logger.ts
@@ -1,12 +1,18 @@
-window["SBLogs"] = {
- debug: [],
- warn: []
-};
+if (typeof (window) !== "undefined") {
+ window["SBLogs"] = {
+ debug: [],
+ warn: []
+ };
+}
export function logDebug(message: string) {
- window["SBLogs"].debug.push(`[${new Date().toISOString()}] ${message}`);
+ if (typeof (window) !== "undefined") {
+ window["SBLogs"].debug.push(`[${new Date().toISOString()}] ${message}`);
+ }
}
export function logWarn(message: string) {
- window["SBLogs"].warn.push(`[${new Date().toISOString()}] ${message}`);
+ if (typeof (window) !== "undefined") {
+ window["SBLogs"].warn.push(`[${new Date().toISOString()}] ${message}`);
+ }
} \ No newline at end of file