mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2025-01-18 17:21:33 +00:00
chore: routes/nojs.js
This commit is contained in:
parent
0d05da40b0
commit
19eac1d98a
@ -5,10 +5,10 @@ const utils = require('./../controllers/utilsController')
|
||||
const config = require('./../config')
|
||||
|
||||
routes.get('/nojs', async (req, res) => {
|
||||
// TODO: Update res.render() to allow bypassing cache on demand,
|
||||
// so that this GET route can instead re-use persistent cache
|
||||
return res.render('nojs', {
|
||||
config,
|
||||
utils,
|
||||
versions: utils.versionStrings
|
||||
config, utils, versions: utils.versionStrings
|
||||
})
|
||||
})
|
||||
|
||||
@ -16,6 +16,8 @@ routes.get('/nojs', async (req, res) => {
|
||||
// https://github.com/kartikk221/hyper-express/blob/6.4.4/docs/Server.md#server-constructor-options
|
||||
const maxBodyLength = parseInt(config.uploads.maxSize) * 1e6
|
||||
routes.post('/nojs', { max_body_length: maxBodyLength }, async (req, res) => {
|
||||
// Map built-in Response.json() function into Response.render() accordingly
|
||||
// Since NoJS uploader needs to reply with a complete HTML page
|
||||
res._json = res.json
|
||||
res.json = (...args) => {
|
||||
const result = args[0]
|
||||
|
Loading…
Reference in New Issue
Block a user