yandere_fe/src/modules/instance.js

76 lines
1.8 KiB
JavaScript
Raw Normal View History

2018-09-09 11:21:23 -07:00
import { set } from 'vue'
2018-11-19 09:22:46 -08:00
import { setPreset } from '../services/style_setter/style_setter.js'
2018-09-09 11:21:23 -07:00
const defaultState = {
// Stuff from static/config.json and apiConfig
2018-09-09 11:21:23 -07:00
name: 'Pleroma FE',
registrationOpen: true,
textlimit: 5000,
server: 'http://localhost:4040/',
theme: 'pleroma-dark',
background: '/static/aurora_borealis.jpg',
2018-09-09 11:21:23 -07:00
logo: '/static/logo.png',
logoMask: true,
logoMargin: '.2em',
redirectRootNoLogin: '/main/all',
redirectRootLogin: '/main/friends',
2018-09-09 11:21:23 -07:00
showInstanceSpecificPanel: false,
scopeOptionsEnabled: true,
formattingOptionsEnabled: false,
alwaysShowSubjectInput: true,
2018-09-09 11:21:23 -07:00
collapseMessageWithSubject: false,
hidePostStats: false,
hideUserStats: false,
2018-09-09 11:21:23 -07:00
disableChat: false,
2018-09-25 05:16:26 -07:00
scopeCopy: true,
2018-09-25 04:47:02 -07:00
subjectLineBehavior: 'email',
postContentType: 'text/plain',
2018-11-07 07:56:12 -08:00
loginMethod: 'password',
2018-12-13 09:41:01 -08:00
nsfwCensorImage: undefined,
vapidPublicKey: undefined,
noAttachmentLinks: false,
showFeaturesPanel: false,
2018-09-09 11:21:23 -07:00
// Nasty stuff
pleromaBackend: true,
emoji: [],
2018-09-09 11:21:23 -07:00
customEmoji: [],
restrictedNicknames: [],
// Feature-set, apparently, not everything here is reported...
mediaProxyAvailable: false,
chatAvailable: false,
gopherAvailable: false,
suggestionsEnabled: false,
suggestionsWeb: '',
2018-09-09 11:21:23 -07: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 11:21:23 -07:00
}
},
actions: {
setInstanceOption ({ commit, dispatch }, { name, value }) {
commit('setInstanceOption', {name, value})
switch (name) {
case 'name':
dispatch('setPageTitle')
break
case 'theme':
2018-11-19 09:22:46 -08:00
setPreset(value, commit)
2018-09-09 11:21:23 -07:00
}
}
}
}
export default instance