aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/background.ts
diff options
context:
space:
mode:
authorAjay <[email protected]>2024-06-19 23:14:27 +0530
committerAjay <[email protected]>2024-06-19 23:14:27 +0530
commit98a4a076bc1d8b2d3a9b64355b9aaf84e2a4b685 (patch)
tree5671c0a2dcd6109a780809ed36d273a95a440d2a /src/background.ts
parenta95020dda3d3f05691f5277e69688f05ac59dc1e (diff)
downloadSponsorBlock-98a4a076bc1d8b2d3a9b64355b9aaf84e2a4b685.tar.gz
SponsorBlock-98a4a076bc1d8b2d3a9b64355b9aaf84e2a4b685.zip
Support invidious in mv3
Diffstat (limited to 'src/background.ts')
-rw-r--r--src/background.ts13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/background.ts b/src/background.ts
index e14f8e48..a5a70219 100644
--- a/src/background.ts
+++ b/src/background.ts
@@ -9,7 +9,7 @@ import { generateUserID } from "../maze-utils/src/setup";
import Utils from "./utils";
import { getExtensionIdsToImportFrom } from "./utils/crossExtension";
-import { isFirefoxOrSafari } from "../maze-utils/src";
+import { isFirefoxOrSafari, waitFor } from "../maze-utils/src";
import { injectUpdatedScripts } from "../maze-utils/src/cleanup";
import { logWarn } from "./utils/logger";
import { chromeP } from "../maze-utils/src/browserApi";
@@ -138,9 +138,16 @@ chrome.runtime.onInstalled.addListener(function () {
}
}, 1500);
- // Only do this once the old version understands how to clean itself up
- if (!isFirefoxOrSafari() && chrome.runtime.getManifest().version !== "5.4.13") {
+ if (!isFirefoxOrSafari()) {
injectUpdatedScripts().catch(logWarn);
+
+ waitFor(() => Config.isReady()).then(() => {
+ if (Config.config.supportInvidious) {
+ injectUpdatedScripts([
+ utils.getExtraSiteRegistration()
+ ])
+ }
+ }).catch(logWarn);
}
});