diff --git a/src/App.js b/src/App.js index 6a842ae40..384e89c64 100644 --- a/src/App.js +++ b/src/App.js @@ -74,7 +74,7 @@ export default { created() { // Load the locale from the storage const val = useSyncConfigStore().mergedConfig.interfaceLanguage - useSyncConfigStore().setPreference({ path: 'simple.interfaceLanguage', value: val }) + useSyncConfigStore().setSimplePrefAndSave({ path: 'interfaceLanguage', value: val }) document.getElementById('modal').classList = ['-' + this.layoutType] // Create bound handlers diff --git a/src/components/extra_notifications/extra_notifications.js b/src/components/extra_notifications/extra_notifications.js index 673b7d6a5..bfe8dbe42 100644 --- a/src/components/extra_notifications/extra_notifications.js +++ b/src/components/extra_notifications/extra_notifications.js @@ -61,8 +61,8 @@ const ExtraNotifications = { return useInterfaceStore().openSettingsModalTab('notifications') }, dismissConfigurationTip() { - return useSyncConfigStore().setPreference({ - path: 'simple.showExtraNotificationsTip', + return useSyncConfigStore().setSimplePrefAndSave({ + path: 'showExtraNotificationsTip', value: false, }) }, diff --git a/src/components/nav_panel/nav_panel.js b/src/components/nav_panel/nav_panel.js index 9e5901f24..ae6264217 100644 --- a/src/components/nav_panel/nav_panel.js +++ b/src/components/nav_panel/nav_panel.js @@ -84,8 +84,8 @@ const NavPanel = { this.editMode = !this.editMode }, toggleCollapse() { - useSyncConfigStore().setPreference({ - path: 'simple.collapseNav', + useSyncConfigStore().setSimplePrefAndSave({ + path: 'collapseNav', value: !this.collapsed, }) useSyncConfigStore().pushSyncConfig() diff --git a/src/components/notifications/notification_filters.vue b/src/components/notifications/notification_filters.vue index 3cd9c151e..a29e6bb85 100644 --- a/src/components/notifications/notification_filters.vue +++ b/src/components/notifications/notification_filters.vue @@ -124,8 +124,8 @@ export default { }, methods: { toggleNotificationFilter(type) { - useSyncConfigStore().setPreference({ - path: 'simple.notificationVisibility', + useSyncConfigStore().setSimplePrefAndSave({ + path: 'notificationVisibility', value: { ...this.filters, [type]: !this.filters[type], diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index d147abb3b..df2792c80 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -819,8 +819,8 @@ const PostStatusForm = { } }, dismissScopeNotice() { - useSyncConfigStore().setPreference({ - path: 'simple.hideScopeNotice', + useSyncConfigStore().setSimplePrefAndSave({ + path: 'hideScopeNotice', value: true, }) }, diff --git a/src/components/quick_filter_settings/quick_filter_settings.js b/src/components/quick_filter_settings/quick_filter_settings.js index fc7c9a9fc..6dc2b57af 100644 --- a/src/components/quick_filter_settings/quick_filter_settings.js +++ b/src/components/quick_filter_settings/quick_filter_settings.js @@ -20,8 +20,8 @@ const QuickFilterSettings = { }, methods: { setReplyVisibility(visibility) { - useSyncConfigStore().setPreference({ - path: 'simple.replyVisibility', + useSyncConfigStore().setSimplePrefAndSave({ + path: 'replyVisibility', value: visibility, }) this.$store.dispatch('queueFlushAll') @@ -87,9 +87,9 @@ const QuickFilterSettings = { }, set() { const value = !this.hideMedia - useSyncConfigStore().setPreference({ path: 'simple.hideAttachments', value }) - useSyncConfigStore().setPreference({ - path: 'simple.hideAttachmentsInConv', + useSyncConfigStore().setSimplePrefAndSave({ path: 'hideAttachments', value }) + useSyncConfigStore().setSimplePrefAndSave({ + path: 'hideAttachmentsInConv', value, }) }, @@ -100,8 +100,8 @@ const QuickFilterSettings = { }, set() { const value = !this.hideMutedPosts - useSyncConfigStore().setPreference({ - path: 'simple.hideFilteredStatuses', + useSyncConfigStore().setSimplePrefAndSave({ + path: 'hideFilteredStatuses', value, }) }, @@ -112,7 +112,7 @@ const QuickFilterSettings = { }, set() { const value = !this.muteBotStatuses - useSyncConfigStore().setPreference({ path: 'simple.muteBotStatuses', value }) + useSyncConfigStore().setSimplePrefAndSave({ path: 'muteBotStatuses', value }) }, }, muteSensitiveStatuses: { @@ -121,8 +121,8 @@ const QuickFilterSettings = { }, set() { const value = !this.muteSensitiveStatuses - useSyncConfigStore().setPreference({ - path: 'simple.muteSensitiveStatuses', + useSyncConfigStore().setSimplePrefAndSave({ + path: 'muteSensitiveStatuses', value, }) }, diff --git a/src/components/quick_view_settings/quick_view_settings.js b/src/components/quick_view_settings/quick_view_settings.js index d22e10495..3d2033d2a 100644 --- a/src/components/quick_view_settings/quick_view_settings.js +++ b/src/components/quick_view_settings/quick_view_settings.js @@ -42,8 +42,8 @@ const QuickViewSettings = { return this.mergedConfig.conversationDisplay }, set(value) { - useSyncConfigStore().setPreference({ - path: 'simple.conversationDisplay', + useSyncConfigStore().setSimplePrefAndSave({ + path: 'conversationDisplay', value, }) }, @@ -54,7 +54,7 @@ const QuickViewSettings = { }, set() { const value = !this.autoUpdate - useSyncConfigStore().setPreference({ path: 'simple.streaming', value }) + useSyncConfigStore().setSimplePrefAndSave({ path: 'streaming', value }) }, }, collapseWithSubjects: { @@ -63,8 +63,8 @@ const QuickViewSettings = { }, set() { const value = !this.collapseWithSubjects - useSyncConfigStore().setPreference({ - path: 'simple.collapseMessageWithSubject', + useSyncConfigStore().setSimplePrefAndSave({ + path: 'collapseMessageWithSubject', value, }) }, @@ -75,8 +75,8 @@ const QuickViewSettings = { }, set() { const value = !this.showUserAvatars - useSyncConfigStore().setPreference({ - path: 'simple.mentionLinkShowAvatar', + useSyncConfigStore().setSimplePrefAndSave({ + path: 'mentionLinkShowAvatar', value, }) }, @@ -87,8 +87,8 @@ const QuickViewSettings = { }, set() { const value = !this.muteBotStatuses - useSyncConfigStore().setPreference({ - path: 'simple.muteBotStatuses', + useSyncConfigStore().setSimplePrefAndSave({ + path: 'muteBotStatuses', value, }) }, @@ -99,8 +99,8 @@ const QuickViewSettings = { }, set() { const value = !this.muteSensitiveStatuses - useSyncConfigStore().setPreference({ - path: 'simple.muteSensitiveStatuses', + useSyncConfigStore().setSimplePrefAndSave({ + path: 'muteSensitiveStatuses', value, }) }, diff --git a/src/components/settings_modal/helpers/setting.js b/src/components/settings_modal/helpers/setting.js index 654eacaa0..f93e3eb59 100644 --- a/src/components/settings_modal/helpers/setting.js +++ b/src/components/settings_modal/helpers/setting.js @@ -259,7 +259,7 @@ export default { const writePath = `simple.${readPath}` if (!this.timedApplyMode) { - useSyncConfigStore().setPreference({ path: writePath, value }) + useSyncConfigStore().setSimplePrefAndSave({ path: writePath, value }) useSyncConfigStore().pushSyncConfig() } else { if (useInterfaceStore().temporaryChangesTimeoutId !== null) { diff --git a/src/components/settings_modal/settings_modal.js b/src/components/settings_modal/settings_modal.js index 866459314..25c508bef 100644 --- a/src/components/settings_modal/settings_modal.js +++ b/src/components/settings_modal/settings_modal.js @@ -195,8 +195,8 @@ const SettingsModal = { return useSyncConfigStore().mergedConfig.expertLevel > 0 }, set(value) { - useSyncConfigStore().setPreference({ - path: 'simple.expertLevel', + useSyncConfigStore().setSimplePrefAndSave({ + path: 'expertLevel', value: value ? 1 : 0, }) }, diff --git a/src/components/settings_modal/tabs/clutter_tab.js b/src/components/settings_modal/tabs/clutter_tab.js index 0386a844e..510425e2d 100644 --- a/src/components/settings_modal/tabs/clutter_tab.js +++ b/src/components/settings_modal/tabs/clutter_tab.js @@ -52,8 +52,8 @@ const ClutterTab = { if (value !== 'ask' && value !== 'forever') { realValue = '14d' } - useSyncConfigStore().setPreference({ - path: 'simple.onMuteDefaultAction', + useSyncConfigStore().setSimplePrefAndSave({ + path: 'onMuteDefaultAction', value: realValue, }) }, @@ -72,8 +72,8 @@ const ClutterTab = { if (value !== 'ask' && value !== 'forever') { realValue = '14d' } - useSyncConfigStore().setPreference({ - path: 'simple.onBlockDefaultAction', + useSyncConfigStore().setSimplePrefAndSave({ + path: 'onBlockDefaultAction', value: realValue, }) }, @@ -90,8 +90,8 @@ const ClutterTab = { }, methods: { ...mapActions(useSyncConfigStore, [ - 'setPreference', - 'unsetPreference', + 'setSimplePrefAndSave', + 'unsetSimplePrefAndSave', 'pushSyncConfig', ]), getDatetimeLocal(timestamp) { @@ -138,7 +138,7 @@ const ClutterTab = { filter.order = this.muteFilters.length + 2 this.muteFiltersDraftObject[newId] = filter - this.setPreference({ path: 'simple.muteFilters.' + newId, value: filter }) + this.setSimplePrefAndSave({ path: 'muteFilters.' + newId, value: filter }) this.pushSyncConfig() }, exportFilter(id) { @@ -154,18 +154,18 @@ const ClutterTab = { const newId = uuidv4() this.muteFiltersDraftObject[newId] = filter - this.setPreference({ path: 'simple.muteFilters.' + newId, value: filter }) + this.setSimplePrefAndSave({ path: 'muteFilters.' + newId, value: filter }) this.pushSyncConfig() }, deleteFilter(id) { delete this.muteFiltersDraftObject[id] - this.unsetPreference({ path: 'simple.muteFilters.' + id, value: null }) + this.unsetSimplePrefAndSave({ path: 'muteFilters.' + id, value: null }) this.pushSyncConfig() }, purgeExpiredFilters() { this.muteFiltersExpired.forEach(([id]) => { delete this.muteFiltersDraftObject[id] - this.unsetPreference({ path: 'simple.muteFilters.' + id, value: null }) + this.unsetSimplePrefAndSave({ path: 'muteFilters.' + id, value: null }) }) this.pushSyncConfig() }, @@ -189,8 +189,8 @@ const ClutterTab = { this.muteFiltersDraftDirty[id] = true }, saveFilter(id) { - this.setPreference({ - path: 'simple.muteFilters.' + id, + this.setSimplePrefAndSave({ + path: 'muteFilters.' + id, value: this.muteFiltersDraftObject[id], }) this.pushSyncConfig() diff --git a/src/components/settings_modal/tabs/composing_tab.js b/src/components/settings_modal/tabs/composing_tab.js index 3327f0678..264c4d277 100644 --- a/src/components/settings_modal/tabs/composing_tab.js +++ b/src/components/settings_modal/tabs/composing_tab.js @@ -120,8 +120,8 @@ const ComposingTab = { return useSyncConfigStore().mergedConfig.interfaceLanguage }, set: function (val) { - useSyncConfigStore().setPreference({ - path: 'simple.interfaceLanguage', + useSyncConfigStore().setSimplePrefAndSave({ + path: 'interfaceLanguage', value: val, }) }, @@ -172,8 +172,8 @@ const ComposingTab = { }) }, updateFont(key, value) { - useSyncConfigStore().setPreference({ - path: 'simple.theme3hacks', + useSyncConfigStore().setSimplePrefAndSave({ + path: 'theme3hacks', value: { ...this.mergedConfig.theme3hacks, fonts: { diff --git a/src/components/settings_modal/tabs/filtering_tab.js b/src/components/settings_modal/tabs/filtering_tab.js index a7e8cd4d6..04dfe76bd 100644 --- a/src/components/settings_modal/tabs/filtering_tab.js +++ b/src/components/settings_modal/tabs/filtering_tab.js @@ -36,11 +36,11 @@ const FilteringTab = { label: this.$t(`user_card.mute_block_${mode}`), })), muteFiltersDraftObject: cloneDeep( - useSyncConfigStore().prefsStorage.simple.muteFilters, + this.prefsStorage.simple.muteFilters, ), muteFiltersDraftDirty: Object.fromEntries( Object.entries( - useSyncConfigStore().prefsStorage.simple.muteFilters, + this.prefsStorage.simple.muteFilters, ).map(([k]) => [k, false]), ), exportedFilter: null, @@ -112,7 +112,7 @@ const FilteringTab = { if (value !== 'ask' && value !== 'forever') { realValue = '14d' } - useSyncConfigStore().setPreference({ + this.setPreference({ path: 'simple.onMuteDefaultAction', value: realValue, }) @@ -132,7 +132,7 @@ const FilteringTab = { if (value !== 'ask' && value !== 'forever') { realValue = '14d' } - useSyncConfigStore().setPreference({ + this.setPreference({ path: 'simple.onBlockDefaultAction', value: realValue, }) @@ -151,7 +151,9 @@ const FilteringTab = { methods: { ...mapActions(useSyncConfigStore, [ 'setPreference', + 'setPrefAndSave', 'unsetPreference', + 'unsetPrefAndSave', 'pushSyncConfig', ]), getDatetimeLocal(timestamp) { @@ -198,8 +200,7 @@ const FilteringTab = { filter.order = this.muteFilters.length + 2 this.muteFiltersDraftObject[newId] = filter - this.setPreference({ path: 'simple.muteFilters.' + newId, value: filter }) - this.pushSyncConfig() + this.setSimplePrefAndSave({ path: 'muteFilters.' + newId, value: filter }) }, exportFilter(id) { this.exportedFilter = { ...this.muteFiltersDraftObject[id] } @@ -214,13 +215,11 @@ const FilteringTab = { const newId = uuidv4() this.muteFiltersDraftObject[newId] = filter - this.setPreference({ path: 'simple.muteFilters.' + newId, value: filter }) - this.pushSyncConfig() + this.setSimplePrefAndSave({ path: 'muteFilters.' + newId, value: filter }) }, deleteFilter(id) { delete this.muteFiltersDraftObject[id] - this.unsetPreference({ path: 'simple.muteFilters.' + id, value: null }) - this.pushSyncConfig() + this.unsetSimplePrefAndSave({ path: 'muteFilters.' + id, value: null }) }, purgeExpiredFilters() { this.muteFiltersExpired.forEach(([id]) => { @@ -249,11 +248,10 @@ const FilteringTab = { this.muteFiltersDraftDirty[id] = true }, saveFilter(id) { - this.setPreference({ - path: 'simple.muteFilters.' + id, + this.setPrefAndSave({ + path: 'muteFilters.' + id, value: this.muteFiltersDraftObject[id], }) - this.pushSyncConfig() this.muteFiltersDraftDirty[id] = false }, }, diff --git a/src/components/settings_modal/tabs/general_tab.js b/src/components/settings_modal/tabs/general_tab.js index eefd463db..4a618bd67 100644 --- a/src/components/settings_modal/tabs/general_tab.js +++ b/src/components/settings_modal/tabs/general_tab.js @@ -41,8 +41,8 @@ const GeneralTab = { return useSyncConfigStore().mergedConfig.interfaceLanguage }, set: function (val) { - useSyncConfigStore().setPreference({ - path: 'simple.interfaceLanguage', + useSyncConfigStore().setSimplePrefAndSave({ + path: 'interfaceLanguage', value: val, }) }, @@ -69,8 +69,8 @@ const GeneralTab = { }) }, updateFont(key, value) { - useSyncConfigStore().setPreference({ - path: 'simple.theme3hacks', + useSyncConfigStore().setSimplePrefAndSave({ + path: 'theme3hacks', value: { ...this.mergedConfig.theme3hacks, fonts: { diff --git a/src/components/settings_modal/tabs/posts_tab.js b/src/components/settings_modal/tabs/posts_tab.js index 6435f0d81..bf0b8d200 100644 --- a/src/components/settings_modal/tabs/posts_tab.js +++ b/src/components/settings_modal/tabs/posts_tab.js @@ -67,8 +67,8 @@ const GeneralTab = { }, methods: { updateFont(key, value) { - useSyncConfigStore().setPreference({ - path: 'simple.theme3hacks', + useSyncConfigStore().setSimplePrefAndSave({ + path: 'theme3hacks', value: { ...this.mergedConfig.theme3hacks, fonts: { diff --git a/src/components/update_notification/update_notification.js b/src/components/update_notification/update_notification.js index 78aaa79e8..7134019e1 100644 --- a/src/components/update_notification/update_notification.js +++ b/src/components/update_notification/update_notification.js @@ -57,8 +57,8 @@ const UpdateNotification = { flag: 'updateCounter', value: CURRENT_UPDATE_COUNTER, }) - useSyncConfigStore().setPreference({ - path: 'simple.dontShowUpdateNotifs', + useSyncConfigStore().setSimplePrefAndSave({ + path: 'dontShowUpdateNotifs', value: true, }) useSyncConfigStore().pushSyncConfig() diff --git a/src/components/user_timed_filter_modal/user_timed_filter_modal.js b/src/components/user_timed_filter_modal/user_timed_filter_modal.js index a06c5db59..558891541 100644 --- a/src/components/user_timed_filter_modal/user_timed_filter_modal.js +++ b/src/components/user_timed_filter_modal/user_timed_filter_modal.js @@ -84,16 +84,16 @@ const UserTimedFilterModal = { if (this.isMute) { this.$store.dispatch('muteUser', this.requestBody) if (this.dontAskAgain) { - this.$store.dispatch('setOption', { - name: 'onMuteDefaultAction', + useSyncConfigStore().setSimplePrefAndSave({ + path: 'onMuteDefaultAction', value: this.expiryString, }) } } else { this.$store.dispatch('blockUser', this.requestBody) if (this.dontAskAgain) { - this.$store.dispatch('setOption', { - name: 'onBlockDefaultAction', + useSyncConfigStore().setSimplePrefAndSave({ + path: 'onBlockDefaultAction', value: this.expiryString, }) } diff --git a/src/modules/config_declaration.js b/src/modules/config_declaration.js index bf6a5cd7b..334b51c2b 100644 --- a/src/modules/config_declaration.js +++ b/src/modules/config_declaration.js @@ -10,7 +10,7 @@ const simpleDeclaration = { store: 'server-side', migrationFlag: 'configMigration', migration(serverside, rootState) { - serverside.setPreference({ path: 'simple.' + field, value: rootState.config[oldField ?? field] }) + serverside.setSimplePrefAndSave({ path: field, value: rootState.config[oldField ?? field] }) } } */ diff --git a/src/modules/users.js b/src/modules/users.js index a22c157ed..a8752feff 100644 --- a/src/modules/users.js +++ b/src/modules/users.js @@ -725,7 +725,7 @@ const users = { Object.keys( useSyncConfigStore().prefsStorage.simple.muteFilters ).forEach(key => { - useSyncConfigStore().unsetPreference({ path: 'simple.muteFilters.' + key, value: null }) + useSyncConfigStore().unsetSimplePrefAndSave({ path: 'muteFilters.' + key, value: null }) }) // Reset flag to 0 to re-run migrations diff --git a/src/stores/interface.js b/src/stores/interface.js index 3605f3595..e61186e7e 100644 --- a/src/stores/interface.js +++ b/src/stores/interface.js @@ -226,14 +226,14 @@ export const useInterfaceStore = defineStore('interface', { try { const value = await getResourcesIndex('/static/palettes/index.json') useInstanceStore().set({ - name: 'palettesIndex', + path: 'palettesIndex', value, }) return value } catch (e) { console.error('Could not fetch palettes index', e) useInstanceStore().set({ - name: 'palettesIndex', + path: 'palettesIndex', value: { _error: e }, }) return Promise.resolve({}) @@ -243,7 +243,8 @@ export const useInterfaceStore = defineStore('interface', { this.resetThemeV3Palette() this.resetThemeV2() - window.vuex.commit('setOption', { name: 'palette', value }) + useSyncConfigStore().setPreference({ path: 'simple.palette', value }) + useSyncConfigStore().pushSyncConfig() this.applyTheme({ recompile: true }) }, @@ -251,7 +252,8 @@ export const useInterfaceStore = defineStore('interface', { this.resetThemeV3Palette() this.resetThemeV2() - window.vuex.commit('setOption', { name: 'paletteCustomData', value }) + useSyncConfigStore().setPreference({ path: 'simple.paletteCustomData', value }) + useSyncConfigStore().pushSyncConfig() this.applyTheme({ recompile: true }) }, @@ -261,12 +263,12 @@ export const useInterfaceStore = defineStore('interface', { '/static/styles/index.json', deserialize, ) - useInstanceStore().set({ name: 'stylesIndex', value }) + useInstanceStore().set({ path: 'stylesIndex', value }) return value } catch (e) { console.error('Could not fetch styles index', e) useInstanceStore().set({ - name: 'stylesIndex', + path: 'simple.stylesIndex', value: { _error: e }, }) return Promise.resolve({}) @@ -277,7 +279,8 @@ export const useInterfaceStore = defineStore('interface', { this.resetThemeV2() this.resetThemeV3Palette() - window.vuex.commit('setOption', { name: 'style', value }) + useSyncConfigStore().setPreference({ path: 'simple.style', value }) + useSyncConfigStore().pushSyncConfig() this.useStylePalette = true this.applyTheme({ recompile: true }).then(() => { @@ -289,7 +292,8 @@ export const useInterfaceStore = defineStore('interface', { this.resetThemeV2() this.resetThemeV3Palette() - window.vuex.commit('setOption', { name: 'styleCustomData', value }) + useSyncConfigStore().setPreference({ path: 'simple.styleCustomData', value }) + useSyncConfigStore().pushSyncConfig() this.useStylePalette = true this.applyTheme({ recompile: true }).then(() => { @@ -299,12 +303,12 @@ export const useInterfaceStore = defineStore('interface', { async fetchThemesIndex() { try { const value = await getResourcesIndex('/static/styles.json') - useInstanceStore().set({ name: 'themesIndex', value }) + useInstanceStore().set({ path: 'simple.themesIndex', value }) return value } catch (e) { console.error('Could not fetch themes index', e) useInstanceStore().set({ - name: 'themesIndex', + path: 'themesIndex', value: { _error: e }, }) return Promise.resolve({}) @@ -315,7 +319,8 @@ export const useInterfaceStore = defineStore('interface', { this.resetThemeV3Palette() this.resetThemeV2() - window.vuex.commit('setOption', { name: 'theme', value }) + useSyncConfigStore().setPreference({ path: 'simple.theme', value }) + useSyncConfigStore().pushSyncConfig() this.applyTheme({ recompile: true }) }, @@ -324,29 +329,33 @@ export const useInterfaceStore = defineStore('interface', { this.resetThemeV3Palette() this.resetThemeV2() - window.vuex.commit('setOption', { name: 'customTheme', value }) - window.vuex.commit('setOption', { name: 'customThemeSource', value }) + useSyncConfigStore().setPreference({ path: 'simple.customTheme', value }) + useSyncConfigStore().setPreference({ path: 'simple.customThemeSource', value }) + useSyncConfigStore().pushSyncConfig() this.applyTheme({ recompile: true }) }, resetThemeV3() { - window.vuex.commit('setOption', { name: 'style', value: null }) - window.vuex.commit('setOption', { name: 'styleCustomData', value: null }) + useSyncConfigStore().setPreference({ path: 'simple.style', value: null }) + useSyncConfigStore().setPreference({ path: 'simple.styleCustomData', value: null }) + useSyncConfigStore().pushSyncConfig() }, resetThemeV3Palette() { - window.vuex.commit('setOption', { name: 'palette', value: null }) - window.vuex.commit('setOption', { - name: 'paletteCustomData', + useSyncConfigStore().setPreference({ path: 'simple.palette', value: null }) + useSyncConfigStore().setPreference({ + path: 'simple.paletteCustomData', value: null, }) + useSyncConfigStore().pushSyncConfig() }, resetThemeV2() { - window.vuex.commit('setOption', { name: 'theme', value: null }) - window.vuex.commit('setOption', { name: 'customTheme', value: null }) - window.vuex.commit('setOption', { - name: 'customThemeSource', + useSyncConfigStore().setPreference({ path: 'simple.theme', value: null }) + useSyncConfigStore().setPreference({ path: 'simple.customTheme', value: null }) + useSyncConfigStore().setPreference({ + path: 'simple.customThemeSource', value: null, }) + useSyncConfigStore().pushSyncConfig() }, async getThemeData() { const getData = async (resource, index, customData, name) => { @@ -516,6 +525,7 @@ export const useInterfaceStore = defineStore('interface', { path: 'simple.palette', value: firstStylePaletteName, }) + useSyncConfigStore().pushSyncConfig() } this.paletteNameUsed = palette.nameUsed diff --git a/src/stores/sync_config.js b/src/stores/sync_config.js index 009ccbce4..91394139f 100644 --- a/src/stores/sync_config.js +++ b/src/stores/sync_config.js @@ -417,6 +417,14 @@ export const useSyncConfigStore = defineStore('sync_config', { this.flagStorage[flag] = value this.dirty = true }, + setSimplePrefAndSave({ path, value }) { + this.setPreference({ path: `simple.${path}`, value }) + this.pushSyncConfig() + }, + unsetSimplePrefAndSave({ path }) { + this.unsetPreference({ path: `simple.${path}` }) + this.pushSyncConfig() + }, setPreference({ path, value }) { if (path.startsWith('_')) { throw new Error( @@ -472,7 +480,7 @@ export const useSyncConfigStore = defineStore('sync_config', { `Calling unset on depth > 3 (path: ${path}) is not allowed`, ) } - unset(this.prefsStorage, path, value) + unset(this.prefsStorage, path) this.prefsStorage._journal = [ ...this.prefsStorage._journal, { operation: 'unset', path, args: [], timestamp: Date.now() },