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 = {
|
2018-09-09 11:51:40 -07:00
|
|
|
// 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',
|
2018-09-17 08:54:08 -07:00
|
|
|
background: '/static/aurora_borealis.jpg',
|
2018-09-09 11:21:23 -07:00
|
|
|
logo: '/static/logo.png',
|
|
|
|
logoMask: true,
|
|
|
|
logoMargin: '.2em',
|
2018-12-25 09:43:52 -08:00
|
|
|
redirectRootNoLogin: '/main/all',
|
|
|
|
redirectRootLogin: '/main/friends',
|
2018-09-09 11:21:23 -07:00
|
|
|
showInstanceSpecificPanel: false,
|
|
|
|
formattingOptionsEnabled: false,
|
2018-12-02 19:47:35 -08:00
|
|
|
alwaysShowSubjectInput: true,
|
2019-03-02 05:07:14 -08:00
|
|
|
hideMutedPosts: false,
|
2018-09-09 11:21:23 -07:00
|
|
|
collapseMessageWithSubject: false,
|
2018-10-16 06:09:29 -07:00
|
|
|
hidePostStats: false,
|
|
|
|
hideUserStats: false,
|
2019-02-21 09:52:58 -08:00
|
|
|
hideFilteredStatuses: 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',
|
2019-02-06 11:26:46 -08:00
|
|
|
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,
|
2018-12-27 08:59:56 -08:00
|
|
|
noAttachmentLinks: false,
|
2019-02-08 13:20:47 -08:00
|
|
|
showFeaturesPanel: true,
|
2019-03-03 05:15:41 -08:00
|
|
|
minimalScopesMode: false,
|
2018-09-09 11:51:40 -07:00
|
|
|
|
2018-09-09 11:21:23 -07:00
|
|
|
// Nasty stuff
|
|
|
|
pleromaBackend: true,
|
2018-09-09 11:51:40 -07:00
|
|
|
emoji: [],
|
2018-09-09 11:21:23 -07:00
|
|
|
customEmoji: [],
|
2018-12-26 05:50:48 -08:00
|
|
|
restrictedNicknames: [],
|
2019-03-04 21:29:56 -08:00
|
|
|
postFormats: [],
|
2018-09-09 11:51:40 -07:00
|
|
|
|
|
|
|
// 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: '',
|
2019-03-10 16:58:12 -07:00
|
|
|
tos: '',
|
|
|
|
|
|
|
|
// Version Information
|
|
|
|
backendVersion: '',
|
|
|
|
frontendVersion: ''
|
2018-09-09 11:21:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
const instance = {
|
|
|
|
state: defaultState,
|
|
|
|
mutations: {
|
|
|
|
setInstanceOption (state, { name, value }) {
|
2018-09-17 08:54:08 -07:00
|
|
|
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
|
|
|
|
}
|
2019-02-09 01:26:35 -08:00
|
|
|
},
|
|
|
|
setTheme ({ commit }, themeName) {
|
|
|
|
commit('setInstanceOption', { name: 'theme', value: themeName })
|
|
|
|
return setPreset(themeName, commit)
|
2018-09-09 11:21:23 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default instance
|