From e9a395f67a915c2fc0a9737b001fe9b82b559d67 Mon Sep 17 00:00:00 2001 From: JellyBrick Date: Sat, 2 Dec 2023 23:13:21 +0900 Subject: [PATCH] hotfix(adblocker): fix #1475 --- src/plugins/adblocker/index.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/plugins/adblocker/index.ts b/src/plugins/adblocker/index.ts index e7d6a48a..7109a2aa 100644 --- a/src/plugins/adblocker/index.ts +++ b/src/plugins/adblocker/index.ts @@ -120,11 +120,20 @@ export default createPlugin({ async onConfigChange(newConfig) { if (newConfig.blocker === blockers.WithBlocklists) { await injectCliqzPreload(); - } else if (newConfig.blocker === blockers.InPlayer) { - if (!isInjected()) { - inject(); - } } }, }, + renderer: { + async start({ getConfig }) { + const config = await getConfig(); + if (config.blocker === blockers.InPlayer && !isInjected()) { + inject(); + } + }, + onConfigChange(newConfig) { + if (newConfig.blocker === blockers.InPlayer && !isInjected()) { + inject(); + } + }, + } });