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

23 lines
810 B
CoffeeScript
Raw Normal View History

AuthorizationMiddlewear = require('../Authorization/AuthorizationMiddlewear')
2014-02-12 10:23:40 +00:00
AuthenticationController = require('../Authentication/AuthenticationController')
ProjectUploadController = require "./ProjectUploadController"
RateLimiterMiddlewear = require('../Security/RateLimiterMiddlewear')
2014-02-12 10:23:40 +00:00
module.exports =
apply: (webRouter, apiRouter) ->
webRouter.post '/project/new/upload',
2014-02-12 10:23:40 +00:00
AuthenticationController.requireLogin(),
ProjectUploadController.uploadProject
webRouter.post '/Project/:Project_id/upload',
RateLimiterMiddlewear.rateLimit({
endpointName: "file-upload"
params: ["Project_id"]
maxRequests: 200
timeInterval: 60 * 30
}),
AuthenticationController.requireLogin(),
AuthorizationMiddlewear.ensureUserCanWriteProjectContent,
2014-02-12 10:23:40 +00:00
ProjectUploadController.uploadFile