diff options
Diffstat (limited to 'routes')
-rw-r--r-- | routes/index.js | 12 | ||||
-rw-r--r-- | routes/manifest.js | 19 |
2 files changed, 28 insertions, 3 deletions
diff --git a/routes/index.js b/routes/index.js index 1ab2ba3..a65ac69 100644 --- a/routes/index.js +++ b/routes/index.js @@ -5,15 +5,21 @@ const router = express.Router() const users = require('../lib/getUserIndex') /* GET home page. */ -router.get('/', function (req, res, next) { +router.get(['/', '/s/*', '/t/*', '/r/*', '/c/*'], function (req, res, next) { + const isBeta = process.env.BETA === '1' + let flags = [] - if (req.query.nfd != null) { + if (isBeta) { + flags.push('BETA') + flags.push('NO_FEATURE_DETECT') + } else if (req.query.nfd != null) { flags.push('NO_FEATURE_DETECT') } const flagsStr = `var FLAGS = ${JSON.stringify(flags)};` const usersStr = `var USERS = ${JSON.stringify(users.users)};` - res.render('index', { flagsStr, usersStr }) + + res.render('index', { flagsStr, usersStr, isBeta }) }) module.exports = router diff --git a/routes/manifest.js b/routes/manifest.js new file mode 100644 index 0000000..b2ce55f --- /dev/null +++ b/routes/manifest.js @@ -0,0 +1,19 @@ +'use strict' + +const express = require('express') +const router = express.Router() +const path = require('path') + +router.get('/', function (req, res, next) { + console.log('got a request') + + const isBeta = process.env.BETA === '1' + + if (isBeta) { + res.sendFile('manifest.beta.webmanifest', { root: path.join(__dirname, '../public') }) + } else { + res.sendFile('manifest.webmanifest', { root: path.join(__dirname, '../public') }) + } +}) + +module.exports = router |