|
@@ -58,12 +58,10 @@ import SystemMessageController from './Features/SystemMessages/SystemMessageCont
|
|
|
import AnalyticsRegistrationSourceMiddleware from './Features/Analytics/AnalyticsRegistrationSourceMiddleware.js'
|
|
import AnalyticsRegistrationSourceMiddleware from './Features/Analytics/AnalyticsRegistrationSourceMiddleware.js'
|
|
|
import AnalyticsUTMTrackingMiddleware from './Features/Analytics/AnalyticsUTMTrackingMiddleware.mjs'
|
|
import AnalyticsUTMTrackingMiddleware from './Features/Analytics/AnalyticsUTMTrackingMiddleware.mjs'
|
|
|
import CaptchaMiddleware from './Features/Captcha/CaptchaMiddleware.mjs'
|
|
import CaptchaMiddleware from './Features/Captcha/CaptchaMiddleware.mjs'
|
|
|
-import { Joi, validate } from './infrastructure/Validation.js'
|
|
|
|
|
import UnsupportedBrowserMiddleware from './infrastructure/UnsupportedBrowserMiddleware.js'
|
|
import UnsupportedBrowserMiddleware from './infrastructure/UnsupportedBrowserMiddleware.js'
|
|
|
import logger from '@overleaf/logger'
|
|
import logger from '@overleaf/logger'
|
|
|
import _ from 'lodash'
|
|
import _ from 'lodash'
|
|
|
import { plainTextResponse } from './infrastructure/Response.js'
|
|
import { plainTextResponse } from './infrastructure/Response.js'
|
|
|
-import PublicAccessLevels from './Features/Authorization/PublicAccessLevels.js'
|
|
|
|
|
import SocketDiagnostics from './Features/SocketDiagnostics/SocketDiagnostics.mjs'
|
|
import SocketDiagnostics from './Features/SocketDiagnostics/SocketDiagnostics.mjs'
|
|
|
import ClsiCacheController from './Features/Compile/ClsiCacheController.mjs'
|
|
import ClsiCacheController from './Features/Compile/ClsiCacheController.mjs'
|
|
|
import AsyncLocalStorage from './infrastructure/AsyncLocalStorage.js'
|
|
import AsyncLocalStorage from './infrastructure/AsyncLocalStorage.js'
|
|
@@ -305,12 +303,6 @@ async function initialize(webRouter, privateApiRouter, publicApiRouter) {
|
|
|
webRouter.post(
|
|
webRouter.post(
|
|
|
'/user/settings',
|
|
'/user/settings',
|
|
|
AuthenticationController.requireLogin(),
|
|
AuthenticationController.requireLogin(),
|
|
|
- validate({
|
|
|
|
|
- body: Joi.object({
|
|
|
|
|
- first_name: Joi.string().allow(null, '').max(255),
|
|
|
|
|
- last_name: Joi.string().allow(null, '').max(255),
|
|
|
|
|
- }).unknown(),
|
|
|
|
|
- }),
|
|
|
|
|
UserController.updateUserSettings
|
|
UserController.updateUserSettings
|
|
|
)
|
|
)
|
|
|
webRouter.post(
|
|
webRouter.post(
|
|
@@ -565,13 +557,6 @@ async function initialize(webRouter, privateApiRouter, publicApiRouter) {
|
|
|
)
|
|
)
|
|
|
webRouter.post(
|
|
webRouter.post(
|
|
|
'/project/:Project_id/settings',
|
|
'/project/:Project_id/settings',
|
|
|
- validate({
|
|
|
|
|
- body: Joi.object({
|
|
|
|
|
- publicAccessLevel: Joi.string()
|
|
|
|
|
- .valid(PublicAccessLevels.PRIVATE, PublicAccessLevels.TOKEN_BASED)
|
|
|
|
|
- .optional(),
|
|
|
|
|
- }),
|
|
|
|
|
- }),
|
|
|
|
|
AuthorizationMiddleware.ensureUserCanWriteProjectSettings,
|
|
AuthorizationMiddleware.ensureUserCanWriteProjectSettings,
|
|
|
ProjectController.updateProjectSettings
|
|
ProjectController.updateProjectSettings
|
|
|
)
|
|
)
|
|
@@ -659,7 +644,6 @@ async function initialize(webRouter, privateApiRouter, publicApiRouter) {
|
|
|
|
|
|
|
|
webRouter.delete(
|
|
webRouter.delete(
|
|
|
'/project/:Project_id/output',
|
|
'/project/:Project_id/output',
|
|
|
- validate({ query: { clsiserverid: Joi.string() } }),
|
|
|
|
|
AuthorizationMiddleware.ensureUserCanReadProject,
|
|
AuthorizationMiddleware.ensureUserCanReadProject,
|
|
|
CompileController.deleteAuxFiles
|
|
CompileController.deleteAuxFiles
|
|
|
)
|
|
)
|
|
@@ -675,7 +659,6 @@ async function initialize(webRouter, privateApiRouter, publicApiRouter) {
|
|
|
)
|
|
)
|
|
|
webRouter.get(
|
|
webRouter.get(
|
|
|
'/project/:Project_id/wordcount',
|
|
'/project/:Project_id/wordcount',
|
|
|
- validate({ query: { clsiserverid: Joi.string() } }),
|
|
|
|
|
AuthorizationMiddleware.ensureUserCanReadProject,
|
|
AuthorizationMiddleware.ensureUserCanReadProject,
|
|
|
CompileController.wordCount
|
|
CompileController.wordCount
|
|
|
)
|
|
)
|
|
@@ -817,35 +800,18 @@ async function initialize(webRouter, privateApiRouter, publicApiRouter) {
|
|
|
'/tag',
|
|
'/tag',
|
|
|
AuthenticationController.requireLogin(),
|
|
AuthenticationController.requireLogin(),
|
|
|
RateLimiterMiddleware.rateLimit(rateLimiters.createTag),
|
|
RateLimiterMiddleware.rateLimit(rateLimiters.createTag),
|
|
|
- validate({
|
|
|
|
|
- body: Joi.object({
|
|
|
|
|
- name: Joi.string().required(),
|
|
|
|
|
- color: Joi.string(),
|
|
|
|
|
- }),
|
|
|
|
|
- }),
|
|
|
|
|
TagsController.createTag
|
|
TagsController.createTag
|
|
|
)
|
|
)
|
|
|
webRouter.post(
|
|
webRouter.post(
|
|
|
'/tag/:tagId/rename',
|
|
'/tag/:tagId/rename',
|
|
|
AuthenticationController.requireLogin(),
|
|
AuthenticationController.requireLogin(),
|
|
|
RateLimiterMiddleware.rateLimit(rateLimiters.renameTag),
|
|
RateLimiterMiddleware.rateLimit(rateLimiters.renameTag),
|
|
|
- validate({
|
|
|
|
|
- body: Joi.object({
|
|
|
|
|
- name: Joi.string().required(),
|
|
|
|
|
- }),
|
|
|
|
|
- }),
|
|
|
|
|
TagsController.renameTag
|
|
TagsController.renameTag
|
|
|
)
|
|
)
|
|
|
webRouter.post(
|
|
webRouter.post(
|
|
|
'/tag/:tagId/edit',
|
|
'/tag/:tagId/edit',
|
|
|
AuthenticationController.requireLogin(),
|
|
AuthenticationController.requireLogin(),
|
|
|
RateLimiterMiddleware.rateLimit(rateLimiters.renameTag),
|
|
RateLimiterMiddleware.rateLimit(rateLimiters.renameTag),
|
|
|
- validate({
|
|
|
|
|
- body: Joi.object({
|
|
|
|
|
- name: Joi.string().required(),
|
|
|
|
|
- color: Joi.string(),
|
|
|
|
|
- }),
|
|
|
|
|
- }),
|
|
|
|
|
TagsController.editTag
|
|
TagsController.editTag
|
|
|
)
|
|
)
|
|
|
webRouter.delete(
|
|
webRouter.delete(
|
|
@@ -864,11 +830,6 @@ async function initialize(webRouter, privateApiRouter, publicApiRouter) {
|
|
|
'/tag/:tagId/projects',
|
|
'/tag/:tagId/projects',
|
|
|
AuthenticationController.requireLogin(),
|
|
AuthenticationController.requireLogin(),
|
|
|
RateLimiterMiddleware.rateLimit(rateLimiters.addProjectsToTag),
|
|
RateLimiterMiddleware.rateLimit(rateLimiters.addProjectsToTag),
|
|
|
- validate({
|
|
|
|
|
- body: Joi.object({
|
|
|
|
|
- projectIds: Joi.array().items(Joi.string()).required(),
|
|
|
|
|
- }),
|
|
|
|
|
- }),
|
|
|
|
|
TagsController.addProjectsToTag
|
|
TagsController.addProjectsToTag
|
|
|
)
|
|
)
|
|
|
webRouter.delete(
|
|
webRouter.delete(
|
|
@@ -881,11 +842,6 @@ async function initialize(webRouter, privateApiRouter, publicApiRouter) {
|
|
|
'/tag/:tagId/projects/remove',
|
|
'/tag/:tagId/projects/remove',
|
|
|
AuthenticationController.requireLogin(),
|
|
AuthenticationController.requireLogin(),
|
|
|
RateLimiterMiddleware.rateLimit(rateLimiters.removeProjectsFromTag),
|
|
RateLimiterMiddleware.rateLimit(rateLimiters.removeProjectsFromTag),
|
|
|
- validate({
|
|
|
|
|
- body: Joi.object({
|
|
|
|
|
- projectIds: Joi.array().items(Joi.string()).required(),
|
|
|
|
|
- }),
|
|
|
|
|
- }),
|
|
|
|
|
TagsController.removeProjectsFromTag
|
|
TagsController.removeProjectsFromTag
|
|
|
)
|
|
)
|
|
|
|
|
|
|
@@ -996,22 +952,12 @@ async function initialize(webRouter, privateApiRouter, publicApiRouter) {
|
|
|
|
|
|
|
|
webRouter.post(
|
|
webRouter.post(
|
|
|
'/spelling/learn',
|
|
'/spelling/learn',
|
|
|
- validate({
|
|
|
|
|
- body: Joi.object({
|
|
|
|
|
- word: Joi.string().required(),
|
|
|
|
|
- }),
|
|
|
|
|
- }),
|
|
|
|
|
AuthenticationController.requireLogin(),
|
|
AuthenticationController.requireLogin(),
|
|
|
SpellingController.learn
|
|
SpellingController.learn
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
webRouter.post(
|
|
webRouter.post(
|
|
|
'/spelling/unlearn',
|
|
'/spelling/unlearn',
|
|
|
- validate({
|
|
|
|
|
- body: Joi.object({
|
|
|
|
|
- word: Joi.string().required(),
|
|
|
|
|
- }),
|
|
|
|
|
- }),
|
|
|
|
|
AuthenticationController.requireLogin(),
|
|
AuthenticationController.requireLogin(),
|
|
|
SpellingController.unlearn
|
|
SpellingController.unlearn
|
|
|
)
|
|
)
|