Respect persisted danmaku API setting

This commit is contained in:
kuekhaoyang
2026-04-02 19:36:20 +08:00
parent 91bb481c4e
commit 37d2c4abd9
2 changed files with 21 additions and 5 deletions
+18
View File
@@ -139,6 +139,24 @@ function getDefaultAppSettings(): AppSettings {
};
}
export function hasStoredAppSetting(key: keyof AppSettings): boolean {
if (typeof window === 'undefined') {
return false;
}
const stored = localStorage.getItem(SETTINGS_KEY);
if (!stored) {
return false;
}
try {
const parsed = JSON.parse(stored);
return Object.prototype.hasOwnProperty.call(parsed, key);
} catch {
return false;
}
}
export const settingsStore = {
getSettings(): AppSettings {
// SSR: Return defaults