From ebe487c5d8f742050d68390b43d21af838a27113 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Mon, 26 Jan 2026 23:24:48 +0200 Subject: [PATCH] it boots again --- src/App.js | 4 +++- src/boot/routes.js | 4 ++-- src/components/login_form/login_form.js | 8 +++---- .../helpers/shared_computed_object.js | 2 +- .../settings_modal/tabs/filtering_tab.js | 2 +- .../tabs/style_tab/style_tab.js | 2 +- src/stores/i18n.js | 2 ++ src/stores/sync_config.js | 22 ++++++++++--------- 8 files changed, 26 insertions(+), 20 deletions(-) diff --git a/src/App.js b/src/App.js index 879da48a7..8574455a3 100644 --- a/src/App.js +++ b/src/App.js @@ -198,7 +198,9 @@ export default { ...mapState(useInstanceStore, { instanceBackground: (store) => - this.mergedConfig.hideInstanceWallpaper ? null : store.background, + useSyncConfigStore().mergedConfig.hideInstanceWallpaper + ? null + : store.background, showInstanceSpecificPanel: (store) => store.showInstanceSpecificPanel && !useSyncConfigStore().mergedConfig.hideISP && diff --git a/src/boot/routes.js b/src/boot/routes.js index 6bdf23e2c..0d135981d 100644 --- a/src/boot/routes.js +++ b/src/boot/routes.js @@ -50,8 +50,8 @@ export default (store) => { redirect: () => { return ( (store.state.users.currentUser - ? store.state.instance.redirectRootLogin - : store.state.instance.redirectRootNoLogin) || '/main/all' + ? useInstanceStore().redirectRootLogin + : useInstanceStore().redirectRootNoLogin) || '/main/all' ) }, }, diff --git a/src/components/login_form/login_form.js b/src/components/login_form/login_form.js index 3d94e4023..c61571b97 100644 --- a/src/components/login_form/login_form.js +++ b/src/components/login_form/login_form.js @@ -4,6 +4,7 @@ import { mapState } from 'vuex' import oauthApi from '../../services/new_api/oauth.js' import { useAuthFlowStore } from 'src/stores/auth_flow.js' +import { useInstanceStore } from 'src/stores/instance.js' import { useOAuthStore } from 'src/stores/oauth.js' import { library } from '@fortawesome/fontawesome-svg-core' @@ -25,8 +26,6 @@ const LoginForm = { }, ...mapStores(useOAuthStore), ...mapState({ - registrationOpen: (state) => state.instance.registrationOpen, - instance: (state) => state.instance, loggingIn: (state) => state.users.loggingIn, }), ...mapPiniaState(useAuthFlowStore, [ @@ -34,6 +33,7 @@ const LoginForm = { 'requiredToken', 'requiredMFA', ]), + ...mapPiniaState(useInstanceStore, ['registrationOpen', 'server']), }, methods: { ...mapActions(useAuthFlowStore, ['requireMFA', 'login']), @@ -42,7 +42,7 @@ const LoginForm = { }, submitToken() { const data = { - instance: this.instance.server, + instance: this.server, commit: this.$store.commit, } @@ -70,7 +70,7 @@ const LoginForm = { oauthApi .getTokenWithCredentials({ ...app, - instance: this.instance.server, + instance: this.server, username: this.user.username, password: this.user.password, }) diff --git a/src/components/settings_modal/helpers/shared_computed_object.js b/src/components/settings_modal/helpers/shared_computed_object.js index 142fe3022..eef16e3cf 100644 --- a/src/components/settings_modal/helpers/shared_computed_object.js +++ b/src/components/settings_modal/helpers/shared_computed_object.js @@ -1,5 +1,5 @@ import { mapState as mapPiniaState } from 'pinia' -import { mapGetters, mapState } from 'vuex' +import { mapState } from 'vuex' import { useSyncConfigStore } from 'src/stores/sync_config.js' diff --git a/src/components/settings_modal/tabs/filtering_tab.js b/src/components/settings_modal/tabs/filtering_tab.js index 593b5e264..1360ea1f2 100644 --- a/src/components/settings_modal/tabs/filtering_tab.js +++ b/src/components/settings_modal/tabs/filtering_tab.js @@ -142,7 +142,7 @@ const FilteringTab = { }, ...mapState(useInstanceStore, { instanceSpecificPanelPresent: (store) => store.showInstanceSpecificPanel, - blockExpirationSupported: (store) => store.blockExpiration, + blockExpirationSupported: (store) => store.featureSet.blockExpiration, }), ...SharedComputedObject(), ...mapState(useSyncConfigStore, { diff --git a/src/components/settings_modal/tabs/style_tab/style_tab.js b/src/components/settings_modal/tabs/style_tab/style_tab.js index 6c2366999..8365645fc 100644 --- a/src/components/settings_modal/tabs/style_tab/style_tab.js +++ b/src/components/settings_modal/tabs/style_tab/style_tab.js @@ -24,7 +24,7 @@ import StringSetting from '../../helpers/string_setting.vue' import Preview from '../old_theme_tab/theme_preview.vue' import VirtualDirectivesTab from './virtual_directives_tab.vue' -import { useInterfaceStore } from 'src/stores/interface' +import { useInterfaceStore, useSyncConfigStore } from 'src/stores/interface' import { getContrastRatio, diff --git a/src/stores/i18n.js b/src/stores/i18n.js index 525d6022a..d10269916 100644 --- a/src/stores/i18n.js +++ b/src/stores/i18n.js @@ -22,6 +22,8 @@ export const useI18nStore = defineStore('i18n', { setLanguage(originalValue) { const value = originalValue || useSyncConfigStore().mergedConfig.interfaceLanguage + + console.log(useSyncConfigStore().mergedConfig) messages.setLanguage(this.i18n, value) useEmojiStore().loadUnicodeEmojiData(value) Cookies.set( diff --git a/src/stores/sync_config.js b/src/stores/sync_config.js index df6d80a49..2ee3bba7d 100644 --- a/src/stores/sync_config.js +++ b/src/stores/sync_config.js @@ -19,10 +19,7 @@ import { CURRENT_UPDATE_COUNTER } from 'src/components/update_notification/updat import { useInstanceStore } from 'src/stores/instance' -import { - defaultState as configDefaultState, - instanceDefaultConfig, -} from 'src/modules/default_config_state' +import { defaultState as configDefaultState } from 'src/modules/default_config_state' export const VERSION = 2 export const NEW_USER_DATE = new Date('2022-08-04') // date of writing this, basically @@ -216,7 +213,7 @@ const _mergeJournal = (...journals) => { // side effect journal.sort((a, b) => (a.timestamp > b.timestamp ? 1 : -1)) - if (path.startsWith('collections')) { + if (path.startsWith('collections') || path.startsWith('objectCollection')) { const lastRemoveIndex = findLastIndex( journal, ({ operation }) => operation === 'removeFromCollection', @@ -501,7 +498,6 @@ export const useSyncConfigStore = defineStore('sync_config', { collection.add(_key) set(this.prefsStorage, path + '.index', [...collection]) set(this.prefsStorage, path + '.data.' + _key, value) - console.log(get(path, this.prefsStorage, path)) } this.prefsStorage._journal = [ ...this.prefsStorage._journal, @@ -660,10 +656,16 @@ export const useSyncConfigStore = defineStore('sync_config', { }, }, getters: { - mergedConfig: (state) => ({ - ...useInstanceStore().prefsStorage, - ...state.prefsStorage.simple, - }), + mergedConfig: (state) => { + const instancePrefs = useInstanceStore().prefsStorage + const result = Object.fromEntries( + Object.entries(state.prefsStorage.simple).map(([k, v]) => [ + k, + v ?? instancePrefs[k], + ]), + ) + return result + }, }, persist: { afterLoad(state) {