diff options
author | Ajay <[email protected]> | 2023-02-07 17:42:22 -0500 |
---|---|---|
committer | Ajay <[email protected]> | 2023-02-07 17:42:22 -0500 |
commit | bbb234e4980b250feecbdbf9793276cb05345ba6 (patch) | |
tree | f55fa07f7e32f7f8cea502b3072d96e4d7d0c1b0 | |
parent | 3716c8aa801f8eb2b77eee68d7a50dadd8d94eae (diff) | |
download | SponsorBlock-bbb234e4980b250feecbdbf9793276cb05345ba6.tar.gz SponsorBlock-bbb234e4980b250feecbdbf9793276cb05345ba6.zip |
Make invidious instances work on safari
-rw-r--r-- | public/options/options.html | 4 | ||||
-rw-r--r-- | src/config.ts | 2 | ||||
-rw-r--r-- | src/utils.ts | 8 | ||||
-rw-r--r-- | webpack/webpack.manifest.js | 7 |
4 files changed, 6 insertions, 15 deletions
diff --git a/public/options/options.html b/public/options/options.html index d87d5849..cd584374 100644 --- a/public/options/options.html +++ b/public/options/options.html @@ -442,7 +442,7 @@ <div id="advanced" class="option-group hidden"> - <div id="support-invidious" data-type="toggle" data-sync="supportInvidious" data-no-safari="true"> + <div id="support-invidious" data-type="toggle" data-sync="supportInvidious"> <div class="switch-container"> <label class="switch"> <input id="supportInvidious" type="checkbox"> @@ -457,7 +457,7 @@ <div class="small-description">__MSG_supportOtherSitesDescription__ </div> </div> - <div data-type="private-text-change" data-sync="invidiousInstances" data-no-safari="true" data-dependent-on="supportInvidious"> + <div data-type="private-text-change" data-sync="invidiousInstances" data-dependent-on="supportInvidious"> <div class="option-button trigger-button"> __MSG_addInvidiousInstance__ </div> diff --git a/src/config.ts b/src/config.ts index f8759f05..c1ab5aee 100644 --- a/src/config.ts +++ b/src/config.ts @@ -180,7 +180,7 @@ const Config: SBObject = { hideDiscordLaunches: 0, hideDiscordLink: false, invidiousInstances: ["invidious.snopyta.org"], // leave as default - supportInvidious: isSafari(), + supportInvidious: false, serverAddress: CompileConfig.serverAddress, minDuration: 0, skipNoticeDuration: 4, diff --git a/src/utils.ts b/src/utils.ts index b3c9f4b4..8d8b4b16 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -119,9 +119,9 @@ export default class Utils { * @param {CallableFunction} callback */ setupExtraSitePermissions(callback: (granted: boolean) => void): void { - // Request permission - let permissions = ["declarativeContent", "webNavigation"]; - if (this.isFirefox() && !isSafari()) permissions = []; + let permissions = ["webNavigation"]; + if (!isSafari()) permissions.push("declarativeContent"); + if (this.isFirefox() && !isSafari()) permissions = []; chrome.permissions.request({ origins: this.getPermissionRegex(), @@ -213,8 +213,6 @@ export default class Utils { } containsInvidiousPermission(): Promise<boolean> { - if (isSafari()) return Promise.resolve(true); - return new Promise((resolve) => { let permissions = ["declarativeContent"]; if (this.isFirefox()) permissions = []; diff --git a/webpack/webpack.manifest.js b/webpack/webpack.manifest.js index ebd4d967..3041fe6d 100644 --- a/webpack/webpack.manifest.js +++ b/webpack/webpack.manifest.js @@ -3,8 +3,6 @@ const webpack = require("webpack"); const path = require('path'); const { validate } = require('schema-utils'); -const invidiousList = require("../ci/invidiouslist.json"); - const fs = require('fs'); const manifest = require("../manifest/manifest.json"); @@ -50,11 +48,6 @@ class BuildManifest { mergeObjects(manifest, chromeManifestExtra); } else if (this.options.browser.toLowerCase() === "safari") { mergeObjects(manifest, safariManifestExtra); - - // Add all invidious instances as options for the content script - for (const instance of invidiousList) { - manifest.content_scripts[0].matches.push(`*://*.${instance}/*`); - } } if (this.options.stream === "beta") { |