aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAjay Ramachandran <[email protected]>2021-05-19 16:11:07 -0400
committerAjay Ramachandran <[email protected]>2021-05-19 16:11:07 -0400
commit3ef2673bfc639a5dac336bd36e092493e33f74af (patch)
treea3764ffce188aa6aeb76c4bccdddc99b626e5c58
parentac6cd2cec16eaf5151ff3730d1d1fbd1fdf59726 (diff)
downloadSponsorBlock-3ef2673bfc639a5dac336bd36e092493e33f74af.tar.gz
SponsorBlock-3ef2673bfc639a5dac336bd36e092493e33f74af.zip
Remove hash prefix option (always uses hash prefix)
-rw-r--r--public/options/options.html17
-rw-r--r--src/config.ts2
-rw-r--r--src/content.ts41
3 files changed, 11 insertions, 49 deletions
diff --git a/public/options/options.html b/public/options/options.html
index 05a6e911..9daef3b3 100644
--- a/public/options/options.html
+++ b/public/options/options.html
@@ -309,23 +309,6 @@
<br/>
<br/>
- <div option-type="toggle" sync-option="hashPrefix">
- <label class="switch-container" label-name="__MSG_enableQueryByHashPrefix__">
- <label class="switch">
- <input type="checkbox" checked>
- <span class="slider round"></span>
- </label>
- </label>
-
- <br/>
- <br/>
-
- <div class="small-description">__MSG_whatQueryByHashPrefix__</div>
- </div>
-
- <br/>
- <br/>
-
<div option-type="toggle" sync-option="refetchWhenNotFound">
<label class="switch-container" label-name="__MSG_enableRefetchWhenNotFound__">
<label class="switch">
diff --git a/src/config.ts b/src/config.ts
index a385e581..05c23780 100644
--- a/src/config.ts
+++ b/src/config.ts
@@ -35,7 +35,6 @@ interface SBConfig {
audioNotificationOnSkip,
checkForUnlistedVideos: boolean,
testingServer: boolean,
- hashPrefix: boolean,
refetchWhenNotFound: boolean,
ytInfoPermissionGranted: boolean,
@@ -169,7 +168,6 @@ const Config: SBObject = {
audioNotificationOnSkip: false,
checkForUnlistedVideos: false,
testingServer: false,
- hashPrefix: true,
refetchWhenNotFound: true,
ytInfoPermissionGranted: false,
diff --git a/src/content.ts b/src/content.ts
index 9270977a..00b9f850 100644
--- a/src/content.ts
+++ b/src/content.ts
@@ -564,33 +564,22 @@ async function sponsorsLookup(id: string) {
}
// Check for hashPrefix setting
- let getRequest;
- if (Config.config.hashPrefix) {
- const hashPrefix = (await utils.getHash(id, 1)).substr(0, 4);
- getRequest = utils.asyncRequestToServer('GET', "/api/skipSegments/" + hashPrefix, {
- categories
- });
- } else {
- getRequest = utils.asyncRequestToServer('GET', "/api/skipSegments", {
- videoID: id,
- categories
- });
- }
- getRequest.then(async (response: FetchResponse) => {
+ const hashPrefix = (await utils.getHash(id, 1)).substr(0, 4);
+ utils.asyncRequestToServer('GET', "/api/skipSegments/" + hashPrefix, {
+ categories
+ }).then(async (response: FetchResponse) => {
if (response?.ok) {
let result = JSON.parse(response.responseText);
- if (Config.config.hashPrefix) {
- result = result.filter((video) => video.videoID === id);
- if (result.length > 0) {
- result = result[0].segments;
- if (result.length === 0) { // return if no segments found
- retryFetch(id);
- return;
- }
- } else { // return if no video found
+ result = result.filter((video) => video.videoID === id);
+ if (result.length > 0) {
+ result = result[0].segments;
+ if (result.length === 0) { // return if no segments found
retryFetch(id);
return;
}
+ } else { // return if no video found
+ retryFetch(id);
+ return;
}
const recievedSegments: SponsorTime[] = result;
@@ -1595,14 +1584,6 @@ function hotkeyListener(e: KeyboardEvent): void {
}
/**
- * Is this an unlisted YouTube video.
- * Assumes that the the privacy info is available.
- */
-function isUnlisted(): boolean {
- return videoInfo?.microformat?.playerMicroformatRenderer?.isUnlisted || videoInfo?.videoDetails?.isPrivate;
-}
-
-/**
* Adds the CSS to the page if needed. Required on optional sites with Chrome.
*/
function addCSS() {