From 01eeb18638325c83879f050581f7e0863a41c5f5 Mon Sep 17 00:00:00 2001 From: SethBurkart123 Date: Mon, 20 Apr 2026 15:39:37 +1000 Subject: [PATCH] perf: throttle theme update check to daily and remove redundant cloud poll on page load --- src/SEQTA.ts | 4 ---- src/plugins/built-in/themes/theme-manager.ts | 8 ++++++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/SEQTA.ts b/src/SEQTA.ts index 60a6b6a7..92bae369 100644 --- a/src/SEQTA.ts +++ b/src/SEQTA.ts @@ -59,10 +59,6 @@ async function init() { IsSEQTAPage = true; console.info("[BetterSEQTA+] Verified SEQTA Page"); - if (typeof window !== "undefined" && window === window.top) { - void browser.runtime.sendMessage({ type: "cloudSettingsPoll" }).catch(() => {}); - } - registerFetchSeqtaAppLinkListener(); const documentLoadStyle = document.createElement("style"); diff --git a/src/plugins/built-in/themes/theme-manager.ts b/src/plugins/built-in/themes/theme-manager.ts index 2260e8df..b3bc490a 100644 --- a/src/plugins/built-in/themes/theme-manager.ts +++ b/src/plugins/built-in/themes/theme-manager.ts @@ -680,9 +680,17 @@ export class ThemeManager { * Compare installed store themes to GET /api/themes and refresh when the server is newer. * Skips themes with userEdited: true (theme creator / popup save, or custom accent vs default). */ + private static STORE_CHECK_KEY = "bsplus_lastStoreThemeCheck"; + private static STORE_CHECK_INTERVAL_MS = 24 * 60 * 60 * 1000; // 24 hours + public async checkStoreThemeUpdates(): Promise { if (this.storeUpdateCheckRunning) return; + + const lastCheck = Number(localStorage.getItem(ThemeManager.STORE_CHECK_KEY) || 0); + if (Date.now() - lastCheck < ThemeManager.STORE_CHECK_INTERVAL_MS) return; + this.storeUpdateCheckRunning = true; + localStorage.setItem(ThemeManager.STORE_CHECK_KEY, String(Date.now())); try { const token = await cloudAuth.getStoredToken(); const res = (await browser.runtime.sendMessage({