aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAjay <[email protected]>2024-06-22 16:27:18 +0530
committerAjay <[email protected]>2024-06-22 16:27:18 +0530
commitfae7d921a7f74da5df4420ba169ecc16b79aeb82 (patch)
tree1dc44c52f80cc12cac0e9f54a61a31426f929f54
parent60a2eff40a6b67bf56e319460b58ddc25b90e80f (diff)
parent5e179cf9ff3177f760cfbbfd87af17248f0902db (diff)
downloadSponsorBlock-mv3.tar.gz
SponsorBlock-mv3.zip
Merge branch 'master' of https://github.com/ajayyy/SponsorBlock into mv3mv3
-rw-r--r--manifest/chrome-manifest-extra.json6
-rw-r--r--manifest/manifest-v2-extra.json3
-rw-r--r--src/content.ts13
3 files changed, 19 insertions, 3 deletions
diff --git a/manifest/chrome-manifest-extra.json b/manifest/chrome-manifest-extra.json
index 4af7eb82..4fa0fed7 100644
--- a/manifest/chrome-manifest-extra.json
+++ b/manifest/chrome-manifest-extra.json
@@ -76,6 +76,9 @@
"https://*.youtube.com/*",
"https://www.youtube-nocookie.com/embed/*"
],
+ "exclude_matches": [
+ "https://accounts.youtube.com/RotateCookiesPage*"
+ ],
"all_frames": true,
"run_at": "document_start"
},
@@ -92,6 +95,9 @@
"https://*.youtube.com/*",
"https://www.youtube-nocookie.com/embed/*"
],
+ "exclude_matches": [
+ "https://accounts.youtube.com/RotateCookiesPage*"
+ ],
"all_frames": true,
"run_at": "document_start"
}
diff --git a/manifest/manifest-v2-extra.json b/manifest/manifest-v2-extra.json
index 1ab9b242..1c33efe7 100644
--- a/manifest/manifest-v2-extra.json
+++ b/manifest/manifest-v2-extra.json
@@ -120,6 +120,9 @@
"https://*.youtube.com/*",
"https://www.youtube-nocookie.com/embed/*"
],
+ "exclude_matches": [
+ "https://accounts.youtube.com/RotateCookiesPage*"
+ ],
"all_frames": true,
"js": [
"./js/content.js"
diff --git a/src/content.ts b/src/content.ts
index d22628a1..fa06b25f 100644
--- a/src/content.ts
+++ b/src/content.ts
@@ -264,7 +264,9 @@ function messageListener(request: Message, sender: unknown, sendResponse: (respo
// it will assume the page is not a video page and stop the refresh animation
sendResponse({ hasVideo: getVideoID() != null });
// fetch segments
- sponsorsLookup(false);
+ if (getVideoID()) {
+ sponsorsLookup(false);
+ }
break;
case "unskip":
@@ -1115,7 +1117,12 @@ async function sponsorsLookup(keepOldSubmissions = true) {
const hashParams = getHashParams();
if (hashParams.requiredSegment) extraRequestData.requiredSegment = hashParams.requiredSegment;
- const hashPrefix = (await getHash(getVideoID(), 1)).slice(0, 4) as VideoID & HashedValue;
+ const videoID = getVideoID()
+ if (!videoID) {
+ console.error("[SponsorBlock] Attempted to fetch segments with a null/undefined videoID.");
+ return;
+ }
+ const hashPrefix = (await getHash(videoID, 1)).slice(0, 4) as VideoID & HashedValue;
const response = await asyncRequestToServer('GET', "/api/skipSegments/" + hashPrefix, {
categories,
actionTypes: getEnabledActionTypes(),
@@ -2733,4 +2740,4 @@ function checkForMiniplayerPlaying() {
}
}
}
-} \ No newline at end of file
+}