preparing multisite settings, fix #141

This commit is contained in:
lesion
2022-03-07 17:47:31 +01:00
parent bac0aa5b16
commit 4f3a34d356
9 changed files with 43 additions and 39 deletions

View File

@@ -85,8 +85,8 @@ module.exports = {
delete res.locals.settings.publicKey
res.locals.settings.baseurl = config.baseurl
res.locals.settings.hostname = config.hostname
res.locals.settings.title = settings.title || config.title
res.locals.settings.description = settings.description || config.description
res.locals.settings.title = res.locals.settings.title || config.title
res.locals.settings.description = res.locals.settings.description || config.description
res.locals.settings.version = pkg.version
// set user locale
@@ -95,20 +95,19 @@ module.exports = {
},
serveStatic () {
const settings = settingsController.settings
const router = express.Router()
// serve event's images/thumb
router.use('/media/', express.static(config.upload_path, { immutable: true, maxAge: '1y' } ))
router.use('/noimg.svg', express.static('./static/noimg.svg'))
router.use('/logo.png', (req, res, next) => {
const logoPath = settings.logo || './static/gancio'
const logoPath = res.locals.settings.logo || './static/gancio'
return express.static(logoPath + '.png')(req, res, next)
})
router.use('/favicon.ico', (req, res, next) => {
const faviconPath = settings.logo || './assets/favicon'
return express.static(faviconPath + '.ico')(req, res, next)
const faviconPath = res.locals.settings.logo ? res.locals.settings.logo + '.png' : './assets/favicon.ico'
return express.static(faviconPath)(req, res, next)
})
return router