major UI modification

This commit is contained in:
les
2020-07-28 12:24:39 +02:00
parent 2758541df0
commit 411560c218
27 changed files with 770 additions and 572 deletions

View File

@@ -112,20 +112,19 @@ const settingsController = {
return res.status(400).send('Mmmmm sould not be here!')
}
const uploaded_path = path.join(req.file.destination, req.file.filename)
const logo_path = path.resolve(config.upload_path, 'favicon')
const favicon_path = path.resolve(config.upload_path, 'favicon')
const uploadedPath = path.join(req.file.destination, req.file.filename)
const baseImgPath = path.resolve(config.upload_path, 'logo')
// convert and resize to png
sharp(uploaded_path)
sharp(uploadedPath)
.resize(400)
.png({ quality: 90 })
.toFile(logo_path + '.png', async (err, info) => {
.toFile(baseImgPath + '.png', async (err, info) => {
console.error(err)
const image = await readFile(logo_path + '.png')
const image = await readFile(baseImgPath + '.png')
const favicon = await toIco([image], { sizes: [64], resize: true })
writeFile(favicon_path + '.ico', favicon)
settingsController.set('favicon', favicon_path)
writeFile(baseImgPath + '.ico', favicon)
settingsController.set('logo', baseImgPath)
res.sendStatus(200)
})
},

View File

@@ -29,15 +29,16 @@ app.use((req, res, next) => {
app.use('/media/', express.static(config.upload_path))
// initialize instance settings / authentication / locale
app.use(helpers.initSettings)
// serve favicon and static content
app.use('/logo.png', (req, res, next) => {
const logo_path = req.settings.favicon || './static/gancio'
return express.static(logo_path + '.png')(req, res, next)
const logoPath = req.settings.logo || './static/gancio'
return express.static(logoPath + '.png')(req, res, next)
})
app.use('/favicon.ico', (req, res, next) => {
const favicon_path = req.settings.favicon || './assets/favicon'
return express.static(favicon_path + '.ico')(req, res, next)
const faviconPath = req.settings.logo || './assets/favicon'
return express.static(faviconPath + '.ico')(req, res, next)
})
// rss/ics/atom feed