2019-03-04 07:02:28 -05:00
|
|
|
AuthorizationMiddleware = require('../Authorization/AuthorizationMiddleware')
|
2014-02-12 05:23:40 -05:00
|
|
|
AuthenticationController = require('../Authentication/AuthenticationController')
|
|
|
|
ProjectUploadController = require "./ProjectUploadController"
|
2019-03-04 07:02:28 -05:00
|
|
|
RateLimiterMiddleware = require('../Security/RateLimiterMiddleware')
|
2018-12-13 07:54:49 -05:00
|
|
|
Settings = require('settings-sharelatex')
|
2014-02-12 05:23:40 -05:00
|
|
|
|
|
|
|
module.exports =
|
2015-06-30 09:38:32 -04:00
|
|
|
apply: (webRouter, apiRouter) ->
|
|
|
|
webRouter.post '/project/new/upload',
|
2014-02-12 05:23:40 -05:00
|
|
|
AuthenticationController.requireLogin(),
|
2019-03-04 07:02:28 -05:00
|
|
|
RateLimiterMiddleware.rateLimit({
|
2019-01-22 06:23:15 -05:00
|
|
|
endpointName: "project-upload"
|
|
|
|
maxRequests: 20
|
|
|
|
timeInterval: 60
|
|
|
|
}),
|
2019-03-28 11:00:46 -04:00
|
|
|
ProjectUploadController.multerMiddleware,
|
2014-02-12 05:23:40 -05:00
|
|
|
ProjectUploadController.uploadProject
|
2015-12-01 08:08:49 -05:00
|
|
|
|
2015-06-30 09:38:32 -04:00
|
|
|
webRouter.post '/Project/:Project_id/upload',
|
2019-03-04 07:02:28 -05:00
|
|
|
RateLimiterMiddleware.rateLimit({
|
2015-12-01 08:08:49 -05:00
|
|
|
endpointName: "file-upload"
|
|
|
|
params: ["Project_id"]
|
2015-12-07 11:50:09 -05:00
|
|
|
maxRequests: 200
|
|
|
|
timeInterval: 60 * 30
|
2015-12-01 08:08:49 -05:00
|
|
|
}),
|
2016-03-21 09:23:14 -04:00
|
|
|
AuthenticationController.requireLogin(),
|
2019-03-04 07:02:28 -05:00
|
|
|
AuthorizationMiddleware.ensureUserCanWriteProjectContent,
|
2019-03-28 11:00:46 -04:00
|
|
|
ProjectUploadController.multerMiddleware,
|
2014-02-12 05:23:40 -05:00
|
|
|
ProjectUploadController.uploadFile
|