From c1faab6e83ecd003434ae92456c06d010d0ae3d3 Mon Sep 17 00:00:00 2001 From: Jones Jankovic Date: Mon, 2 Nov 2026 21:03:59 +1030 Subject: [PATCH] chore: remove old one-time migrations and dead flags --- docs/CLOUD_SETTINGS_SYNC_OPTIONS.md | 45 ++------ src/background.ts | 104 ------------------ src/plugins/built-in/themes/theme-manager.ts | 13 --- src/seqta/utils/defaultSettings.ts | 2 +- .../utils/ensureSyncableStorageDefaults.ts | 4 +- src/seqta/utils/listeners/SettingsState.ts | 2 +- src/types/storage.ts | 6 +- 7 files changed, 17 insertions(+), 159 deletions(-) diff --git a/docs/CLOUD_SETTINGS_SYNC_OPTIONS.md b/docs/CLOUD_SETTINGS_SYNC_OPTIONS.md index f83d7790..4042a337 100644 --- a/docs/CLOUD_SETTINGS_SYNC_OPTIONS.md +++ b/docs/CLOUD_SETTINGS_SYNC_OPTIONS.md @@ -582,14 +582,6 @@ Keys (from `SettingsState`): | **Format** | `"YYYY-MM"` calendar month | | **Example** | `"2026-06"` | -#### `themeOfTheMonthLastSeenId` - -| | | -| ---------- | ------------------------------------------- | -| **Type** | `string` | -| **Status** | Deprecated; may still exist in old profiles | -| **Synced** | Yes if present | - ### One-time announcements & privacy #### `privacyStatementShown` @@ -606,20 +598,6 @@ Keys (from `SettingsState`): | **Type** | `string` | | **Format** | ISO date, e.g. `"2025-12-20"` | -#### `engageParentsAnnouncementShown` - -| | | -| ----------- | ------------------------------------------- | -| **Type** | `boolean` | -| **Purpose** | SEQTA Engage parents announcement dismissed | - -#### `bsCloudAutoSyncAnnouncementShown` - -| | | -| ----------- | -------------------------------------- | -| **Type** | `boolean` | -| **Purpose** | Cloud auto-sync announcement dismissed | - ### Update & developer flags #### `justupdated` @@ -1165,18 +1143,17 @@ Animated background selection uses `BackgroundSelector` (local/custom background ### Automatic / popup-only (synced, no dedicated settings control) -| Storage key / path | How it changes | -| ------------------------------------------------------ | -------------------------------------------------- | -| `lessonalert` | Default only — **no UI** (read by home loader) | -| `privacyStatementShown`, `privacyStatementLastUpdated` | Privacy popup on first run (dev can reset) | -| `engageParentsAnnouncementShown` | Dismiss Engage parents announcement | -| `bsCloudAutoSyncAnnouncementShown` | Dismiss cloud sync announcement | -| `themeOfTheMonthDismissedMonth` | Dismiss Theme of the Month popup | -| `justupdated` | Set `true` after extension update | -| `lastSeenNightlyPublishedAt` | Dismiss / acknowledge GitHub nightly update badge | -| `profile_picture_revision` | Incremented when profile picture changes | -| `plugin.notificationCollector.storage.*` | Written by notification poll loop | -| Legacy `animatedbk`, `bksliderinput`, etc. | Migrated to plugin settings; no longer shown in UI | +| Storage key / path | How it changes | +| ------------------------------------------------------ | ---------------------------------------------- | +| `lessonalert` | Default only — **no UI** (read by home loader) | +| `privacyStatementShown`, `privacyStatementLastUpdated` | Privacy popup on first run (dev can reset) | + +| `themeOfTheMonthDismissedMonth` | Dismiss Theme of the Month popup | +| `justupdated` | Set `true` after extension update | +| `lastSeenNightlyPublishedAt` | Dismiss / acknowledge GitHub nightly update badge | +| `profile_picture_revision` | Incremented when profile picture changes | +| `plugin.notificationCollector.storage.*` | Written by notification poll loop | +| Legacy `animatedbk`, `bksliderinput`, etc. | Migrated to plugin settings; no longer shown in UI | ### Synced plugin prefs with UI vs storage-only side effects diff --git a/src/background.ts b/src/background.ts index 8912d1aa..d34060ed 100644 --- a/src/background.ts +++ b/src/background.ts @@ -1,5 +1,4 @@ import browser from "@/lib/browser"; -import semver from "semver"; import type { SettingsState } from "@/types/storage"; import { getDefaultSettingsState } from "@/seqta/utils/defaultSettings"; import { ensureSyncableStorageDefaults } from "@/seqta/utils/ensureSyncableStorageDefaults"; @@ -659,105 +658,6 @@ function SetStorageValue(object: SettingsState) { ); } -/** 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 { - 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; - - 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 { - 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 { - 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); - } -} - async function disableAnimatedBackground(): Promise { const key = "plugin.animated-background.settings"; const stored = await browser.storage.local.get(key); @@ -766,7 +666,6 @@ async function disableAnimatedBackground(): Promise { browser.runtime.onInstalled.addListener(function (event) { browser.storage.local.remove(["justupdated"]); - browser.storage.local.remove(["data"]); const defaultsReady = ensureSyncableStorageDefaults(); @@ -775,9 +674,6 @@ browser.runtime.onInstalled.addListener(function (event) { } 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 refreshRemoteConfig(apiBase); }); diff --git a/src/plugins/built-in/themes/theme-manager.ts b/src/plugins/built-in/themes/theme-manager.ts index 555ca183..6879f602 100644 --- a/src/plugins/built-in/themes/theme-manager.ts +++ b/src/plugins/built-in/themes/theme-manager.ts @@ -222,19 +222,6 @@ export class ThemeManager { public async initialize(): Promise { verboseDebug("[ThemeManager] Starting initialization"); 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 } = await import("@/plugins/built-in/themes/themeCreatorPersistence"); const creatorSession = readThemeCreatorSession(); diff --git a/src/seqta/utils/defaultSettings.ts b/src/seqta/utils/defaultSettings.ts index cd3b1723..9b5c2823 100644 --- a/src/seqta/utils/defaultSettings.ts +++ b/src/seqta/utils/defaultSettings.ts @@ -80,7 +80,7 @@ export function getDefaultSettingsState(): SettingsState { selectedFont: "rubik", timeFormat: "24", privacyStatementShown: false, - bsCloudAutoSyncAnnouncementShown: false, + coursesAssessmentsFixPopupShown: false, }; } diff --git a/src/seqta/utils/ensureSyncableStorageDefaults.ts b/src/seqta/utils/ensureSyncableStorageDefaults.ts index a0b9ad91..3efaca65 100644 --- a/src/seqta/utils/ensureSyncableStorageDefaults.ts +++ b/src/seqta/utils/ensureSyncableStorageDefaults.ts @@ -25,10 +25,10 @@ const OPTIONAL_UNSET_MEANS_DEFAULT_KEYS = [ "privacyStatementShown", "privacyStatementLastUpdated", "termsOfServiceLastAccepted", - "bsCloudAutoSyncAnnouncementShown", + "coursesAssessmentsFixPopupShown", "themeOfTheMonthDismissedMonth", - "themeOfTheMonthLastSeenId", + "justupdated", "devMode", "verboseLogging", diff --git a/src/seqta/utils/listeners/SettingsState.ts b/src/seqta/utils/listeners/SettingsState.ts index aea116a1..90e562d1 100644 --- a/src/seqta/utils/listeners/SettingsState.ts +++ b/src/seqta/utils/listeners/SettingsState.ts @@ -37,7 +37,7 @@ const SETTINGS_STORAGE_KEYS = [ "privacyStatementLastUpdated", "termsOfServiceLastAccepted", "themeOfTheMonthDismissedMonth", - "themeOfTheMonthLastSeenId", + ...PLUGIN_SETTINGS_KEYS, ...PLUGIN_STORAGE_KEYS, ]), diff --git a/src/types/storage.ts b/src/types/storage.ts index c2a8bf9b..59f688fa 100644 --- a/src/types/storage.ts +++ b/src/types/storage.ts @@ -38,8 +38,7 @@ export type SettingsState = { privacyStatementLastUpdated?: string; /** ISO timestamp from `GET /api/terms` `last_updated` when the user accepted ToS. */ termsOfServiceLastAccepted?: string; - /** One-time announcement: BS Cloud automatic settings sync (last in startup popup queue). */ - bsCloudAutoSyncAnnouncementShown?: boolean; + /** One-time notice when BetterSEQTA features are off after the Courses/Assessments fix. */ coursesAssessmentsFixPopupShown?: boolean; /** @@ -47,8 +46,7 @@ export type SettingsState = { * Cleared automatically when a new month's entry is fetched (different `month`). */ themeOfTheMonthDismissedMonth?: string; - /** @deprecated Migrated away; no longer read. */ - themeOfTheMonthLastSeenId?: string; + /** Permanently disables Theme of the Month startup prompts. */ themeOfTheMonthDisabled?: boolean; timeFormat?: string;