Enhance settings management and localStorage integration

- Added functionality to load settings from localStorage in the SettingsManager, ensuring user preferences are retained across sessions.
- Updated the state management to initialize settings from localStorage, improving user experience.
- Refactored the UpdateService to streamline update notification preferences.
- Improved migration logic in storageHelpers to prevent duplicate migrations and ensure data integrity.
- Removed unnecessary console logs for cleaner output in various modules.
This commit is contained in:
Will Miao
2025-03-22 08:46:36 +08:00
parent 19ef73a07f
commit 372d74ec71
6 changed files with 63 additions and 23 deletions

View File

@@ -1,11 +1,16 @@
// Create the new hierarchical state structure
import { getStorageItem } from '../utils/storageHelpers.js';
// Load settings from localStorage or use defaults
const savedSettings = getStorageItem('settings', {
blurMatureContent: true,
show_only_sfw: false
});
export const state = {
// Global state
global: {
settings: {
blurMatureContent: true,
show_only_sfw: false
},
settings: savedSettings,
loadingManager: null,
observer: null,
},