pleroma-fe/src/modules/instance.js

92 lines
2.1 KiB
JavaScript
Raw Normal View History

2018-09-10 04:21:23 +10:00
import { set } from 'vue'
2018-11-20 04:22:46 +11:00
import { setPreset } from '../services/style_setter/style_setter.js'
2018-09-10 04:21:23 +10:00
const defaultState = {
// Stuff from static/config.json and apiConfig
2018-09-10 04:21:23 +10:00
name: 'Pleroma FE',
registrationOpen: true,
safeDM: true,
2018-09-10 04:21:23 +10:00
textlimit: 5000,
server: 'http://localhost:4040/',
theme: 'pleroma-dark',
background: '/static/aurora_borealis.jpg',
2018-09-10 04:21:23 +10:00
logo: '/static/logo.png',
logoMask: true,
logoMargin: '.2em',
redirectRootNoLogin: '/main/all',
redirectRootLogin: '/main/friends',
2018-09-10 04:21:23 +10:00
showInstanceSpecificPanel: false,
alwaysShowSubjectInput: true,
hideMutedPosts: false,
2018-09-10 04:21:23 +10:00
collapseMessageWithSubject: false,
hidePostStats: false,
hideUserStats: false,
2019-02-22 04:52:58 +11:00
hideFilteredStatuses: false,
2018-09-10 04:21:23 +10:00
disableChat: false,
2018-09-25 22:16:26 +10:00
scopeCopy: true,
2018-09-25 21:47:02 +10:00
subjectLineBehavior: 'email',
postContentType: 'text/plain',
2018-12-14 04:41:01 +11:00
nsfwCensorImage: undefined,
vapidPublicKey: undefined,
noAttachmentLinks: false,
2019-02-09 08:20:47 +11:00
showFeaturesPanel: true,
minimalScopesMode: false,
2018-09-10 04:21:23 +10:00
// Nasty stuff
pleromaBackend: true,
emoji: [],
2018-09-10 04:21:23 +10:00
customEmoji: [],
restrictedNicknames: [],
postFormats: [],
// Feature-set, apparently, not everything here is reported...
mediaProxyAvailable: false,
chatAvailable: false,
gopherAvailable: false,
suggestionsEnabled: false,
suggestionsWeb: '',
2018-09-10 04:21:23 +10:00
// Html stuff
instanceSpecificPanelContent: '',
tos: '',
// Version Information
backendVersion: '',
2019-06-19 06:28:31 +10:00
frontendVersion: '',
pollsAvailable: false,
pollLimits: {
max_options: 4,
max_option_chars: 255,
min_expiration: 60,
max_expiration: 60 * 60 * 24
}
2018-09-10 04:21:23 +10:00
}
const instance = {
state: defaultState,
mutations: {
setInstanceOption (state, { name, value }) {
if (typeof value !== 'undefined') {
set(state, name, value)
}
2018-09-10 04:21:23 +10:00
}
},
actions: {
setInstanceOption ({ commit, dispatch }, { name, value }) {
2019-07-05 17:02:14 +10:00
commit('setInstanceOption', { name, value })
2018-09-10 04:21:23 +10:00
switch (name) {
case 'name':
dispatch('setPageTitle')
break
}
},
setTheme ({ commit }, themeName) {
commit('setInstanceOption', { name: 'theme', value: themeName })
return setPreset(themeName, commit)
2018-09-10 04:21:23 +10:00
}
}
}
export default instance