mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2025-01-19 01:31:34 +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')
|
const config = require('./../config')
|
||||||
|
|
||||||
routes.get('/nojs', async (req, res) => {
|
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', {
|
return res.render('nojs', {
|
||||||
config,
|
config, utils, versions: utils.versionStrings
|
||||||
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
|
// https://github.com/kartikk221/hyper-express/blob/6.4.4/docs/Server.md#server-constructor-options
|
||||||
const maxBodyLength = parseInt(config.uploads.maxSize) * 1e6
|
const maxBodyLength = parseInt(config.uploads.maxSize) * 1e6
|
||||||
routes.post('/nojs', { max_body_length: maxBodyLength }, async (req, res) => {
|
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 = res.json
|
||||||
res.json = (...args) => {
|
res.json = (...args) => {
|
||||||
const result = args[0]
|
const result = args[0]
|
||||||
|
Loading…
Reference in New Issue
Block a user