mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-12-06 19:56:45 +10:30
chore: remove old one-time migrations and dead flags
This commit is contained in:
7 files changed
+17
-159
No files matched your search
@@ -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
|
||||
|
||||
|
||||
@@ -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<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);
|
||||
}
|
||||
}
|
||||
|
||||
async function disableAnimatedBackground(): Promise<void> {
|
||||
const key = "plugin.animated-background.settings";
|
||||
const stored = await browser.storage.local.get(key);
|
||||
@@ -766,7 +666,6 @@ async function disableAnimatedBackground(): Promise<void> {
|
||||
|
||||
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);
|
||||
});
|
||||
|
||||
@@ -222,19 +222,6 @@ export class ThemeManager {
|
||||
public async initialize(): Promise<void> {
|
||||
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();
|
||||
|
||||
@@ -80,7 +80,7 @@ export function getDefaultSettingsState(): SettingsState {
|
||||
selectedFont: "rubik",
|
||||
timeFormat: "24",
|
||||
privacyStatementShown: false,
|
||||
bsCloudAutoSyncAnnouncementShown: false,
|
||||
|
||||
coursesAssessmentsFixPopupShown: false,
|
||||
};
|
||||
}
|
||||
@@ -25,10 +25,10 @@ const OPTIONAL_UNSET_MEANS_DEFAULT_KEYS = [
|
||||
"privacyStatementShown",
|
||||
"privacyStatementLastUpdated",
|
||||
"termsOfServiceLastAccepted",
|
||||
"bsCloudAutoSyncAnnouncementShown",
|
||||
|
||||
"coursesAssessmentsFixPopupShown",
|
||||
"themeOfTheMonthDismissedMonth",
|
||||
"themeOfTheMonthLastSeenId",
|
||||
|
||||
"justupdated",
|
||||
"devMode",
|
||||
"verboseLogging",
|
||||
|
||||
@@ -37,7 +37,7 @@ const SETTINGS_STORAGE_KEYS = [
|
||||
"privacyStatementLastUpdated",
|
||||
"termsOfServiceLastAccepted",
|
||||
"themeOfTheMonthDismissedMonth",
|
||||
"themeOfTheMonthLastSeenId",
|
||||
|
||||
...PLUGIN_SETTINGS_KEYS,
|
||||
...PLUGIN_STORAGE_KEYS,
|
||||
]),
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user