mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2025-01-19 01:31:34 +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 */
|
/** ./controllers/uploadController.js */
|
||||||
|
|
||||||
// HyperExpress defaults to 250kb
|
const uploadRouteOptions = {
|
||||||
// https://github.com/kartikk221/hyper-express/blob/6.4.4/docs/Server.md#server-constructor-options
|
// HyperExpress defaults to 250kb
|
||||||
const maxBodyLength = parseInt(config.uploads.maxSize) * 1e6
|
// https://github.com/kartikk221/hyper-express/blob/6.4.5/docs/Server.md#server-constructor-options
|
||||||
routes.post('/upload', { max_body_length: maxBodyLength }, auth.optionalUser, upload.upload)
|
max_body_length: parseInt(config.uploads.maxSize) * 1e6,
|
||||||
routes.post('/upload/:albumid', { max_body_length: maxBodyLength }, auth.optionalUser, upload.upload)
|
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.post('/upload/finishchunks', [auth.optionalUser, utils.assertJSON], upload.finishChunks)
|
||||||
|
|
||||||
routes.get('/uploads', auth.requireUser, upload.list)
|
routes.get('/uploads', auth.requireUser, upload.list)
|
||||||
|
@ -12,10 +12,11 @@ routes.get('/nojs', async (req, res) => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
// HyperExpress defaults to 250kb
|
routes.post('/nojs', {
|
||||||
// https://github.com/kartikk221/hyper-express/blob/6.4.4/docs/Server.md#server-constructor-options
|
// HyperExpress defaults to 250kb
|
||||||
const maxBodyLength = parseInt(config.uploads.maxSize) * 1e6
|
// https://github.com/kartikk221/hyper-express/blob/6.4.4/docs/Server.md#server-constructor-options
|
||||||
routes.post('/nojs', { max_body_length: maxBodyLength }, async (req, res) => {
|
max_body_length: parseInt(config.uploads.maxSize) * 1e6
|
||||||
|
}, async (req, res) => {
|
||||||
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