added option for logo in navbar to follow color scheme of the rest of the site

also fixed potential mess-up between api/static configs
This commit is contained in:
Henry Jameson 2018-08-31 04:06:00 +03:00
parent 63fdad8703
commit e99534ef71
5 changed files with 84 additions and 18 deletions

View file

@ -103,23 +103,29 @@ window.fetch('/api/statusnet/config.json')
.then((res) => res.json())
.then((data) => {
var staticConfig = data
// This takes static config and overrides properties that are present in apiConfig
var config = Object.assign({}, staticConfig, apiConfig)
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)
var theme = (config.theme)
var background = (config.background)
var logo = (config.logo)
var logoMask = (typeof config.logoMask === 'undefined' ? true : config.logoMask)
var logoMargin = (typeof config.logoMargin === 'undefined' ? 0 : config.logoMargin)
var redirectRootNoLogin = (config.redirectRootNoLogin)
var redirectRootLogin = (config.redirectRootLogin)
var chatDisabled = (config.chatDisabled)
var showWhoToFollowPanel = (config.showWhoToFollowPanel)
var whoToFollowProvider = (config.whoToFollowProvider)
var whoToFollowLink = (config.whoToFollowLink)
var showInstanceSpecificPanel = (config.showInstanceSpecificPanel)
var scopeOptionsEnabled = (config.scopeOptionsEnabled)
var collapseMessageWithSubject = (config.collapseMessageWithSubject)
store.dispatch('setOption', { name: 'theme', value: theme })
store.dispatch('setOption', { name: 'background', value: background })
store.dispatch('setOption', { name: 'logo', value: logo })
store.dispatch('setOption', { name: 'logoMask', value: logoMask })
store.dispatch('setOption', { name: 'logoMargin', value: logoMargin })
store.dispatch('setOption', { name: 'showWhoToFollowPanel', value: showWhoToFollowPanel })
store.dispatch('setOption', { name: 'whoToFollowProvider', value: whoToFollowProvider })
store.dispatch('setOption', { name: 'whoToFollowLink', value: whoToFollowLink })