yandere_fe/src/modules/config.js
Henry Jameson a806d43f05 Merge remote-tracking branch 'upstream/develop' into feature/theming2
* upstream/develop: (60 commits)
  whoops
  whoops
  DM timeline: stream new statuses
  update-japanese-translation
  Add actual user search.
  incorporate most translation changes from MR 368
  update french translation
  Always show dm panel.
  Add direct message tab.
  api service url
  remove deploy stage
  remove deploy stage
  updated and completed German translation
  On logout switch to public timeline.
  minor modification of Chinese translation
  update Chinese translation
  Add Chinese language
  Fix posting.
  Put oauth text into description.
  Display OAuth login on login form button.
  ...
2018-11-26 05:21:58 +03:00

66 lines
1.6 KiB
JavaScript

import { set, delete as del } from 'vue'
import { setPreset, setColors } from '../services/style_setter/style_setter.js'
const browserLocale = (window.navigator.language || 'en').split('-')[0]
const defaultState = {
colors: {},
collapseMessageWithSubject: undefined, // instance default
hideAttachments: false,
hideAttachmentsInConv: false,
hideNsfw: true,
loopVideo: true,
loopVideoSilentOnly: true,
autoLoad: true,
streaming: false,
hoverPreview: true,
pauseOnUnfocused: true,
stopGifs: false,
replyVisibility: 'all',
notificationVisibility: {
follows: true,
mentions: true,
likes: true,
repeats: true
},
muteWords: [],
highlight: {},
interfaceLanguage: browserLocale,
scopeCopy: undefined, // instance default
subjectLineBehavior: undefined // instance default
}
const config = {
state: defaultState,
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: {
setHighlight ({ commit, dispatch }, { user, color, type }) {
commit('setHighlight', {user, color, type})
},
setOption ({ commit, dispatch }, { name, value }) {
commit('setOption', {name, value})
switch (name) {
case 'theme':
setPreset(value, commit)
break
case 'customTheme':
setColors(value, commit)
}
}
}
}
export default config