aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAjay Ramachandran <[email protected]>2024-06-13 09:07:57 +0530
committerGitHub <[email protected]>2024-06-13 09:07:57 +0530
commit5e179cf9ff3177f760cfbbfd87af17248f0902db (patch)
treeb40386a4ea8a98395526705499af93790ecf8324
parent98ac2fc618e8a74a5f467ffb5f0ea37e8aeba38c (diff)
parent0b946d5ef724cae59347ac089cca9f7f3615062c (diff)
downloadSponsorBlock-5e179cf9ff3177f760cfbbfd87af17248f0902db.tar.gz
SponsorBlock-5e179cf9ff3177f760cfbbfd87af17248f0902db.zip
Merge pull request #2036 from mini-bomba/refresh-fix
Fix refreshing
-rw-r--r--manifest/manifest.json3
-rw-r--r--src/content.ts13
2 files changed, 13 insertions, 3 deletions
diff --git a/manifest/manifest.json b/manifest/manifest.json
index 5a513095..2ebf3cd3 100644
--- a/manifest/manifest.json
+++ b/manifest/manifest.json
@@ -11,6 +11,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 226caba7..2218aa61 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
+}