overleaf/services/web/app/coffee/Features/Uploads/UploadsRouter.coffee

30 lines
1 KiB
CoffeeScript
Raw Normal View History

AuthorizationMiddleware = require('../Authorization/AuthorizationMiddleware')
2014-02-12 05:23:40 -05:00
AuthenticationController = require('../Authentication/AuthenticationController')
ProjectUploadController = require "./ProjectUploadController"
RateLimiterMiddleware = require('../Security/RateLimiterMiddleware')
Settings = require('settings-sharelatex')
2014-02-12 05:23:40 -05:00
module.exports =
apply: (webRouter, apiRouter) ->
webRouter.post '/project/new/upload',
2014-02-12 05:23:40 -05:00
AuthenticationController.requireLogin(),
RateLimiterMiddleware.rateLimit({
endpointName: "project-upload"
maxRequests: 20
timeInterval: 60
}),
ProjectUploadController.multerMiddleware,
2014-02-12 05:23:40 -05:00
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,
2014-02-12 05:23:40 -05:00
ProjectUploadController.uploadFile