overleaf/services/web/app/coffee/Features/Uploads/UploadsRouter.coffee
Simon Detheridge 385da07930 Merge pull request #1675 from sharelatex/spd-zip-file-limit-ui
Display more descriptive errors when uploading a project fails

GitOrigin-RevId: e206ca0d595f927ab141fb901644906f000160f8
2019-03-28 15:14:30 +00:00

29 lines
1 KiB
CoffeeScript

AuthorizationMiddleware = require('../Authorization/AuthorizationMiddleware')
AuthenticationController = require('../Authentication/AuthenticationController')
ProjectUploadController = require "./ProjectUploadController"
RateLimiterMiddleware = require('../Security/RateLimiterMiddleware')
Settings = require('settings-sharelatex')
module.exports =
apply: (webRouter, apiRouter) ->
webRouter.post '/project/new/upload',
AuthenticationController.requireLogin(),
RateLimiterMiddleware.rateLimit({
endpointName: "project-upload"
maxRequests: 20
timeInterval: 60
}),
ProjectUploadController.multerMiddleware,
ProjectUploadController.uploadProject
webRouter.post '/Project/:Project_id/upload',
RateLimiterMiddleware.rateLimit({
endpointName: "file-upload"
params: ["Project_id"]
maxRequests: 200
timeInterval: 60 * 30
}),
AuthenticationController.requireLogin(),
AuthorizationMiddleware.ensureUserCanWriteProjectContent,
ProjectUploadController.multerMiddleware,
ProjectUploadController.uploadFile