overleaf/services/web/app/coffee/Features/Uploads/UploadsRouter.coffee
Ersun Warncke 362c1f64db Merge pull request #1252 from sharelatex/ew-collabratec-upload-fix-v1-proxy
upgrade to latest (forked) version of multer, proxy collabratec uploads

GitOrigin-RevId: 682caf12a81ee828e544a5e3903ea49bbd173fe0
2018-12-13 13:09:26 +00:00

30 lines
1 KiB
CoffeeScript

AuthorizationMiddlewear = require('../Authorization/AuthorizationMiddlewear')
AuthenticationController = require('../Authentication/AuthenticationController')
ProjectUploadController = require "./ProjectUploadController"
RateLimiterMiddlewear = require('../Security/RateLimiterMiddlewear')
Settings = require('settings-sharelatex')
multer = require('multer')
upload = multer(
dest: Settings.path.uploadFolder
limits: fileSize: Settings.maxUploadSize
)
module.exports =
apply: (webRouter, apiRouter) ->
webRouter.post '/project/new/upload',
AuthenticationController.requireLogin(),
upload.single('qqfile'),
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,
upload.single('qqfile'),
ProjectUploadController.uploadFile