made FE work even without either api or static config

This commit is contained in:
Henry Jameson 2018-09-17 18:54:08 +03:00
parent 40a175389a
commit 9467462ef0
2 changed files with 10 additions and 3 deletions

View file

@ -132,7 +132,9 @@ window.fetch('/api/statusnet/config.json')
{ name: 'root', { name: 'root',
path: '/', path: '/',
redirect: to => { redirect: to => {
return (store.state.users.currentUser ? redirectRootLogin : redirectRootNoLogin) || '/main/all' return (store.state.users.currentUser
? store.state.instance.redirectRootLogin
: store.state.instance.redirectRootNoLogin) || '/main/all'
}}, }},
{ path: '/main/all', component: PublicAndExternalTimeline }, { path: '/main/all', component: PublicAndExternalTimeline },
{ path: '/main/public', component: PublicTimeline }, { path: '/main/public', component: PublicTimeline },

View file

@ -1,4 +1,5 @@
import { set } from 'vue' import { set } from 'vue'
import StyleSetter from '../services/style_setter/style_setter.js'
const defaultState = { const defaultState = {
// Stuff from static/config.json and apiConfig // Stuff from static/config.json and apiConfig
@ -7,7 +8,7 @@ const defaultState = {
textlimit: 5000, textlimit: 5000,
server: 'http://localhost:4040/', server: 'http://localhost:4040/',
theme: 'pleroma-dark', theme: 'pleroma-dark',
background: 'img.png', background: '/static/aurora_borealis.jpg',
logo: '/static/logo.png', logo: '/static/logo.png',
logoMask: true, logoMask: true,
logoMargin: '.2em', logoMargin: '.2em',
@ -40,7 +41,9 @@ const instance = {
state: defaultState, state: defaultState,
mutations: { mutations: {
setInstanceOption (state, { name, value }) { setInstanceOption (state, { name, value }) {
set(state, name, value) if (typeof value !== 'undefined') {
set(state, name, value)
}
} }
}, },
actions: { actions: {
@ -50,6 +53,8 @@ const instance = {
case 'name': case 'name':
dispatch('setPageTitle') dispatch('setPageTitle')
break break
case 'theme':
StyleSetter.setPreset(value, commit)
} }
} }
} }