mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-21 18:57:05 +00:00
Fix crxjs dev service worker crashes after Vite upgrade.
Downgrade to Vite 6 with crxjs 2.6, add dev-only CSP for HMR, and stop the background script from importing Svelte plugin UI into the service worker.
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* Serializable plugin setting defaults for cloud sync backfill.
|
||||
*
|
||||
* Kept separate from `@/plugins` so the service worker never imports Svelte UI or
|
||||
* Vite HMR clients. Values must match each plugin's non-component settings.
|
||||
*/
|
||||
function defaultSearchHotkey(): string {
|
||||
if (typeof navigator !== "undefined") {
|
||||
return navigator.platform.toUpperCase().includes("MAC") ? "cmd+k" : "ctrl+k";
|
||||
}
|
||||
return "ctrl+k";
|
||||
}
|
||||
|
||||
/** `plugin.<id>.settings` defaults (component/button keys omitted). */
|
||||
export const SYNCABLE_PLUGIN_SETTING_DEFAULTS: Record<
|
||||
string,
|
||||
Record<string, unknown>
|
||||
> = {
|
||||
themes: {},
|
||||
"animated-background": { speed: 1 },
|
||||
"assessments-average": { lettergrade: false },
|
||||
notificationCollector: {},
|
||||
timetable: {},
|
||||
timetableEdit: {},
|
||||
"profile-picture": { useCloudPfp: false },
|
||||
"assessments-overview": {},
|
||||
"background-music": { volume: 0.5, pauseOnHidden: true },
|
||||
messageFolders: {
|
||||
showTagsInAllMessages: true,
|
||||
hideFolderedMessagesInAll: true,
|
||||
},
|
||||
"enhanced-navigation": { autoScrollOnClick: false },
|
||||
"global-search": {
|
||||
searchHotkey: defaultSearchHotkey(),
|
||||
showRecentFirst: true,
|
||||
transparencyEffects: true,
|
||||
runIndexingOnLoad: true,
|
||||
passiveIndexing: true,
|
||||
},
|
||||
"grade-analytics": { cacheTtlHours: 24 },
|
||||
};
|
||||
@@ -1,5 +1,5 @@
|
||||
import browser from "webextension-polyfill";
|
||||
import { getAllPluginSettings } from "@/plugins";
|
||||
import { SYNCABLE_PLUGIN_SETTING_DEFAULTS } from "@/plugins/syncablePluginDefaults";
|
||||
import { getDefaultSettingsState } from "@/seqta/utils/defaultSettings";
|
||||
import {
|
||||
isKeyIncludedInCloudUploadPayload,
|
||||
@@ -38,18 +38,6 @@ const OPTIONAL_UNSET_MEANS_DEFAULT_KEYS = [
|
||||
"profile_picture_revision",
|
||||
] as const;
|
||||
|
||||
function buildDefaultPluginSettings(
|
||||
plugin: ReturnType<typeof getAllPluginSettings>[number],
|
||||
): Record<string, unknown> {
|
||||
const out: Record<string, unknown> = {};
|
||||
for (const [key, setting] of Object.entries(plugin.settings)) {
|
||||
const meta = setting as { type?: string; default?: unknown };
|
||||
if (meta.type === "component" || meta.type === "button") continue;
|
||||
out[key] = meta.default;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Flat default map in upload shape (plugin-format only; no legacy keys).
|
||||
*/
|
||||
@@ -65,9 +53,10 @@ export function getSyncableStorageDefaults(): Record<string, unknown> {
|
||||
delete flat[key];
|
||||
}
|
||||
|
||||
for (const plugin of getAllPluginSettings()) {
|
||||
flat[`plugin.${plugin.pluginId}.settings`] =
|
||||
buildDefaultPluginSettings(plugin);
|
||||
for (const [pluginId, settings] of Object.entries(
|
||||
SYNCABLE_PLUGIN_SETTING_DEFAULTS,
|
||||
)) {
|
||||
flat[`plugin.${pluginId}.settings`] = settings;
|
||||
}
|
||||
|
||||
return flat;
|
||||
|
||||
Reference in New Issue
Block a user