more local-only stuff
This commit is contained in:
parent
10b4259de6
commit
6a8abf1b32
3 changed files with 14 additions and 10 deletions
|
|
@ -49,8 +49,6 @@ export const instanceDefaultConfig = {
|
||||||
hideScrobbles: false,
|
hideScrobbles: false,
|
||||||
hideScrobblesAfter: '2d',
|
hideScrobblesAfter: '2d',
|
||||||
maxThumbnails: 16,
|
maxThumbnails: 16,
|
||||||
hideNsfw: true,
|
|
||||||
preloadImage: true,
|
|
||||||
loopVideo: true,
|
loopVideo: true,
|
||||||
loopVideoSilentOnly: true,
|
loopVideoSilentOnly: true,
|
||||||
/// This is not the streaming API configuration, but rather an option
|
/// This is not the streaming API configuration, but rather an option
|
||||||
|
|
@ -121,7 +119,6 @@ export const instanceDefaultConfig = {
|
||||||
|
|
||||||
modalMobileCenter: false,
|
modalMobileCenter: false,
|
||||||
playVideosInModal: false,
|
playVideosInModal: false,
|
||||||
useOneClickNsfw: false,
|
|
||||||
useContainFit: true,
|
useContainFit: true,
|
||||||
disableStickyHeaders: false,
|
disableStickyHeaders: false,
|
||||||
showScrollbars: false,
|
showScrollbars: false,
|
||||||
|
|
@ -165,6 +162,9 @@ export const instanceDefaultConfig = {
|
||||||
export const defaultConfigLocal = {
|
export const defaultConfigLocal = {
|
||||||
hideAttachments: false,
|
hideAttachments: false,
|
||||||
hideAttachmentsInConv: false,
|
hideAttachmentsInConv: false,
|
||||||
|
hideNsfw: true,
|
||||||
|
useOneClickNsfw: false,
|
||||||
|
preloadImage: true,
|
||||||
postContentType: 'text/plain',
|
postContentType: 'text/plain',
|
||||||
sidebarRight: false,
|
sidebarRight: false,
|
||||||
sidebarColumnWidth: '25rem',
|
sidebarColumnWidth: '25rem',
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,6 @@ export const defaultConfigSync = {
|
||||||
hideScrobbles: false,
|
hideScrobbles: false,
|
||||||
hideScrobblesAfter: '2d',
|
hideScrobblesAfter: '2d',
|
||||||
maxThumbnails: 16,
|
maxThumbnails: 16,
|
||||||
hideNsfw: true,
|
|
||||||
preloadImage: true,
|
|
||||||
loopVideo: true,
|
loopVideo: true,
|
||||||
loopVideoSilentOnly: true,
|
loopVideoSilentOnly: true,
|
||||||
/// This is not the streaming API configuration, but rather an option
|
/// This is not the streaming API configuration, but rather an option
|
||||||
|
|
@ -93,7 +91,6 @@ export const defaultConfigSync = {
|
||||||
|
|
||||||
modalMobileCenter: false,
|
modalMobileCenter: false,
|
||||||
playVideosInModal: false,
|
playVideosInModal: false,
|
||||||
useOneClickNsfw: false,
|
|
||||||
useContainFit: true,
|
useContainFit: true,
|
||||||
disableStickyHeaders: false,
|
disableStickyHeaders: false,
|
||||||
showScrollbars: false,
|
showScrollbars: false,
|
||||||
|
|
@ -169,6 +166,9 @@ export const defaultConfigSync = {
|
||||||
export const defaultConfigLocal = {
|
export const defaultConfigLocal = {
|
||||||
hideAttachments: false,
|
hideAttachments: false,
|
||||||
hideAttachmentsInConv: false,
|
hideAttachmentsInConv: false,
|
||||||
|
hideNsfw: true,
|
||||||
|
useOneClickNsfw: false,
|
||||||
|
preloadImage: true,
|
||||||
sidebarColumnWidth: '25rem',
|
sidebarColumnWidth: '25rem',
|
||||||
contentColumnWidth: '45rem',
|
contentColumnWidth: '45rem',
|
||||||
notifsColumnWidth: '25rem',
|
notifsColumnWidth: '25rem',
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ import { useInstanceStore } from 'src/stores/instance.js'
|
||||||
import { useLocalConfigStore } from 'src/stores/local_config.js'
|
import { useLocalConfigStore } from 'src/stores/local_config.js'
|
||||||
|
|
||||||
import { storage } from 'src/lib/storage.js'
|
import { storage } from 'src/lib/storage.js'
|
||||||
import { defaultState as configDefaultState } from 'src/modules/default_config_state.js'
|
import { defaultState as configDefaultState, makeUndefined, defaultConfigLocal } from 'src/modules/default_config_state.js'
|
||||||
import { defaultConfigSync } from 'src/modules/old_default_config_state.js'
|
import { defaultConfigSync } from 'src/modules/old_default_config_state.js'
|
||||||
|
|
||||||
export const VERSION = 2
|
export const VERSION = 2
|
||||||
|
|
@ -31,6 +31,7 @@ export const COMMAND_TRIM_FLAGS = 1000
|
||||||
export const COMMAND_TRIM_FLAGS_AND_RESET = 1001
|
export const COMMAND_TRIM_FLAGS_AND_RESET = 1001
|
||||||
export const COMMAND_WIPE_JOURNAL = 1010
|
export const COMMAND_WIPE_JOURNAL = 1010
|
||||||
export const COMMAND_WIPE_JOURNAL_AND_STORAGE = 1011
|
export const COMMAND_WIPE_JOURNAL_AND_STORAGE = 1011
|
||||||
|
const LOCAL_ONLY_KEYS = new Set(Object.keys(defaultConfigLocal))
|
||||||
|
|
||||||
export const defaultState = {
|
export const defaultState = {
|
||||||
// do we need to update data on server?
|
// do we need to update data on server?
|
||||||
|
|
@ -49,7 +50,7 @@ export const defaultState = {
|
||||||
dontShowUpdateNotifs: false,
|
dontShowUpdateNotifs: false,
|
||||||
collapseNav: false,
|
collapseNav: false,
|
||||||
muteFilters: {},
|
muteFilters: {},
|
||||||
...configDefaultState,
|
...makeUndefined(configDefaultState),
|
||||||
},
|
},
|
||||||
collections: {
|
collections: {
|
||||||
pinnedStatusActions: ['reply', 'retweet', 'favorite', 'emoji'],
|
pinnedStatusActions: ['reply', 'retweet', 'favorite', 'emoji'],
|
||||||
|
|
@ -636,6 +637,7 @@ export const useSyncConfigStore = defineStore('sync_config', {
|
||||||
needUpload = true
|
needUpload = true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
vuexState.config._syncMigration = [...migratedEntries]
|
vuexState.config._syncMigration = [...migratedEntries]
|
||||||
storage.setItem('vuex-lz', vuexState)
|
storage.setItem('vuex-lz', vuexState)
|
||||||
|
|
||||||
|
|
@ -716,9 +718,11 @@ export const useSyncConfigStore = defineStore('sync_config', {
|
||||||
const localPrefs = useLocalConfigStore().prefsStorage
|
const localPrefs = useLocalConfigStore().prefsStorage
|
||||||
const tempPrefs = useLocalConfigStore().tempStorage
|
const tempPrefs = useLocalConfigStore().tempStorage
|
||||||
const result = Object.fromEntries(
|
const result = Object.fromEntries(
|
||||||
Object.entries(state.prefsStorage.simple).map(([k, v]) => [
|
Object.entries(state.prefsStorage.simple).map(([k, value]) => [
|
||||||
k,
|
k,
|
||||||
tempPrefs[k] ?? localPrefs[k] ?? v ?? instancePrefs[k],
|
LOCAL_ONLY_KEYS.has(k)
|
||||||
|
? tempPrefs[k] ?? localPrefs[k] ?? instancePrefs[k]
|
||||||
|
: tempPrefs[k] ?? localPrefs[k] ?? value ?? instancePrefs[k],
|
||||||
]),
|
]),
|
||||||
)
|
)
|
||||||
return result
|
return result
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue