mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-12-06 19:56:45 +10:30
fix: restore main background migrations and message routing parity
Reinstate semver upgrade migrations, install data key cleanup, and the original onMessage handler behavior. Restore documentload tooltip rule, neumorphic theme CSS migration, and extension URL check via @/lib/browser. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
60be64b3ee
commit
712bcd6696
4 files changed
+130
-5
No files matched your search
+109
-3
@@ -1,4 +1,5 @@
|
|||||||
import browser from "@/lib/browser";
|
import browser from "@/lib/browser";
|
||||||
|
import semver from "semver";
|
||||||
import type { SettingsState } from "@/types/storage";
|
import type { SettingsState } from "@/types/storage";
|
||||||
import { getDefaultSettingsState } from "@/seqta/utils/defaultSettings";
|
import { getDefaultSettingsState } from "@/seqta/utils/defaultSettings";
|
||||||
import { ensureSyncableStorageDefaults } from "@/seqta/utils/ensureSyncableStorageDefaults";
|
import { ensureSyncableStorageDefaults } from "@/seqta/utils/ensureSyncableStorageDefaults";
|
||||||
@@ -641,9 +642,11 @@ initCalendarBackground();
|
|||||||
browser.runtime.onMessage.addListener(
|
browser.runtime.onMessage.addListener(
|
||||||
(request: any, sender: chrome.runtime.MessageSender, sendResponse: MessageSender) => {
|
(request: any, sender: chrome.runtime.MessageSender, sendResponse: MessageSender) => {
|
||||||
const handler = MESSAGE_HANDLERS[request.type];
|
const handler = MESSAGE_HANDLERS[request.type];
|
||||||
if (!handler) return false;
|
if (handler) {
|
||||||
if (handler(request, sendResponse, sender) === true) return true;
|
const result = handler(request, sendResponse, sender);
|
||||||
sendResponse();
|
return result === true;
|
||||||
|
}
|
||||||
|
console.log("Unknown request type");
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -664,8 +667,108 @@ async function disableAnimatedBackground(): Promise<void> {
|
|||||||
await browser.storage.local.set({ [key]: { ...(stored[key] as object), enabled: false } });
|
await browser.storage.local.set({ [key]: { ...(stored[key] as object), enabled: false } });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** One-time migration for 3.6.5: opt upgraders into Global Search + indexing + transparency defaults. */
|
||||||
|
const GLOBAL_SEARCH_PLUGIN_SETTINGS_KEY = "plugin.global-search.settings";
|
||||||
|
const GLOBAL_SEARCH_MIGRATION_VERSION = "3.6.5";
|
||||||
|
|
||||||
|
async function migrateGlobalSearchDefaultsFor365Upgrade(previousVersion: string): Promise<void> {
|
||||||
|
try {
|
||||||
|
const currRaw = browser.runtime.getManifest().version;
|
||||||
|
const prev = semver.coerce(previousVersion);
|
||||||
|
const curr = semver.coerce(currRaw);
|
||||||
|
if (
|
||||||
|
prev == null ||
|
||||||
|
curr == null ||
|
||||||
|
semver.lt(curr, GLOBAL_SEARCH_MIGRATION_VERSION) ||
|
||||||
|
!semver.lt(prev, GLOBAL_SEARCH_MIGRATION_VERSION)
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const got = await browser.storage.local.get(GLOBAL_SEARCH_PLUGIN_SETTINGS_KEY);
|
||||||
|
const existing = (got[GLOBAL_SEARCH_PLUGIN_SETTINGS_KEY] ?? {}) as Record<string, unknown>;
|
||||||
|
|
||||||
|
await browser.storage.local.set({
|
||||||
|
[GLOBAL_SEARCH_PLUGIN_SETTINGS_KEY]: {
|
||||||
|
...existing,
|
||||||
|
enabled: true,
|
||||||
|
transparencyEffects: true,
|
||||||
|
runIndexingOnLoad: true,
|
||||||
|
passiveIndexing: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
console.info(
|
||||||
|
`[BetterSEQTA+] Migration ${GLOBAL_SEARCH_MIGRATION_VERSION}: Global Search and related settings enabled (from ${previousVersion}).`,
|
||||||
|
);
|
||||||
|
} catch (e) {
|
||||||
|
console.warn("[BetterSEQTA+] Global Search 3.6.5 settings migration failed:", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** One-time reset for 3.6.6: re-enable Theme of the Month for existing users. */
|
||||||
|
const THEME_OF_THE_MONTH_RESET_VERSION = "3.6.6";
|
||||||
|
|
||||||
|
async function resetThemeOfTheMonthDisabledFor366Upgrade(previousVersion: string): Promise<void> {
|
||||||
|
try {
|
||||||
|
const currRaw = browser.runtime.getManifest().version;
|
||||||
|
const prev = semver.coerce(previousVersion);
|
||||||
|
const curr = semver.coerce(currRaw);
|
||||||
|
if (
|
||||||
|
prev == null ||
|
||||||
|
curr == null ||
|
||||||
|
semver.lt(curr, THEME_OF_THE_MONTH_RESET_VERSION) ||
|
||||||
|
!semver.lt(prev, THEME_OF_THE_MONTH_RESET_VERSION)
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await browser.storage.local.set({
|
||||||
|
themeOfTheMonthDisabled: false,
|
||||||
|
themeOfTheMonthLastSeenId: undefined,
|
||||||
|
});
|
||||||
|
|
||||||
|
console.info(
|
||||||
|
`[BetterSEQTA+] Migration ${THEME_OF_THE_MONTH_RESET_VERSION}: Theme of the Month re-enabled (from ${previousVersion}).`,
|
||||||
|
);
|
||||||
|
} catch (e) {
|
||||||
|
console.warn("[BetterSEQTA+] Theme of the Month 3.6.6 reset migration failed:", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 3.7.0: Close no longer marks entries seen — clear legacy dismissal keys. */
|
||||||
|
const THEME_OF_THE_MONTH_RELOAD_VERSION = "3.7.0";
|
||||||
|
|
||||||
|
async function resetThemeOfTheMonthDismissalFor370Upgrade(previousVersion: string): Promise<void> {
|
||||||
|
try {
|
||||||
|
const currRaw = browser.runtime.getManifest().version;
|
||||||
|
const prev = semver.coerce(previousVersion);
|
||||||
|
const curr = semver.coerce(currRaw);
|
||||||
|
if (
|
||||||
|
prev == null ||
|
||||||
|
curr == null ||
|
||||||
|
semver.lt(curr, THEME_OF_THE_MONTH_RELOAD_VERSION) ||
|
||||||
|
!semver.lt(prev, THEME_OF_THE_MONTH_RELOAD_VERSION)
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await browser.storage.local.set({
|
||||||
|
themeOfTheMonthLastSeenId: undefined,
|
||||||
|
themeOfTheMonthDismissedMonth: undefined,
|
||||||
|
});
|
||||||
|
|
||||||
|
console.info(
|
||||||
|
`[BetterSEQTA+] Migration ${THEME_OF_THE_MONTH_RELOAD_VERSION}: Theme of the Month shows again until dismissed for the month (from ${previousVersion}).`,
|
||||||
|
);
|
||||||
|
} catch (e) {
|
||||||
|
console.warn("[BetterSEQTA+] Theme of the Month 3.7.0 dismissal migration failed:", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
browser.runtime.onInstalled.addListener(function (event) {
|
browser.runtime.onInstalled.addListener(function (event) {
|
||||||
browser.storage.local.remove(["justupdated"]);
|
browser.storage.local.remove(["justupdated"]);
|
||||||
|
browser.storage.local.remove(["data"]);
|
||||||
|
|
||||||
const defaultsReady = ensureSyncableStorageDefaults();
|
const defaultsReady = ensureSyncableStorageDefaults();
|
||||||
|
|
||||||
@@ -674,6 +777,9 @@ browser.runtime.onInstalled.addListener(function (event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (event.reason === "update" && event.previousVersion) {
|
if (event.reason === "update" && event.previousVersion) {
|
||||||
|
void migrateGlobalSearchDefaultsFor365Upgrade(event.previousVersion);
|
||||||
|
void resetThemeOfTheMonthDisabledFor366Upgrade(event.previousVersion);
|
||||||
|
void resetThemeOfTheMonthDismissalFor370Upgrade(event.previousVersion);
|
||||||
void browser.storage.local.remove(BSPLUS_INSTALL_REGISTERED_AT_KEY).then(() => {
|
void browser.storage.local.remove(BSPLUS_INSTALL_REGISTERED_AT_KEY).then(() => {
|
||||||
void refreshRemoteConfig(apiBase);
|
void refreshRemoteConfig(apiBase);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -110,6 +110,11 @@ html {
|
|||||||
transform-origin: top;
|
transform-origin: top;
|
||||||
transition: transform 0.2s;
|
transition: transform 0.2s;
|
||||||
}
|
}
|
||||||
|
body:has(.outside-container:not(.hide))
|
||||||
|
#AddedSettings.tooltip:hover
|
||||||
|
> .tooltiptext {
|
||||||
|
transform: scale(0);
|
||||||
|
}
|
||||||
.assessmenttooltip svg {
|
.assessmenttooltip svg {
|
||||||
fill: var(--text-primary);
|
fill: var(--text-primary);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -222,6 +222,19 @@ export class ThemeManager {
|
|||||||
public async initialize(): Promise<void> {
|
public async initialize(): Promise<void> {
|
||||||
verboseDebug("[ThemeManager] Starting initialization");
|
verboseDebug("[ThemeManager] Starting initialization");
|
||||||
try {
|
try {
|
||||||
|
const neumorphicThemeId = "9a9786d1-b5fc-4a91-8c7a-f8bf7f7679ad";
|
||||||
|
const migrationCSS = "#title {\nbackground: transparent !important;\n}";
|
||||||
|
|
||||||
|
const theme = (await localforage.getItem(neumorphicThemeId)) as CustomTheme | null;
|
||||||
|
if (
|
||||||
|
theme &&
|
||||||
|
theme.CustomCSS &&
|
||||||
|
!theme.CustomCSS.includes("#title {\nbackground: transparent !important;\n}")
|
||||||
|
) {
|
||||||
|
theme.CustomCSS = theme.CustomCSS + "\n" + migrationCSS;
|
||||||
|
await localforage.setItem(neumorphicThemeId, theme);
|
||||||
|
}
|
||||||
|
|
||||||
const { readThemeCreatorSession } =
|
const { readThemeCreatorSession } =
|
||||||
await import("@/plugins/built-in/themes/themeCreatorPersistence");
|
await import("@/plugins/built-in/themes/themeCreatorPersistence");
|
||||||
const creatorSession = readThemeCreatorSession();
|
const creatorSession = readThemeCreatorSession();
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
* Allowlist for popup/API media URLs.
|
* Allowlist for popup/API media URLs.
|
||||||
* Accepts https: and same-extension chrome-extension:/moz-extension: URLs.
|
* Accepts https: and same-extension chrome-extension:/moz-extension: URLs.
|
||||||
*/
|
*/
|
||||||
|
import browser from "@/lib/browser";
|
||||||
|
|
||||||
export function allowedPopupImageUrl(url: string | null | undefined): string | null {
|
export function allowedPopupImageUrl(url: string | null | undefined): string | null {
|
||||||
if (!url) return null;
|
if (!url) return null;
|
||||||
const trimmed = url.trim();
|
const trimmed = url.trim();
|
||||||
@@ -11,8 +13,7 @@ export function allowedPopupImageUrl(url: string | null | undefined): string | n
|
|||||||
if (parsed.protocol === "https:") return parsed.href;
|
if (parsed.protocol === "https:") return parsed.href;
|
||||||
|
|
||||||
if (parsed.protocol === "chrome-extension:" || parsed.protocol === "moz-extension:") {
|
if (parsed.protocol === "chrome-extension:" || parsed.protocol === "moz-extension:") {
|
||||||
const extId =
|
const extId = browser.runtime?.id;
|
||||||
typeof chrome !== "undefined" && chrome.runtime?.id ? chrome.runtime.id : undefined;
|
|
||||||
if (extId && parsed.hostname === extId) return parsed.href;
|
if (extId && parsed.hostname === extId) return parsed.href;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user