2022-07-10 12:46:25 +00:00
|
|
|
const { Router } = require('hyper-express')
|
|
|
|
const routes = new Router()
|
2020-11-03 13:56:32 +00:00
|
|
|
const utils = require('./../controllers/utilsController')
|
2022-10-05 19:39:51 +00:00
|
|
|
const config = require('./../controllers/utils/ConfigManager')
|
2020-11-03 13:56:32 +00:00
|
|
|
|
2022-07-10 12:46:25 +00:00
|
|
|
const playerHandler = async (req, res) => {
|
2020-11-03 13:56:32 +00:00
|
|
|
// Uploads identifiers parsing, etc., are strictly handled by client-side JS at src/js/player.js
|
2022-07-25 00:40:00 +00:00
|
|
|
// Rendered page is persistently cached during production (its dynamic content is generated on client-side)
|
2020-11-03 13:56:32 +00:00
|
|
|
return res.render('player', {
|
2022-06-29 06:58:09 +00:00
|
|
|
config, utils, versions: utils.versionStrings
|
2022-07-25 00:40:00 +00:00
|
|
|
}, !utils.devmode)
|
2022-07-10 12:46:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
routes.get('/player/:identifier', playerHandler)
|
|
|
|
routes.get('/v/:identifier', playerHandler)
|
2020-11-03 13:56:32 +00:00
|
|
|
|
|
|
|
module.exports = routes
|