akkoma-fe/src/modules/instance.js
Henry Jameson 0ca42bd3d6 Merge remote-tracking branch 'upstream/develop' into feature/scope_preferences
* upstream/develop: (36 commits)
  remove deploy stage
  remove deploy stage
  updated and completed German translation
  minor modification of Chinese translation
  update Chinese translation
  Add Chinese language
  Fix posting.
  Count spoiler text in the character count. Fixes #135.
  Added Irish (Gaeilge) Language
  Copy-Paste too fast from the Catalan file apparently. Now it's in good Occitan.
  simplify code
  adapt to destructive change of api
  Adds Occitan locale
  Updated italian translation
  Update oc.json
  Update oc.json
  Update of the oc.json file Actualizacion del fichièr oc.json
  Sort messages object by language code so that it's easier from the UI to browse them.
  explicitly set collapseMessageWithSubject to undefined
  Fall back to instance settings consistently
  ...
2018-11-26 04:33:41 +03:00

68 lines
1.6 KiB
JavaScript

import { set } from 'vue'
import StyleSetter from '../services/style_setter/style_setter.js'
const defaultState = {
// Stuff from static/config.json and apiConfig
name: 'Pleroma FE',
registrationOpen: true,
textlimit: 5000,
server: 'http://localhost:4040/',
theme: 'pleroma-dark',
background: '/static/aurora_borealis.jpg',
logo: '/static/logo.png',
logoMask: true,
logoMargin: '.2em',
redirectRootNoLogin: '/main/all',
redirectRootLogin: '/main/friends',
showInstanceSpecificPanel: false,
scopeOptionsEnabled: true,
formattingOptionsEnabled: false,
collapseMessageWithSubject: false,
hidePostStats: false,
hideUserStats: false,
disableChat: false,
scopeCopy: true,
subjectLineBehavior: 'email',
// Nasty stuff
pleromaBackend: true,
emoji: [],
customEmoji: [],
// Feature-set, apparently, not everything here is reported...
mediaProxyAvailable: false,
chatAvailable: false,
gopherAvailable: false,
suggestionsEnabled: false,
suggestionsWeb: '',
// Html stuff
instanceSpecificPanelContent: '',
tos: ''
}
const instance = {
state: defaultState,
mutations: {
setInstanceOption (state, { name, value }) {
if (typeof value !== 'undefined') {
set(state, name, value)
}
}
},
actions: {
setInstanceOption ({ commit, dispatch }, { name, value }) {
commit('setInstanceOption', {name, value})
switch (name) {
case 'name':
dispatch('setPageTitle')
break
case 'theme':
StyleSetter.setPreset(value, commit)
}
}
}
}
export default instance