diff options
author | Michael C <[email protected]> | 2021-12-01 17:48:07 -0500 |
---|---|---|
committer | Michael C <[email protected]> | 2021-12-01 17:48:07 -0500 |
commit | 33098ac6596dc7cd6b3eb31cf0df6e7f88d7f883 (patch) | |
tree | 47bf8d141a9142f38f8ed612551a60031cfcb2c7 | |
parent | dc47b9ffd2049e8a11e566dbf2753fbe59e17465 (diff) | |
download | SponsorBlock-33098ac6596dc7cd6b3eb31cf0df6e7f88d7f883.tar.gz SponsorBlock-33098ac6596dc7cd6b3eb31cf0df6e7f88d7f883.zip |
migrate and populat on reset
-rw-r--r-- | src/config.ts | 7 | ||||
-rw-r--r-- | src/options.ts | 5 |
2 files changed, 9 insertions, 3 deletions
diff --git a/src/config.ts b/src/config.ts index 814e95a6..5cc3ee0b 100644 --- a/src/config.ts +++ b/src/config.ts @@ -189,7 +189,7 @@ const Config: SBObject = { hideSkipButtonPlayerControls: false, hideDiscordLaunches: 0, hideDiscordLink: false, - invidiousInstances: invidiousList, + invidiousInstances: ["invidious.snopyta.org"], // leave as default supportInvidious: false, serverAddress: CompileConfig.serverAddress, minDuration: 0, @@ -433,6 +433,11 @@ function migrateOldFormats(config: SBConfig) { if (config["previousVideoID"] !== undefined) { chrome.storage.sync.remove("previousVideoID"); } + + // populate invidiousInstances with new instances if 3p support is **DISABLED** + if (!config["supportInvidious"]) { + config["invidiousInstances"] = invidiousList + } } async function setupConfig() { diff --git a/src/options.ts b/src/options.ts index 8c5c3bca..f2d4ed4a 100644 --- a/src/options.ts +++ b/src/options.ts @@ -1,5 +1,6 @@ import Config from "./config"; import * as CompileConfig from "../config.json"; +import * as invidiousList from "../ci/invidiouslist.json"; // Make the config public for debugging purposes window.SB = Config; @@ -297,8 +298,8 @@ function invidiousInstanceAddInit(element: HTMLElement, option: string) { const resetButton = element.querySelector(".invidious-instance-reset"); resetButton.addEventListener("click", function() { if (confirm(chrome.i18n.getMessage("resetInvidiousInstanceAlert"))) { - // Set to a clone of the default - Config.config[option] = Config.defaults[option].slice(0); + // Set to CI populated list + Config.config[option] = invidiousList; } }); } |