mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-02 05:41:33 +02:00
Rename files
GitOrigin-RevId: 73ecf16aa08d0677661249f09d7be15214d15982
This commit is contained in:
@@ -7,12 +7,12 @@ import Settings from '@overleaf/settings'
|
||||
import logger from '@overleaf/logger'
|
||||
import PlansLocator from './app/src/Features/Subscription/PlansLocator.js'
|
||||
import HistoryManager from './app/src/Features/History/HistoryManager.js'
|
||||
import SiteAdminHandler from './app/src/infrastructure/SiteAdminHandler.js'
|
||||
import SiteAdminHandler from './app/src/infrastructure/SiteAdminHandler.mjs'
|
||||
import http from 'node:http'
|
||||
import https from 'node:https'
|
||||
import * as Serializers from './app/src/infrastructure/LoggerSerializers.js'
|
||||
import * as Serializers from './app/src/infrastructure/LoggerSerializers.mjs'
|
||||
import Server from './app/src/infrastructure/Server.mjs'
|
||||
import QueueWorkers from './app/src/infrastructure/QueueWorkers.js'
|
||||
import QueueWorkers from './app/src/infrastructure/QueueWorkers.mjs'
|
||||
import mongodb from './app/src/infrastructure/mongodb.js'
|
||||
import mongoose from './app/src/infrastructure/Mongoose.js'
|
||||
import { triggerGracefulShutdown } from './app/src/infrastructure/GracefulShutdown.js'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import metrics from '@overleaf/metrics'
|
||||
import AnalyticsManager from './AnalyticsManager.js'
|
||||
import SessionManager from '../Authentication/SessionManager.js'
|
||||
import GeoIpLookup from '../../infrastructure/GeoIpLookup.js'
|
||||
import GeoIpLookup from '../../infrastructure/GeoIpLookup.mjs'
|
||||
import Features from '../../infrastructure/Features.js'
|
||||
import { expressify } from '@overleaf/promise-utils'
|
||||
import AccountMappingHelper from './AccountMappingHelper.js'
|
||||
|
||||
@@ -22,7 +22,7 @@ import { User } from '../../models/User.js'
|
||||
import UserPrimaryEmailCheckHandler from '../User/UserPrimaryEmailCheckHandler.js'
|
||||
import UserController from '../User/UserController.mjs'
|
||||
import NotificationsBuilder from '../Notifications/NotificationsBuilder.js'
|
||||
import GeoIpLookup from '../../infrastructure/GeoIpLookup.js'
|
||||
import GeoIpLookup from '../../infrastructure/GeoIpLookup.mjs'
|
||||
import SplitTestHandler from '../SplitTests/SplitTestHandler.js'
|
||||
import SplitTestSessionHandler from '../SplitTests/SplitTestSessionHandler.js'
|
||||
import TutorialHandler from '../Tutorial/TutorialHandler.mjs'
|
||||
|
||||
@@ -8,7 +8,7 @@ import LimitationsManager from './LimitationsManager.js'
|
||||
import RecurlyWrapper from './RecurlyWrapper.js'
|
||||
import Settings from '@overleaf/settings'
|
||||
import logger from '@overleaf/logger'
|
||||
import GeoIpLookup from '../../infrastructure/GeoIpLookup.js'
|
||||
import GeoIpLookup from '../../infrastructure/GeoIpLookup.mjs'
|
||||
import FeaturesUpdater from './FeaturesUpdater.js'
|
||||
import GroupPlansData from './GroupPlansData.js'
|
||||
import V1SubscriptionManager from './V1SubscriptionManager.js'
|
||||
@@ -31,7 +31,7 @@ import PlansLocator from './PlansLocator.js'
|
||||
import { User } from '../../models/User.js'
|
||||
import UserGetter from '../User/UserGetter.js'
|
||||
import PermissionsManager from '../Authorization/PermissionsManager.mjs'
|
||||
import { sanitizeSessionUserForFrontEnd } from '../../infrastructure/FrontEndUser.js'
|
||||
import { sanitizeSessionUserForFrontEnd } from '../../infrastructure/FrontEndUser.mjs'
|
||||
import { z, validateReq } from '../../infrastructure/Validation.js'
|
||||
import { IndeterminateInvoiceError } from '../Errors/Errors.js'
|
||||
import SubscriptionLocator from './SubscriptionLocator.js'
|
||||
|
||||
@@ -15,7 +15,7 @@ import EmailHandler from '../Email/EmailHandler.js'
|
||||
import { RateLimiter } from '../../infrastructure/RateLimiter.js'
|
||||
import Modules from '../../infrastructure/Modules.js'
|
||||
import UserAuditLogHandler from '../User/UserAuditLogHandler.js'
|
||||
import { sanitizeSessionUserForFrontEnd } from '../../infrastructure/FrontEndUser.js'
|
||||
import { sanitizeSessionUserForFrontEnd } from '../../infrastructure/FrontEndUser.mjs'
|
||||
|
||||
const rateLimiters = {
|
||||
resendGroupInvite: new RateLimiter('resend-group-invite', {
|
||||
|
||||
@@ -3,26 +3,26 @@ import Settings from '@overleaf/settings'
|
||||
import logger from '@overleaf/logger'
|
||||
import metrics from '@overleaf/metrics'
|
||||
import Validation from './Validation.js'
|
||||
import csp from './CSP.js'
|
||||
import csp from './CSP.mjs'
|
||||
import Router from '../router.mjs'
|
||||
import helmet from 'helmet'
|
||||
import UserSessionsRedis from '../Features/User/UserSessionsRedis.js'
|
||||
import Csrf from './Csrf.js'
|
||||
import Csrf from './Csrf.mjs'
|
||||
import HttpPermissionsPolicyMiddleware from './HttpPermissionsPolicy.js'
|
||||
import SessionAutostartMiddleware from './SessionAutostartMiddleware.js'
|
||||
import SessionAutostartMiddleware from './SessionAutostartMiddleware.mjs'
|
||||
import AnalyticsManager from '../Features/Analytics/AnalyticsManager.js'
|
||||
import session from 'express-session'
|
||||
import CookieMetrics from './CookieMetrics.js'
|
||||
import CustomSessionStore from './CustomSessionStore.js'
|
||||
import bodyParser from './BodyParserWrapper.js'
|
||||
import CookieMetrics from './CookieMetrics.mjs'
|
||||
import CustomSessionStore from './CustomSessionStore.mjs'
|
||||
import bodyParser from './BodyParserWrapper.mjs'
|
||||
import methodOverride from 'method-override'
|
||||
import cookieParser from 'cookie-parser'
|
||||
import bearerTokenMiddleware from 'express-bearer-token'
|
||||
import passport from 'passport'
|
||||
import { Strategy as LocalStrategy } from 'passport-local'
|
||||
import ReferalConnect from '../Features/Referal/ReferalConnect.mjs'
|
||||
import RedirectManager from './RedirectManager.js'
|
||||
import translations from './Translations.js'
|
||||
import RedirectManager from './RedirectManager.mjs'
|
||||
import translations from './Translations.mjs'
|
||||
import Views from './Views.js'
|
||||
import Features from './Features.js'
|
||||
import ErrorController from '../Features/Errors/ErrorController.mjs'
|
||||
@@ -32,7 +32,7 @@ import AuthenticationController from '../Features/Authentication/AuthenticationC
|
||||
import SessionManager from '../Features/Authentication/SessionManager.js'
|
||||
import { hasAdminAccess } from '../Features/Helpers/AdminAuthorizationHelper.js'
|
||||
import Modules from './Modules.js'
|
||||
import expressLocals from './ExpressLocals.js'
|
||||
import expressLocals from './ExpressLocals.mjs'
|
||||
import noCache from 'nocache'
|
||||
import os from 'node:os'
|
||||
import http from 'node:http'
|
||||
|
||||
@@ -58,7 +58,7 @@ import SystemMessageController from './Features/SystemMessages/SystemMessageCont
|
||||
import AnalyticsRegistrationSourceMiddleware from './Features/Analytics/AnalyticsRegistrationSourceMiddleware.mjs'
|
||||
import AnalyticsUTMTrackingMiddleware from './Features/Analytics/AnalyticsUTMTrackingMiddleware.mjs'
|
||||
import CaptchaMiddleware from './Features/Captcha/CaptchaMiddleware.mjs'
|
||||
import UnsupportedBrowserMiddleware from './infrastructure/UnsupportedBrowserMiddleware.js'
|
||||
import UnsupportedBrowserMiddleware from './infrastructure/UnsupportedBrowserMiddleware.mjs'
|
||||
import logger from '@overleaf/logger'
|
||||
import _ from 'lodash'
|
||||
import { plainTextResponse } from './infrastructure/Response.js'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import App from '../../../../app.mjs'
|
||||
import QueueWorkers from '../../../../app/src/infrastructure/QueueWorkers.js'
|
||||
import QueueWorkers from '../../../../app/src/infrastructure/QueueWorkers.mjs'
|
||||
import MongoHelper from './MongoHelper.mjs'
|
||||
import RedisHelper from './RedisHelper.mjs'
|
||||
import Settings from '@overleaf/settings'
|
||||
|
||||
@@ -37,7 +37,7 @@ describe('AnalyticsController', function () {
|
||||
default: ctx.Features,
|
||||
}))
|
||||
|
||||
vi.doMock('../../../../app/src/infrastructure/GeoIpLookup.js', () => ({
|
||||
vi.doMock('../../../../app/src/infrastructure/GeoIpLookup.mjs', () => ({
|
||||
default: (ctx.GeoIpLookup = {
|
||||
promises: {
|
||||
getDetails: sinon.stub().resolves(),
|
||||
|
||||
+23
-24
@@ -1,26 +1,25 @@
|
||||
const sinon = require('sinon')
|
||||
const { expect } = require('chai')
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import sinon from 'sinon'
|
||||
const modulePath =
|
||||
'../../../../app/src/infrastructure/SessionAutostartMiddleware.js'
|
||||
const SandboxedModule = require('sandboxed-module')
|
||||
'../../../../app/src/infrastructure/SessionAutostartMiddleware.mjs'
|
||||
|
||||
describe('SessionAutostartMiddleware', function () {
|
||||
describe('SessionAutostartMiddleware', () => {
|
||||
let SessionAutostartMiddleware, middleware, Settings
|
||||
const cookieName = 'coookieee'
|
||||
const excludedRoute = '/wombat/potato'
|
||||
const excludedMethod = 'POST'
|
||||
const excludedCallback = () => 'call me'
|
||||
|
||||
beforeEach(function () {
|
||||
beforeEach(async () => {
|
||||
Settings = {
|
||||
cookieName,
|
||||
}
|
||||
|
||||
SessionAutostartMiddleware = SandboxedModule.require(modulePath, {
|
||||
requires: {
|
||||
'@overleaf/settings': Settings,
|
||||
},
|
||||
})
|
||||
vi.doMock('@overleaf/settings', () => ({
|
||||
default: Settings,
|
||||
}))
|
||||
|
||||
SessionAutostartMiddleware = (await import(modulePath)).default
|
||||
|
||||
middleware = new SessionAutostartMiddleware()
|
||||
middleware.disableSessionAutostartForRoute(
|
||||
@@ -30,10 +29,10 @@ describe('SessionAutostartMiddleware', function () {
|
||||
)
|
||||
})
|
||||
|
||||
describe('middleware', function () {
|
||||
describe('middleware', () => {
|
||||
let req, next
|
||||
|
||||
beforeEach(function () {
|
||||
beforeEach(() => {
|
||||
req = {
|
||||
path: excludedRoute,
|
||||
method: excludedMethod,
|
||||
@@ -43,46 +42,46 @@ describe('SessionAutostartMiddleware', function () {
|
||||
next = sinon.stub()
|
||||
})
|
||||
|
||||
it('executes the callback for the excluded route', function () {
|
||||
it('executes the callback for the excluded route', () => {
|
||||
middleware.middleware(req, {}, next)
|
||||
expect(req.session.noSessionCallback).to.equal(excludedCallback)
|
||||
})
|
||||
|
||||
it('does not execute the callback for the excluded route with ?autostartSession=true set', function () {
|
||||
it('does not execute the callback for the excluded route with ?autostartSession=true set', () => {
|
||||
req.query = { autostartSession: 'true' }
|
||||
middleware.middleware(req, {}, next)
|
||||
expect(req.session).not.to.exist
|
||||
})
|
||||
|
||||
it('does not execute the callback if the method is not excluded', function () {
|
||||
it('does not execute the callback if the method is not excluded', () => {
|
||||
req.method = 'GET'
|
||||
middleware.middleware(req, {}, next)
|
||||
expect(req.session).not.to.exist
|
||||
})
|
||||
|
||||
it('does not execute the callback if the method is not excluded and ?autostartSession=true is set', function () {
|
||||
it('does not execute the callback if the method is not excluded and ?autostartSession=true is set', () => {
|
||||
req.method = 'GET'
|
||||
req.query = { autostartSession: 'true' }
|
||||
middleware.middleware(req, {}, next)
|
||||
expect(req.session).not.to.exist
|
||||
})
|
||||
|
||||
it('does not execute the callback if the path is not excluded', function () {
|
||||
it('does not execute the callback if the path is not excluded', () => {
|
||||
req.path = '/giraffe'
|
||||
middleware.middleware(req, {}, next)
|
||||
expect(req.session).not.to.exist
|
||||
})
|
||||
|
||||
it('does not execute the callback if there is a cookie', function () {
|
||||
it('does not execute the callback if there is a cookie', () => {
|
||||
req.signedCookies[cookieName] = 'a very useful session cookie'
|
||||
middleware.middleware(req, {}, next)
|
||||
expect(req.session).not.to.exist
|
||||
})
|
||||
})
|
||||
describe('bot middlewear', function () {
|
||||
describe('bot middlewear', () => {
|
||||
let req, next
|
||||
|
||||
beforeEach(function () {
|
||||
beforeEach(() => {
|
||||
req = {
|
||||
signedCookies: {},
|
||||
headers: {},
|
||||
@@ -90,19 +89,19 @@ describe('SessionAutostartMiddleware', function () {
|
||||
next = sinon.stub()
|
||||
})
|
||||
|
||||
it('GoogleHC user agent should have an empty session', function () {
|
||||
it('GoogleHC user agent should have an empty session', () => {
|
||||
req.headers['user-agent'] = 'GoogleHC'
|
||||
middleware.middleware(req, {}, next)
|
||||
expect(req.session.noSessionCallback).to.deep.exist
|
||||
})
|
||||
|
||||
it('should not add empty session with a firefox useragent', function () {
|
||||
it('should not add empty session with a firefox useragent', () => {
|
||||
req.headers['user-agent'] = 'firefox'
|
||||
middleware.middleware(req, {}, next)
|
||||
expect(req.session).not.to.exist
|
||||
})
|
||||
|
||||
it('should not add empty session with a empty useragent', function () {
|
||||
it('should not add empty session with a empty useragent', () => {
|
||||
middleware.middleware(req, {}, next)
|
||||
expect(req.session).not.to.exist
|
||||
})
|
||||
@@ -8,7 +8,7 @@ const {
|
||||
LezerGrammarCompilerPlugin,
|
||||
} = require('./webpack-plugins/lezer-grammar-compiler')
|
||||
|
||||
const PackageVersions = require('./app/src/infrastructure/PackageVersions')
|
||||
const PackageVersions = require('./app/src/infrastructure/PackageVersions.js')
|
||||
const invalidateBabelCacheIfNeeded = require('./frontend/macros/invalidate-babel-cache-if-needed')
|
||||
|
||||
// Make sure that babel-macros are re-evaluated after changing the modules config
|
||||
|
||||
Reference in New Issue
Block a user