overleaf/services/web/app/coffee/Features/LinkedFiles/LinkedFilesRouter.coffee

29 lines
1 KiB
CoffeeScript
Raw Normal View History

AuthorizationMiddleware = require('../Authorization/AuthorizationMiddleware')
2018-02-14 10:12:46 -05:00
AuthenticationController = require('../Authentication/AuthenticationController')
RateLimiterMiddleware = require('../Security/RateLimiterMiddleware')
2018-02-14 10:12:46 -05:00
LinkedFilesController = require "./LinkedFilesController"
module.exports =
apply: (webRouter) ->
webRouter.post '/project/:project_id/linked_file',
AuthenticationController.requireLogin(),
AuthorizationMiddleware.ensureUserCanWriteProjectContent,
RateLimiterMiddleware.rateLimit({
endpointName: "create-linked-file"
params: ["project_id"]
maxRequests: 100
timeInterval: 60
}),
2018-02-14 10:12:46 -05:00
LinkedFilesController.createLinkedFile
webRouter.post '/project/:project_id/linked_file/:file_id/refresh',
AuthenticationController.requireLogin(),
AuthorizationMiddleware.ensureUserCanWriteProjectContent,
RateLimiterMiddleware.rateLimit({
endpointName: "refresh-linked-file"
params: ["project_id"]
maxRequests: 100
timeInterval: 60
}),
LinkedFilesController.refreshLinkedFile