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