mirror of
https://github.com/moku-project/Moku.git
synced 2026-06-13 09:19:56 -05:00
Fix: App Pin & Downloads (Filesystem Changes)
This commit is contained in:
@@ -2,12 +2,16 @@ import type { Settings } from '$lib/types/settings'
|
||||
import { DEFAULT_SETTINGS } from '$lib/types/settings'
|
||||
import { saveSettings } from '$lib/core/persistence/persist'
|
||||
|
||||
export const settingsState = $state({ settings: { ...DEFAULT_SETTINGS } as Settings })
|
||||
export const settingsState = $state({
|
||||
settings: { ...DEFAULT_SETTINGS } as Settings,
|
||||
loaded: false,
|
||||
})
|
||||
|
||||
export async function loadSettingsIntoState(raw: unknown) {
|
||||
if (raw && typeof raw === 'object') {
|
||||
Object.assign(settingsState.settings, raw)
|
||||
}
|
||||
settingsState.loaded = true
|
||||
if (typeof document !== 'undefined') {
|
||||
document.documentElement.style.zoom = String(settingsState.settings.uiZoom ?? 1.0)
|
||||
}
|
||||
@@ -16,7 +20,6 @@ export async function loadSettingsIntoState(raw: unknown) {
|
||||
export function updateSettings(patch: Partial<Settings>) {
|
||||
Object.assign(settingsState.settings, patch)
|
||||
void saveSettings({ storeVersion: 2, settings: settingsState.settings })
|
||||
|
||||
if (typeof document !== 'undefined' && patch.uiZoom !== undefined) {
|
||||
document.documentElement.style.zoom = String(patch.uiZoom)
|
||||
}
|
||||
@@ -24,5 +27,6 @@ export function updateSettings(patch: Partial<Settings>) {
|
||||
|
||||
export function resetSettings() {
|
||||
settingsState.settings = { ...DEFAULT_SETTINGS }
|
||||
settingsState.loaded = true
|
||||
void saveSettings({ storeVersion: 2, settings: settingsState.settings })
|
||||
}
|
||||
Reference in New Issue
Block a user