From 5b1536eb3ef3a2bda105411b0ad9c6b71fb7c30f Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Tue, 24 Feb 2026 20:45:52 +0200 Subject: [PATCH 1/3] command to clear journals in case of a leak or development leak --- src/stores/sync_config.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/stores/sync_config.js b/src/stores/sync_config.js index 05a47fa64..2551f5a38 100644 --- a/src/stores/sync_config.js +++ b/src/stores/sync_config.js @@ -579,6 +579,12 @@ export const useSyncConfigStore = defineStore('sync_config', { this[k] = blankState[k] }) }, + clearJournals() { + this.prefsStorage._journal = [] + this.cache.prefsStorage._journal = [] + this.raw.prefsStorage._journal = [] + this.pushSyncConfig() + }, setSyncConfig(userData) { const live = userData.storage this.raw = live From 406df8c27ae3ae96cb35c877a49c72f1276710ba Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Tue, 24 Feb 2026 21:12:08 +0200 Subject: [PATCH 2/3] functionality to force other sessions to wipe journals --- src/components/status_body/status_body.vue | 1 + src/stores/sync_config.js | 31 +++++++++++++++++----- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/src/components/status_body/status_body.vue b/src/components/status_body/status_body.vue index 677781d97..963f81ff8 100644 --- a/src/components/status_body/status_body.vue +++ b/src/components/status_body/status_body.vue @@ -49,6 +49,7 @@ :is-local="status.is_local" @parse-ready="onParseReady" /> + {{ mergedConfig }}
server-side migrations - reset: 0, // special flag that can be used to force-reset all flags, debug purposes only + reset: 0, // special flag that can be used to force-reset all data, debug purposes only // special reset codes: // 1000: trim keys to those known by currently running FE // 1001: same as above + reset everything to 0 @@ -379,16 +381,30 @@ export const _resetFlags = ( result[flag] = 0 }) } - } else if (totalFlags.reset > 0 && totalFlags.reset < 9000) { - console.debug('Received command to reset the flags') - allFlagKeys.forEach((flag) => { - result[flag] = 0 - }) } result.reset = 0 return result } +export const _resetPrefs = ( + totalFlags, + totalPrefs, + knownKeys = defaultState.flagStorage, +) => { + // prefs reset functionality + if ( + totalFlags.reset >= COMMAND_WIPE_JOURNAL && + totalFlags.reset <= COMMAND_WIPE_JOURNAL_AND_STORAGE + ) { + console.debug('Received command to reset journals') + clearJournals() + if (totalFlags.reset === COMMAND_WIPE_JOURNAL_AND_STORAGE) { + console.debug('Received command to reset storage') + return cloneDeep(defaultState) + } + } return totalPrefs +} + export const _doMigrations = (cache, live) => { const data = cache ?? live @@ -578,8 +594,10 @@ export const useSyncConfigStore = defineStore('sync_config', { Object.keys(this).forEach((k) => { this[k] = blankState[k] }) + this.flagStorage.reset = COMMAND_WIPE_JOURNAL_AND_STORAGE }, clearJournals() { + this.flagStorage.reset = COMMAND_WIPE_JOURNAL this.prefsStorage._journal = [] this.cache.prefsStorage._journal = [] this.raw.prefsStorage._journal = [] @@ -639,6 +657,7 @@ export const useSyncConfigStore = defineStore('sync_config', { totalPrefs = recent.prefsStorage } + totalPrefs = _resetPrefs(totalPrefs, totalFlags) totalFlags = _resetFlags(totalFlags) recent.flagStorage = { ...flagsTemplate, ...totalFlags } From bac19670f7fa5401fd22539cc68da600edf4b5fa Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Tue, 24 Feb 2026 21:16:38 +0200 Subject: [PATCH 3/3] some initial work on local only config --- .../settings_modal/helpers/setting.js | 44 ++++++++++++++----- src/stores/local_config.js | 16 ++++++- 2 files changed, 47 insertions(+), 13 deletions(-) diff --git a/src/components/settings_modal/helpers/setting.js b/src/components/settings_modal/helpers/setting.js index cb9bb0466..a064e10f4 100644 --- a/src/components/settings_modal/helpers/setting.js +++ b/src/components/settings_modal/helpers/setting.js @@ -47,6 +47,10 @@ export default { type: Boolean, default: false, }, + local: { + type: Boolean, + default: false, + }, parentPath: { type: [String, Array], }, @@ -259,11 +263,17 @@ export default { const writePath = `simple.${readPath}` if (!this.timedApplyMode) { - useSyncConfigStore().setSimplePrefAndSave({ - path: writePath, - value, - }) - useSyncConfigStore().pushSyncConfig() + if (this.local) { + useLocalConfigStore().set({ + path: writePath, + value, + }) + } else { + useSyncConfigStore().setSimplePrefAndSave({ + path: writePath, + value, + }) + } } else { if (useInterfaceStore().temporaryChangesTimeoutId !== null) { console.error("Can't track more than one temporary change") @@ -272,18 +282,30 @@ export default { const oldValue = get(this.configSource, readPath) - useSyncConfigStore().setPreference({ path: writePath, value }) + if (this.local) { + useLocalConfigStore().setTemporarily({ path: writePath, value }) + } else { + useSyncConfigStore().setPreference({ path: writePath, value }) + } const confirm = () => { - useSyncConfigStore().pushSyncConfig() + if (this.local) { + useLocalConfigStore().set({ path: writePath, value }) + } else { + useSyncConfigStore().pushSyncConfig() + } useInterfaceStore().clearTemporaryChanges() } const revert = () => { - useSyncConfigStore().setPreference({ - path: writePath, - value: oldValue, - }) + if (this.local) { + useLocalConfigStore().unsetTemporarily({ path: writePath, value }) + } else { + useSyncConfigStore().setPreference({ + path: writePath, + value: oldValue, + }) + } useInterfaceStore().clearTemporaryChanges() } diff --git a/src/stores/local_config.js b/src/stores/local_config.js index 208ae09cf..7b2c5f650 100644 --- a/src/stores/local_config.js +++ b/src/stores/local_config.js @@ -10,6 +10,9 @@ export const defaultState = { prefsStorage: { ...configDefaultState, }, + tempStorage: { + ...configDefaultState + } } export const useLocalConfigStore = defineStore('local_config', { @@ -20,6 +23,12 @@ export const useLocalConfigStore = defineStore('local_config', { set({ path, value }) { set(this.prefsStorage, path, value) }, + setTemporarily({ path, value }) { + set(this.tempStorage, path, value) + }, + unsetTemporarily({ path, value }) { + set(this.tempStorage, path, undefined) + }, unset({ path, value }) { set(this.prefsStorage, path, undefined) }, @@ -36,7 +45,7 @@ export const useLocalConfigStore = defineStore('local_config', { const result = Object.fromEntries( Object.entries(state.prefsStorage).map(([k, v]) => [ k, - v ?? instancePrefs[k], + state.tempStorage[k] ?? v ?? instancePrefs[k], ]), ) return result @@ -44,7 +53,10 @@ export const useLocalConfigStore = defineStore('local_config', { }, persist: { afterLoad(state) { - return state + return { + prefStorage: state.prefsStorage, + tempStorage: { ...configDefaultState }, + } }, }, })