diff --git a/config/index.js b/config/index.js index 25c0cce..8f4c34c 100644 --- a/config/index.js +++ b/config/index.js @@ -11,6 +11,7 @@ module.exports = { sessionStore: process.env.SESSION_STORE || './sessions', sessionMaxAge: Number(process.env.SESSION_MAX_AGE) || 1000 * 60 * 60 * 24 * 7, siteTitle: process.env.SITE_TITLE || 'Christmas Community', + shortTitle: process.env.SHORT_TITLE || 'Christmas', useCDN: yesNo.parse(process.env.USE_CDN || true), wishlist: require('./wishlist') }; diff --git a/index.js b/index.js index a280287..9daaf4d 100644 --- a/index.js +++ b/index.js @@ -68,6 +68,6 @@ app.use((req, res, next) => { }); app.set('view engine', 'pug'); -app.use('/', require('./routes')(db)); +app.use('/', require('./routes')({ db, config })); app.listen(config.port, () => logger.success('express', `Express server started on port ${config.port}!`)) diff --git a/routes/index.js b/routes/index.js index 903c1b3..acb95d4 100644 --- a/routes/index.js +++ b/routes/index.js @@ -2,7 +2,7 @@ const verifyAuth = require('../middlewares/verifyAuth'); const express = require('express'); const path = require('path'); -module.exports = (db) => { +module.exports = ({ db, config }) => { const router = express.Router(); router.use('/', express.static(path.join(__dirname, '../static'))); @@ -33,5 +33,7 @@ module.exports = (db) => { router.use('/admin-settings', require('./adminSettings')(db)); + router.use('/manifest.json', require('./manifest.json')({ config })) + return router; } \ No newline at end of file diff --git a/routes/manifest.json/index.js b/routes/manifest.json/index.js new file mode 100644 index 0000000..1223075 --- /dev/null +++ b/routes/manifest.json/index.js @@ -0,0 +1,25 @@ +const express = require('express'); + +module.exports = ({ config }) => { + const router = express.Router(); + + router.get('/', (req, res) => { + res.send({ + name: config.siteTitle, + short_name: config.shortTitle, + background_color: 'white', + description: 'Sleek Wishlist App', + theme_color: '#dc5878', + start_url: '/', + display: 'standalone', + icons: [ + { + sizes: '1280x1280', + src: '/img/logo.png' + } + ] + }) + }); + + return router; +}; \ No newline at end of file diff --git a/views/layout.pug b/views/layout.pug index 4e94754..1a942e9 100644 --- a/views/layout.pug +++ b/views/layout.pug @@ -2,6 +2,10 @@ doctype html html(lang='en') head meta(name='viewport', content='width=device-width, initial-scale=1') + + link(rel='manifest', href='/manifest.json') + link(rel='apple-touch-icon', href='/img/logo.png', sizes='1280x1280') + if title title #{config.siteTitle} - #{title} else