pleroma-fe/src/modules/instance.js

64 lines
1.5 KiB
JavaScript
Raw Normal View History

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