2016-03-10 17:17:26 +00:00
|
|
|
AuthorizationMiddlewear = require('../Authorization/AuthorizationMiddlewear')
|
2014-02-12 10:23:40 +00:00
|
|
|
AuthenticationController = require('../Authentication/AuthenticationController')
|
|
|
|
ProjectUploadController = require "./ProjectUploadController"
|
2015-12-01 13:08:49 +00:00
|
|
|
RateLimiterMiddlewear = require('../Security/RateLimiterMiddlewear')
|
2014-02-12 10:23:40 +00:00
|
|
|
|
|
|
|
module.exports =
|
2015-06-30 13:38:32 +00:00
|
|
|
apply: (webRouter, apiRouter) ->
|
|
|
|
webRouter.post '/project/new/upload',
|
2014-02-12 10:23:40 +00:00
|
|
|
AuthenticationController.requireLogin(),
|
|
|
|
ProjectUploadController.uploadProject
|
2015-12-01 13:08:49 +00:00
|
|
|
|
2015-06-30 13:38:32 +00:00
|
|
|
webRouter.post '/Project/:Project_id/upload',
|
2015-12-01 13:08:49 +00:00
|
|
|
RateLimiterMiddlewear.rateLimit({
|
|
|
|
endpointName: "file-upload"
|
|
|
|
params: ["Project_id"]
|
2015-12-07 16:50:09 +00:00
|
|
|
maxRequests: 200
|
|
|
|
timeInterval: 60 * 30
|
2015-12-01 13:08:49 +00:00
|
|
|
}),
|
2016-03-21 13:23:14 +00:00
|
|
|
AuthenticationController.requireLogin(),
|
2016-03-10 17:17:26 +00:00
|
|
|
AuthorizationMiddlewear.ensureUserCanWriteProjectContent,
|
2014-02-12 10:23:40 +00:00
|
|
|
ProjectUploadController.uploadFile
|
|
|
|
|