From 76c425e1870409e8d98f70622746e6895e6ce1ad Mon Sep 17 00:00:00 2001 From: HanYaodong Date: Tue, 28 May 2024 13:41:42 +0800 Subject: [PATCH] Migrate server endpoint --- src/config.ts | 77 ++------------------------------------------------- 1 file changed, 3 insertions(+), 74 deletions(-) diff --git a/src/config.ts b/src/config.ts index b6d0b0cc..1486017b 100644 --- a/src/config.ts +++ b/src/config.ts @@ -158,70 +158,6 @@ class ConfigClass extends ProtoConfig { } function migrateOldSyncFormats(config: SBConfig) { - if (config["showZoomToFillError"]) { - chrome.storage.sync.remove("showZoomToFillError"); - } - - if (config["unsubmittedSegments"] && Object.keys(config["unsubmittedSegments"]).length > 0) { - chrome.storage.local.set({ - unsubmittedSegments: config["unsubmittedSegments"] - }, () => { - chrome.storage.sync.remove("unsubmittedSegments"); - }); - } - - if (config["exclusive_accessCategoryAdded"] !== undefined) { - chrome.storage.sync.remove("exclusive_accessCategoryAdded"); - } - - if (config["fillerUpdate"] !== undefined) { - chrome.storage.sync.remove("fillerUpdate"); - } - if (config["highlightCategoryAdded"] !== undefined) { - chrome.storage.sync.remove("highlightCategoryAdded"); - } - if (config["highlightCategoryUpdate"] !== undefined) { - chrome.storage.sync.remove("highlightCategoryUpdate"); - } - - if (config["askAboutUnlistedVideos"]) { - chrome.storage.sync.remove("askAboutUnlistedVideos"); - } - - if (!config["autoSkipOnMusicVideosUpdate"]) { - config["autoSkipOnMusicVideosUpdate"] = true; - for (const selection of config.categorySelections) { - if (selection.name === "music_offtopic" - && selection.option === CategorySkipOption.AutoSkip) { - - config.autoSkipOnMusicVideos = true; - break; - } - } - } - - if (config["disableAutoSkip"]) { - for (const selection of config.categorySelections) { - if (selection.name === "sponsor") { - selection.option = CategorySkipOption.ManualSkip; - - chrome.storage.sync.remove("disableAutoSkip"); - } - } - } - - if (typeof config["skipKeybind"] == "string") { - config["skipKeybind"] = { key: config["skipKeybind"] }; - } - - if (typeof config["startSponsorKeybind"] == "string") { - config["startSponsorKeybind"] = { key: config["startSponsorKeybind"] }; - } - - if (typeof config["submitKeybind"] == "string") { - config["submitKeybind"] = { key: config["submitKeybind"] }; - } - // Unbind key if it matches a previous one set by the user (should be ordered oldest to newest) const keybinds = ["skipKeybind", "startSponsorKeybind", "submitKeybind"]; for (let i = keybinds.length - 1; i >= 0; i--) { @@ -233,16 +169,9 @@ function migrateOldSyncFormats(config: SBConfig) { } } - // Remove some old unused options - if (config["sponsorVideoID"] !== undefined) { - chrome.storage.sync.remove("sponsorVideoID"); - } - if (config["previousVideoID"] !== undefined) { - chrome.storage.sync.remove("previousVideoID"); - } - - if (config["lastIsVipUpdate"]) { - chrome.storage.sync.remove("lastIsVipUpdate"); + // move to new server endpoint + if (config["serverAddress"].includes("47.103.74.95:9876")) { + config["serverAddress"] = CompileConfig.serverAddress; } }