mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2025-01-18 17:21:33 +00:00
refactor: some routes init
this format is now fixed with hyper-express@6.4.5
This commit is contained in:
parent
aca4a02f53
commit
0e4f483506
@ -43,11 +43,14 @@ routes.post('/users/edit', [auth.requireUser, utils.assertJSON], auth.editUser)
|
||||
|
||||
/** ./controllers/uploadController.js */
|
||||
|
||||
// HyperExpress defaults to 250kb
|
||||
// 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('/upload', { max_body_length: maxBodyLength }, auth.optionalUser, upload.upload)
|
||||
routes.post('/upload/:albumid', { max_body_length: maxBodyLength }, auth.optionalUser, upload.upload)
|
||||
const uploadRouteOptions = {
|
||||
// HyperExpress defaults to 250kb
|
||||
// https://github.com/kartikk221/hyper-express/blob/6.4.5/docs/Server.md#server-constructor-options
|
||||
max_body_length: parseInt(config.uploads.maxSize) * 1e6,
|
||||
middlewares: [auth.optionalUser]
|
||||
}
|
||||
routes.post('/upload', uploadRouteOptions, upload.upload)
|
||||
routes.post('/upload/:albumid', uploadRouteOptions, upload.upload)
|
||||
routes.post('/upload/finishchunks', [auth.optionalUser, utils.assertJSON], upload.finishChunks)
|
||||
|
||||
routes.get('/uploads', auth.requireUser, upload.list)
|
||||
|
@ -12,10 +12,11 @@ routes.get('/nojs', async (req, res) => {
|
||||
})
|
||||
})
|
||||
|
||||
// HyperExpress defaults to 250kb
|
||||
// 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) => {
|
||||
routes.post('/nojs', {
|
||||
// HyperExpress defaults to 250kb
|
||||
// https://github.com/kartikk221/hyper-express/blob/6.4.4/docs/Server.md#server-constructor-options
|
||||
max_body_length: parseInt(config.uploads.maxSize) * 1e6
|
||||
}, async (req, res) => {
|
||||
res._json = res.json
|
||||
res.json = (...args) => {
|
||||
const result = args[0]
|
||||
|
Loading…
Reference in New Issue
Block a user