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

22 lines
731 B
CoffeeScript
Raw Normal View History

2014-02-12 05:23:40 -05:00
SecurityManager = require('../../managers/SecurityManager')
AuthenticationController = require('../Authentication/AuthenticationController')
ProjectUploadController = require "./ProjectUploadController"
RateLimiterMiddlewear = require('../Security/RateLimiterMiddlewear')
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(),
ProjectUploadController.uploadProject
webRouter.post '/Project/:Project_id/upload',
RateLimiterMiddlewear.rateLimit({
endpointName: "file-upload"
params: ["Project_id"]
maxRequests: 100
timeInterval: 60 * 20
}),
2014-02-12 05:23:40 -05:00
SecurityManager.requestCanModifyProject,
ProjectUploadController.uploadFile