From d4eac389a83764e31af663137a5d9667357654e5 Mon Sep 17 00:00:00 2001 From: DIYgod Date: Tue, 26 Dec 2023 17:28:40 +0800 Subject: [PATCH] fix: broken displayedRules --- src/background/rules.ts | 2 ++ src/sandboxes/index.ts | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/background/rules.ts b/src/background/rules.ts index ff2cd7af..03febfc4 100644 --- a/src/background/rules.ts +++ b/src/background/rules.ts @@ -2,6 +2,7 @@ import { Storage } from "@plasmohq/storage" import { getRemoteRules } from "~/lib/rules" import { getConfig } from "~/lib/config" import { getDisplayedRules as sandboxGetDisplayedRules } from "~/sandboxes" +import { setupOffscreenDocument } from "~/lib/offscreen" const storage = new Storage({ area: "local" @@ -11,6 +12,7 @@ export const refreshRules = async () => { const rules = await getRemoteRules() await storage.set("rules", rules) if (chrome.offscreen) { + await setupOffscreenDocument("tabs/offscreen.html") chrome.runtime.sendMessage({ target: "offscreen", data: { diff --git a/src/sandboxes/index.ts b/src/sandboxes/index.ts index 0d10e952..1feb4983 100644 --- a/src/sandboxes/index.ts +++ b/src/sandboxes/index.ts @@ -43,7 +43,7 @@ export const getRSS = async ({ }) } -export const getDisplayedRules = async (rules: string) => { +export const getDisplayedRules = (rules: string) => { const displayedRules = parseRules(rules) removeFunctionFields(displayedRules) console.debug("requestDisplayedRules", displayedRules)