fix themes not working
This commit is contained in:
parent
6cdb921e56
commit
77cc2e5201
3 changed files with 60 additions and 22 deletions
|
|
@ -654,6 +654,46 @@ export const LOCAL_DEFAULT_CONFIG = convertDefinitions(
|
||||||
|
|
||||||
export const LOCAL_ONLY_KEYS = new Set(Object.keys(LOCAL_DEFAULT_CONFIG))
|
export const LOCAL_ONLY_KEYS = new Set(Object.keys(LOCAL_DEFAULT_CONFIG))
|
||||||
|
|
||||||
|
export const THEME_CONFIG_DEFINITIONS = {
|
||||||
|
theme: {
|
||||||
|
description: 'Very old theme store, stores preset name, still in use',
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
colors: {
|
||||||
|
description: 'VERY old theme store, just colors of V1, probably not even used anymore',
|
||||||
|
default: {},
|
||||||
|
},
|
||||||
|
// V2
|
||||||
|
customTheme: {
|
||||||
|
description: '"Snapshot", previously was used as actual theme store for V2 so it\'s still used in case of PleromaFE downgrade event.',
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
customThemeSource: {
|
||||||
|
description: '"Source", stores original theme data',
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
// V3
|
||||||
|
style: {
|
||||||
|
description: 'Style name for builtins',
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
styleCustomData: {
|
||||||
|
description: 'Custom style data (i.e. not builtin)',
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
palette: {
|
||||||
|
description: 'Palette name for builtins',
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
paletteCustomData: {
|
||||||
|
description: 'Custom palette data (i.e. not builtin)',
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
export const THEME_CONFIG = convertDefinitions(
|
||||||
|
THEME_CONFIG_DEFINITIONS,
|
||||||
|
)
|
||||||
|
|
||||||
export const makeUndefined = (c) =>
|
export const makeUndefined = (c) =>
|
||||||
Object.fromEntries(Object.keys(c).map((key) => [key, undefined]))
|
Object.fromEntries(Object.keys(c).map((key) => [key, undefined]))
|
||||||
|
|
||||||
|
|
@ -663,25 +703,7 @@ export const defaultState = {
|
||||||
// Set these to undefined so it does not interfere with default settings check
|
// Set these to undefined so it does not interfere with default settings check
|
||||||
...makeUndefined(INSTANCE_DEFAULT_CONFIG),
|
...makeUndefined(INSTANCE_DEFAULT_CONFIG),
|
||||||
...makeUndefined(LOCAL_DEFAULT_CONFIG),
|
...makeUndefined(LOCAL_DEFAULT_CONFIG),
|
||||||
// If there are any configurations that does not make sense to
|
...makeUndefined(THEME_CONFIG),
|
||||||
// have instance-wide default, put it here and explain why.
|
|
||||||
|
|
||||||
// # Special processing
|
|
||||||
// ## Theme stuff
|
|
||||||
theme: undefined, // Very old theme store, stores preset name, still in use
|
|
||||||
|
|
||||||
// V1
|
|
||||||
colors: {}, // VERY old theme store, just colors of V1, probably not even used anymore
|
|
||||||
|
|
||||||
// V2
|
|
||||||
customTheme: undefined, // "snapshot", previously was used as actual theme store for V2 so it's still used in case of PleromaFE downgrade event.
|
|
||||||
customThemeSource: undefined, // "source", stores original theme data
|
|
||||||
|
|
||||||
// V3
|
|
||||||
style: null,
|
|
||||||
styleCustomData: null,
|
|
||||||
palette: null,
|
|
||||||
paletteCustomData: null,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const validateSetting = ({
|
export const validateSetting = ({
|
||||||
|
|
|
||||||
|
|
@ -7,12 +7,14 @@ import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||||
import {
|
import {
|
||||||
INSTANCE_DEFAULT_CONFIG,
|
INSTANCE_DEFAULT_CONFIG,
|
||||||
LOCAL_DEFAULT_CONFIG,
|
LOCAL_DEFAULT_CONFIG,
|
||||||
|
THEME_CONFIG,
|
||||||
LOCAL_ONLY_KEYS,
|
LOCAL_ONLY_KEYS,
|
||||||
} from 'src/modules/default_config_state.js'
|
} from 'src/modules/default_config_state.js'
|
||||||
|
|
||||||
const ROOT_CONFIG = {
|
const ROOT_CONFIG = {
|
||||||
...INSTANCE_DEFAULT_CONFIG,
|
...INSTANCE_DEFAULT_CONFIG,
|
||||||
...LOCAL_DEFAULT_CONFIG,
|
...LOCAL_DEFAULT_CONFIG,
|
||||||
|
...THEME_CONFIG,
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useMergedConfigStore = defineStore('merged_config', {
|
export const useMergedConfigStore = defineStore('merged_config', {
|
||||||
|
|
|
||||||
|
|
@ -28,11 +28,25 @@ import {
|
||||||
INSTANCE_DEFAULT_CONFIG,
|
INSTANCE_DEFAULT_CONFIG,
|
||||||
INSTANCE_DEFAULT_CONFIG_DEFINITIONS,
|
INSTANCE_DEFAULT_CONFIG_DEFINITIONS,
|
||||||
LOCAL_DEFAULT_CONFIG,
|
LOCAL_DEFAULT_CONFIG,
|
||||||
LOCAL_ONLY_KEYS,
|
LOCAL_DEFAULT_CONFIG_DEFINITIONS,
|
||||||
|
THEME_CONFIG,
|
||||||
|
THEME_CONFIG_DEFINITIONS,
|
||||||
validateSetting,
|
validateSetting,
|
||||||
} from 'src/modules/default_config_state.js'
|
} from 'src/modules/default_config_state.js'
|
||||||
import { oldDefaultConfigSync } from 'src/modules/old_default_config_state.js'
|
import { oldDefaultConfigSync } from 'src/modules/old_default_config_state.js'
|
||||||
|
|
||||||
|
const ROOT_CONFIG_DEFINITIONS = {
|
||||||
|
...INSTANCE_DEFAULT_CONFIG_DEFINITIONS,
|
||||||
|
...LOCAL_DEFAULT_CONFIG_DEFINITIONS,
|
||||||
|
...THEME_CONFIG_DEFINITIONS,
|
||||||
|
}
|
||||||
|
|
||||||
|
const ROOT_CONFIG = {
|
||||||
|
...INSTANCE_DEFAULT_CONFIG,
|
||||||
|
...LOCAL_DEFAULT_CONFIG,
|
||||||
|
...THEME_CONFIG,
|
||||||
|
}
|
||||||
|
|
||||||
export const VERSION = 2
|
export const VERSION = 2
|
||||||
export const NEW_USER_DATE = new Date('2026-03-16') // date of writing this, basically
|
export const NEW_USER_DATE = new Date('2026-03-16') // date of writing this, basically
|
||||||
|
|
||||||
|
|
@ -491,14 +505,14 @@ export const useSyncConfigStore = defineStore('sync_config', {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const definition = INSTANCE_DEFAULT_CONFIG_DEFINITIONS[path.split('.')[1]]
|
const definition = ROOT_CONFIG_DEFINITIONS[path.split('.')[1]]
|
||||||
|
|
||||||
const finalValue = validateSetting({
|
const finalValue = validateSetting({
|
||||||
path: path.split('.')[1],
|
path: path.split('.')[1],
|
||||||
value,
|
value,
|
||||||
definition,
|
definition,
|
||||||
throwError: false,
|
throwError: false,
|
||||||
defaultState: INSTANCE_DEFAULT_CONFIG,
|
defaultState: ROOT_CONFIG,
|
||||||
})
|
})
|
||||||
|
|
||||||
set(this.prefsStorage, path, finalValue)
|
set(this.prefsStorage, path, finalValue)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue