diff options
Diffstat (limited to 'src/modules/config.js')
| -rw-r--r-- | src/modules/config.js | 47 |
1 files changed, 36 insertions, 11 deletions
diff --git a/src/modules/config.js b/src/modules/config.js index 9a62905e..ccfd0190 100644 --- a/src/modules/config.js +++ b/src/modules/config.js @@ -1,16 +1,36 @@ -import { set } from 'vue' -import StyleSetter from '../services/style_setter/style_setter.js' +import { set, delete as del } from 'vue' +import { setPreset, applyTheme } from '../services/style_setter/style_setter.js' + +const browserLocale = (window.navigator.language || 'en').split('-')[0] const defaultState = { - name: 'Pleroma FE', colors: {}, + collapseMessageWithSubject: undefined, // instance default hideAttachments: false, hideAttachmentsInConv: false, hideNsfw: true, + preloadImage: true, + loopVideo: true, + loopVideoSilentOnly: true, autoLoad: true, streaming: false, hoverPreview: true, - muteWords: [] + pauseOnUnfocused: true, + stopGifs: false, + replyVisibility: 'all', + notificationVisibility: { + follows: true, + mentions: true, + likes: true, + repeats: true + }, + webPushNotifications: true, + muteWords: [], + highlight: {}, + interfaceLanguage: browserLocale, + scopeCopy: undefined, // instance default + subjectLineBehavior: undefined, // instance default + alwaysShowSubjectInput: undefined // instance default } const config = { @@ -18,23 +38,28 @@ const config = { mutations: { setOption (state, { name, value }) { set(state, name, value) + }, + setHighlight (state, { user, color, type }) { + const data = this.state.config.highlight[user] + if (color || type) { + set(state.highlight, user, { color: color || data.color, type: type || data.type }) + } else { + del(state.highlight, user) + } } }, actions: { - setPageTitle ({state}, option = '') { - document.title = `${option} ${state.name}` + setHighlight ({ commit, dispatch }, { user, color, type }) { + commit('setHighlight', {user, color, type}) }, setOption ({ commit, dispatch }, { name, value }) { commit('setOption', {name, value}) switch (name) { - case 'name': - dispatch('setPageTitle') - break case 'theme': - StyleSetter.setPreset(value, commit) + setPreset(value, commit) break case 'customTheme': - StyleSetter.setColors(value, commit) + applyTheme(value, commit) } } } |
