mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2024-12-15 00:46:22 +00:00
8ab77a6464
Removed version strings from _globals.njk, in favor of src/versions.json. That versions in that file can be bumped with "yarn bump-versions". v1 is automatically bumped when doing "yarn build" as well. Added README file in src directory, explaining versions.json file. Added README file in scripts directory, detailing usage of each scripts. Version strings will no longer be appended when cacheControl is disabled in config file. After all, version strings are only needed when the static assets are cached indefinitely in users' browsers. Initial Cloudflare's cache purging will no longer be executed when cloudflare -> purgeCache is disabled, even if cacheControl is enabled. Just in case someone wants to use version strings for other use cases. Actually use custom metaDesc variable on meta description tag.
26 lines
782 B
JavaScript
26 lines
782 B
JavaScript
const routes = require('express').Router()
|
|
const uploadController = require('./../controllers/uploadController')
|
|
const utils = require('./../controllers/utilsController')
|
|
const config = require('./../config')
|
|
|
|
routes.get('/nojs', async (req, res, next) => {
|
|
return res.render('nojs', { config, gitHash: utils.gitHash })
|
|
})
|
|
|
|
routes.post('/nojs', (req, res, next) => {
|
|
res._json = res.json
|
|
res.json = (...args) => {
|
|
const result = args[0]
|
|
return res.render('nojs', {
|
|
config,
|
|
versions: utils.versionStrings,
|
|
gitHash: utils.gitHash,
|
|
errorMessage: result.success ? '' : (result.description || 'An unexpected error occurred.'),
|
|
files: result.files || [{}]
|
|
})
|
|
}
|
|
return uploadController.upload(req, res, next)
|
|
})
|
|
|
|
module.exports = routes
|