From 845ee51a67a226917bab300e2a4f0e5a983aac1c Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Wed, 5 Jul 2017 14:43:41 +0100 Subject: [PATCH] rename apiRouter -> privateApiRouter in router --- services/web/app/coffee/router.coffee | 58 +++++++++++++-------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/services/web/app/coffee/router.coffee b/services/web/app/coffee/router.coffee index 7658caaf0a..1a5535026e 100644 --- a/services/web/app/coffee/router.coffee +++ b/services/web/app/coffee/router.coffee @@ -49,7 +49,7 @@ logger = require("logger-sharelatex") _ = require("underscore") module.exports = class Router - constructor: (webRouter, apiRouter, publicApiRouter)-> + constructor: (webRouter, privateApiRouter, publicApiRouter)-> if !Settings.allowPublicAccess webRouter.all '*', AuthenticationController.requireGlobalLogin @@ -67,17 +67,17 @@ module.exports = class Router AuthenticationController.addEndpointToLoginWhitelist '/register' - EditorRouter.apply(webRouter, apiRouter) - CollaboratorsRouter.apply(webRouter, apiRouter) - SubscriptionRouter.apply(webRouter, apiRouter) - UploadsRouter.apply(webRouter, apiRouter) - PasswordResetRouter.apply(webRouter, apiRouter) - StaticPagesRouter.apply(webRouter, apiRouter) - RealTimeProxyRouter.apply(webRouter, apiRouter) - ContactRouter.apply(webRouter, apiRouter) - AnalyticsRouter.apply(webRouter, apiRouter) + EditorRouter.apply(webRouter, privateApiRouter) + CollaboratorsRouter.apply(webRouter, privateApiRouter) + SubscriptionRouter.apply(webRouter, privateApiRouter) + UploadsRouter.apply(webRouter, privateApiRouter) + PasswordResetRouter.apply(webRouter, privateApiRouter) + StaticPagesRouter.apply(webRouter, privateApiRouter) + RealTimeProxyRouter.apply(webRouter, privateApiRouter) + ContactRouter.apply(webRouter, privateApiRouter) + AnalyticsRouter.apply(webRouter, privateApiRouter) - Modules.applyRouter(webRouter, apiRouter, publicApiRouter) + Modules.applyRouter(webRouter, privateApiRouter, publicApiRouter) if Settings.enableSubscriptions @@ -106,7 +106,7 @@ module.exports = class Router webRouter.post '/user/delete', AuthenticationController.requireLogin(), UserController.tryDeleteUser webRouter.get '/user/personal_info', AuthenticationController.requireLogin(), UserInfoController.getLoggedInUsersPersonalInfo - apiRouter.get '/user/:user_id/personal_info', AuthenticationController.httpAuth, UserInfoController.getPersonalInfo + privateApiRouter.get '/user/:user_id/personal_info', AuthenticationController.httpAuth, UserInfoController.getPersonalInfo webRouter.get '/project', AuthenticationController.requireLogin(), ProjectController.projectListPage webRouter.post '/project/new', AuthenticationController.requireLogin(), ProjectController.newProject @@ -211,15 +211,15 @@ module.exports = class Router # Deprecated in favour of /internal/project/:project_id but still used by versioning - apiRouter.get '/project/:project_id/details', AuthenticationController.httpAuth, ProjectApiController.getProjectDetails + privateApiRouter.get '/project/:project_id/details', AuthenticationController.httpAuth, ProjectApiController.getProjectDetails # New 'stable' /internal API end points - apiRouter.get '/internal/project/:project_id', AuthenticationController.httpAuth, ProjectApiController.getProjectDetails - apiRouter.get '/internal/project/:Project_id/zip', AuthenticationController.httpAuth, ProjectDownloadsController.downloadProject - apiRouter.get '/internal/project/:project_id/compile/pdf', AuthenticationController.httpAuth, CompileController.compileAndDownloadPdf + privateApiRouter.get '/internal/project/:project_id', AuthenticationController.httpAuth, ProjectApiController.getProjectDetails + privateApiRouter.get '/internal/project/:Project_id/zip', AuthenticationController.httpAuth, ProjectDownloadsController.downloadProject + privateApiRouter.get '/internal/project/:project_id/compile/pdf', AuthenticationController.httpAuth, CompileController.compileAndDownloadPdf - apiRouter.post '/internal/deactivateOldProjects', AuthenticationController.httpAuth, InactiveProjectController.deactivateOldProjects - apiRouter.post '/internal/project/:project_id/deactivate', AuthenticationController.httpAuth, InactiveProjectController.deactivateProject + privateApiRouter.post '/internal/deactivateOldProjects', AuthenticationController.httpAuth, InactiveProjectController.deactivateOldProjects + privateApiRouter.post '/internal/project/:project_id/deactivate', AuthenticationController.httpAuth, InactiveProjectController.deactivateProject webRouter.get /^\/internal\/project\/([^\/]*)\/output\/(.*)$/, ((req, res, next) -> @@ -230,14 +230,14 @@ module.exports = class Router next() ), AuthenticationController.httpAuth, CompileController.getFileFromClsi - apiRouter.get '/project/:Project_id/doc/:doc_id', AuthenticationController.httpAuth, DocumentController.getDocument - apiRouter.post '/project/:Project_id/doc/:doc_id', AuthenticationController.httpAuth, DocumentController.setDocument + privateApiRouter.get '/project/:Project_id/doc/:doc_id', AuthenticationController.httpAuth, DocumentController.getDocument + privateApiRouter.post '/project/:Project_id/doc/:doc_id', AuthenticationController.httpAuth, DocumentController.setDocument - apiRouter.post '/user/:user_id/update/*', AuthenticationController.httpAuth, TpdsController.mergeUpdate - apiRouter.delete '/user/:user_id/update/*', AuthenticationController.httpAuth, TpdsController.deleteUpdate + privateApiRouter.post '/user/:user_id/update/*', AuthenticationController.httpAuth, TpdsController.mergeUpdate + privateApiRouter.delete '/user/:user_id/update/*', AuthenticationController.httpAuth, TpdsController.deleteUpdate - apiRouter.post '/project/:project_id/contents/*', AuthenticationController.httpAuth, TpdsController.updateProjectContents - apiRouter.delete '/project/:project_id/contents/*', AuthenticationController.httpAuth, TpdsController.deleteProjectContents + privateApiRouter.post '/project/:project_id/contents/*', AuthenticationController.httpAuth, TpdsController.updateProjectContents + privateApiRouter.delete '/project/:project_id/contents/*', AuthenticationController.httpAuth, TpdsController.deleteProjectContents webRouter.post "/spelling/check", AuthenticationController.requireLogin(), SpellingController.proxyRequestToSpellingApi webRouter.post "/spelling/learn", AuthenticationController.requireLogin(), SpellingController.proxyRequestToSpellingApi @@ -268,22 +268,22 @@ module.exports = class Router webRouter.post '/admin/messages', AuthorizationMiddlewear.ensureUserIsSiteAdmin, AdminController.createMessage webRouter.post '/admin/messages/clear', AuthorizationMiddlewear.ensureUserIsSiteAdmin, AdminController.clearMessages - apiRouter.get '/perfTest', (req,res)-> + privateApiRouter.get '/perfTest', (req,res)-> res.send("hello") webRouter.get '/status', (req,res)-> res.send("web sharelatex is alive (web)") - apiRouter.get '/status', (req,res)-> + privateApiRouter.get '/status', (req,res)-> res.send("web sharelatex is alive (api)") webRouter.get '/dev/csrf', (req, res) -> res.send res.locals.csrfToken webRouter.get '/health_check', HealthCheckController.check - apiRouter.get '/health_check', HealthCheckController.check + privateApiRouter.get '/health_check', HealthCheckController.check webRouter.get '/health_check/redis', HealthCheckController.checkRedis - apiRouter.get '/health_check/redis', HealthCheckController.checkRedis + privateApiRouter.get '/health_check/redis', HealthCheckController.checkRedis webRouter.get "/status/compiler/:Project_id", AuthorizationMiddlewear.ensureUserCanReadProject, (req, res) -> project_id = req.params.Project_id @@ -321,7 +321,7 @@ module.exports = class Router require("./models/Project").Project.findOne {}, () -> throw new Error("Test error") - apiRouter.get '/opps-small', (req, res, next)-> + privateApiRouter.get '/opps-small', (req, res, next)-> logger.err "test error occured" res.send()