forked from AkkomaGang/akkoma-fe
Merge branch 'serverside-frontend-configuration-2' into 'develop'
serverside-frontend-configuration-2 See merge request pleroma/pleroma-fe!312
This commit is contained in:
commit
bc4f09b775
1 changed files with 68 additions and 54 deletions
24
src/main.js
24
src/main.js
|
@ -95,12 +95,27 @@ window.fetch('/api/statusnet/config.json')
|
|||
store.dispatch('setOption', { name: 'registrationOpen', value: (registrationClosed === '0') })
|
||||
store.dispatch('setOption', { name: 'textlimit', value: parseInt(textlimit) })
|
||||
store.dispatch('setOption', { name: 'server', value: server })
|
||||
})
|
||||
|
||||
var apiConfig = data.site.pleromafe
|
||||
|
||||
window.fetch('/static/config.json')
|
||||
.then((res) => res.json())
|
||||
.then((data) => {
|
||||
const {theme, background, logo, showWhoToFollowPanel, whoToFollowProvider, whoToFollowLink, showInstanceSpecificPanel, scopeOptionsEnabled, collapseMessageWithSubject} = data
|
||||
var staticConfig = data
|
||||
|
||||
var theme = (apiConfig.theme || staticConfig.theme)
|
||||
var background = (apiConfig.background || staticConfig.background)
|
||||
var logo = (apiConfig.logo || staticConfig.logo)
|
||||
var redirectRootNoLogin = (apiConfig.redirectRootNoLogin || staticConfig.redirectRootNoLogin)
|
||||
var redirectRootLogin = (apiConfig.redirectRootLogin || staticConfig.redirectRootLogin)
|
||||
var chatDisabled = (apiConfig.chatDisabled || staticConfig.chatDisabled)
|
||||
var showWhoToFollowPanel = (apiConfig.showWhoToFollowPanel || staticConfig.showWhoToFollowPanel)
|
||||
var whoToFollowProvider = (apiConfig.whoToFollowProvider || staticConfig.whoToFollowProvider)
|
||||
var whoToFollowLink = (apiConfig.whoToFollowLink || staticConfig.whoToFollowLink)
|
||||
var showInstanceSpecificPanel = (apiConfig.showInstanceSpecificPanel || staticConfig.showInstanceSpecificPanel)
|
||||
var scopeOptionsEnabled = (apiConfig.scopeOptionsEnabled || staticConfig.scopeOptionsEnabled)
|
||||
var collapseMessageWithSubject = (apiConfig.collapseMessageWithSubject || staticConfig.collapseMessageWithSubject)
|
||||
|
||||
store.dispatch('setOption', { name: 'theme', value: theme })
|
||||
store.dispatch('setOption', { name: 'background', value: background })
|
||||
store.dispatch('setOption', { name: 'logo', value: logo })
|
||||
|
@ -110,7 +125,7 @@ window.fetch('/static/config.json')
|
|||
store.dispatch('setOption', { name: 'showInstanceSpecificPanel', value: showInstanceSpecificPanel })
|
||||
store.dispatch('setOption', { name: 'scopeOptionsEnabled', value: scopeOptionsEnabled })
|
||||
store.dispatch('setOption', { name: 'collapseMessageWithSubject', value: collapseMessageWithSubject })
|
||||
if (data['chatDisabled']) {
|
||||
if (chatDisabled) {
|
||||
store.dispatch('disableChat')
|
||||
}
|
||||
|
||||
|
@ -118,8 +133,6 @@ window.fetch('/static/config.json')
|
|||
{ name: 'root',
|
||||
path: '/',
|
||||
redirect: to => {
|
||||
var redirectRootLogin = data['redirectRootLogin']
|
||||
var redirectRootNoLogin = data['redirectRootNoLogin']
|
||||
return (store.state.users.currentUser ? redirectRootLogin : redirectRootNoLogin) || '/main/all'
|
||||
}},
|
||||
{ path: '/main/all', component: PublicAndExternalTimeline },
|
||||
|
@ -156,6 +169,7 @@ window.fetch('/static/config.json')
|
|||
render: h => h(App)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
window.fetch('/static/terms-of-service.html')
|
||||
.then((res) => res.text())
|
||||
|
|
Loading…
Reference in a new issue