Merge pull request #5838 from overleaf/jpa-fix-load-editor-metrics

[web] fix the http-request metric options for loading the editor

GitOrigin-RevId: 8c87ebd5be77a918b719ddd061b4758efb277a90
This commit is contained in:
Jakob Ackermann 2021-11-19 12:08:57 +01:00 committed by Copybot
parent 2261e761f4
commit 44b3fece89

View file

@ -294,18 +294,25 @@ function initialize(webRouter, privateApiRouter, publicApiRouter) {
ProjectController.newProject
)
webRouter.get(
'/Project/:Project_id/:detachRole(detacher|detached)?',
RateLimiterMiddleware.rateLimit({
endpointName: 'open-project',
params: ['Project_id'],
maxRequests: 15,
timeInterval: 60,
}),
AuthenticationController.validateUserSession(),
AuthorizationMiddleware.ensureUserCanReadProject,
ProjectController.loadEditor
)
for (const route of [
// Keep the old route for continuous metrics
'/Project/:Project_id',
// New route for pdf-detach
'/Project/:Project_id/:detachRole(detacher|detached)',
]) {
webRouter.get(
route,
RateLimiterMiddleware.rateLimit({
endpointName: 'open-project',
params: ['Project_id'],
maxRequests: 15,
timeInterval: 60,
}),
AuthenticationController.validateUserSession(),
AuthorizationMiddleware.ensureUserCanReadProject,
ProjectController.loadEditor
)
}
webRouter.head(
'/Project/:Project_id/file/:File_id',
AuthorizationMiddleware.ensureUserCanReadProject,