mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-06 03:34:40 +00:00
perf: throttle theme update check to daily and remove redundant cloud poll on page load
This commit is contained in:
@@ -59,10 +59,6 @@ async function init() {
|
|||||||
IsSEQTAPage = true;
|
IsSEQTAPage = true;
|
||||||
console.info("[BetterSEQTA+] Verified SEQTA Page");
|
console.info("[BetterSEQTA+] Verified SEQTA Page");
|
||||||
|
|
||||||
if (typeof window !== "undefined" && window === window.top) {
|
|
||||||
void browser.runtime.sendMessage({ type: "cloudSettingsPoll" }).catch(() => {});
|
|
||||||
}
|
|
||||||
|
|
||||||
registerFetchSeqtaAppLinkListener();
|
registerFetchSeqtaAppLinkListener();
|
||||||
|
|
||||||
const documentLoadStyle = document.createElement("style");
|
const documentLoadStyle = document.createElement("style");
|
||||||
|
|||||||
@@ -680,9 +680,17 @@ export class ThemeManager {
|
|||||||
* Compare installed store themes to GET /api/themes and refresh when the server is newer.
|
* 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).
|
* 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<void> {
|
public async checkStoreThemeUpdates(): Promise<void> {
|
||||||
if (this.storeUpdateCheckRunning) return;
|
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;
|
this.storeUpdateCheckRunning = true;
|
||||||
|
localStorage.setItem(ThemeManager.STORE_CHECK_KEY, String(Date.now()));
|
||||||
try {
|
try {
|
||||||
const token = await cloudAuth.getStoredToken();
|
const token = await cloudAuth.getStoredToken();
|
||||||
const res = (await browser.runtime.sendMessage({
|
const res = (await browser.runtime.sendMessage({
|
||||||
|
|||||||
Reference in New Issue
Block a user