mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-31 19:02:59 +01:00
Migrated settings to es6
This commit is contained in:
parent
6ed711a4d8
commit
154e67315c
39 changed files with 710 additions and 702 deletions
|
@ -297,6 +297,9 @@ importers:
|
||||||
'@types/jsdom':
|
'@types/jsdom':
|
||||||
specifier: ^21.1.7
|
specifier: ^21.1.7
|
||||||
version: 21.1.7
|
version: 21.1.7
|
||||||
|
'@types/jsonminify':
|
||||||
|
specifier: ^0.4.3
|
||||||
|
version: 0.4.3
|
||||||
'@types/jsonwebtoken':
|
'@types/jsonwebtoken':
|
||||||
specifier: ^9.0.6
|
specifier: ^9.0.6
|
||||||
version: 9.0.6
|
version: 9.0.6
|
||||||
|
@ -1516,6 +1519,9 @@ packages:
|
||||||
'@types/json5@0.0.29':
|
'@types/json5@0.0.29':
|
||||||
resolution: {integrity: sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==}
|
resolution: {integrity: sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==}
|
||||||
|
|
||||||
|
'@types/jsonminify@0.4.3':
|
||||||
|
resolution: {integrity: sha512-+oz7EbPz1Nwmn/sr3UztgXpRhdFpvFrjGi5ictEYxUri5ZvQMTcdTi36MTfD/gCb1A5xhJKdH8Hwz2uz5k6s9A==}
|
||||||
|
|
||||||
'@types/jsonwebtoken@9.0.6':
|
'@types/jsonwebtoken@9.0.6':
|
||||||
resolution: {integrity: sha512-/5hndP5dCjloafCXns6SZyESp3Ldq7YjH3zwzwczYnjxIT0Fqzk5ROSYVGfFyczIue7IUEj8hkvLbPoLQ18vQw==}
|
resolution: {integrity: sha512-/5hndP5dCjloafCXns6SZyESp3Ldq7YjH3zwzwczYnjxIT0Fqzk5ROSYVGfFyczIue7IUEj8hkvLbPoLQ18vQw==}
|
||||||
|
|
||||||
|
@ -5703,6 +5709,8 @@ snapshots:
|
||||||
|
|
||||||
'@types/json5@0.0.29': {}
|
'@types/json5@0.0.29': {}
|
||||||
|
|
||||||
|
'@types/jsonminify@0.4.3': {}
|
||||||
|
|
||||||
'@types/jsonwebtoken@9.0.6':
|
'@types/jsonwebtoken@9.0.6':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/node': 22.4.0
|
'@types/node': 22.4.0
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {Database} from 'ueberdb2';
|
import {Database} from 'ueberdb2';
|
||||||
const settings = require('../utils/Settings');
|
import settings from '../utils/Settings';
|
||||||
import log4js from 'log4js';
|
import log4js from 'log4js';
|
||||||
const stats = require('../stats')
|
const stats = require('../stats')
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ import AttributePool from '../../static/js/AttributePool';
|
||||||
const Stream = require('../utils/Stream');
|
const Stream = require('../utils/Stream');
|
||||||
const assert = require('assert').strict;
|
const assert = require('assert').strict;
|
||||||
const db = require('./DB');
|
const db = require('./DB');
|
||||||
const settings = require('../utils/Settings');
|
import settings from '../utils/Settings';
|
||||||
const authorManager = require('./AuthorManager');
|
const authorManager = require('./AuthorManager');
|
||||||
const padManager = require('./PadManager');
|
const padManager = require('./PadManager');
|
||||||
const padMessageHandler = require('../handler/PadMessageHandler');
|
const padMessageHandler = require('../handler/PadMessageHandler');
|
||||||
|
|
|
@ -25,7 +25,7 @@ import {PadType} from "../types/PadType";
|
||||||
const CustomError = require('../utils/customError');
|
const CustomError = require('../utils/customError');
|
||||||
const Pad = require('../db/Pad');
|
const Pad = require('../db/Pad');
|
||||||
const db = require('./DB');
|
const db = require('./DB');
|
||||||
const settings = require('../utils/Settings');
|
import settings from '../utils/Settings';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A cache of all loaded Pads.
|
* A cache of all loaded Pads.
|
||||||
|
|
|
@ -26,7 +26,7 @@ const hooks = require('../../static/js/pluginfw/hooks');
|
||||||
const padManager = require('./PadManager');
|
const padManager = require('./PadManager');
|
||||||
const readOnlyManager = require('./ReadOnlyManager');
|
const readOnlyManager = require('./ReadOnlyManager');
|
||||||
const sessionManager = require('./SessionManager');
|
const sessionManager = require('./SessionManager');
|
||||||
const settings = require('../utils/Settings');
|
import settings from '../utils/Settings';
|
||||||
const webaccess = require('../hooks/express/webaccess');
|
const webaccess = require('../hooks/express/webaccess');
|
||||||
const log4js = require('log4js');
|
const log4js = require('log4js');
|
||||||
const authLogger = log4js.getLogger('auth');
|
const authLogger = log4js.getLogger('auth');
|
||||||
|
|
|
@ -25,7 +25,7 @@ const fs = require('fs');
|
||||||
const hooks = require('../../static/js/pluginfw/hooks');
|
const hooks = require('../../static/js/pluginfw/hooks');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const resolve = require('resolve');
|
const resolve = require('resolve');
|
||||||
const settings = require('../utils/Settings');
|
import settings from '../utils/Settings';
|
||||||
import {pluginInstallPath} from '../../static/js/pluginfw/installer'
|
import {pluginInstallPath} from '../../static/js/pluginfw/installer'
|
||||||
|
|
||||||
const templateCache = new Map();
|
const templateCache = new Map();
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
const absolutePaths = require('../utils/AbsolutePaths');
|
const absolutePaths = require('../utils/AbsolutePaths');
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import log4js from 'log4js';
|
import log4js from 'log4js';
|
||||||
const randomString = require('../utils/randomstring');
|
import randomString from '../utils/randomstring';
|
||||||
const argv = require('../utils/Cli').argv;
|
import {argvP} from '../utils/Cli'
|
||||||
const settings = require('../utils/Settings');
|
import settings from '../utils/Settings';
|
||||||
|
|
||||||
const apiHandlerLogger = log4js.getLogger('APIHandler');
|
const apiHandlerLogger = log4js.getLogger('APIHandler');
|
||||||
|
|
||||||
// ensure we have an apikey
|
// ensure we have an apikey
|
||||||
export let apikey:string|null = null;
|
export let apikey:string|null = null;
|
||||||
const apikeyFilename = absolutePaths.makeAbsolute(argv.apikey || './APIKEY.txt');
|
const apikeyFilename = absolutePaths.makeAbsolute(argvP.apikey || './APIKEY.txt');
|
||||||
|
|
||||||
|
|
||||||
if(settings.authenticationMethod === 'apikey') {
|
if(settings.authenticationMethod === 'apikey') {
|
||||||
|
|
|
@ -25,7 +25,7 @@ const padManager = require('../db/PadManager');
|
||||||
const padMessageHandler = require('./PadMessageHandler');
|
const padMessageHandler = require('./PadMessageHandler');
|
||||||
import {promises as fs} from 'fs';
|
import {promises as fs} from 'fs';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
const settings = require('../utils/Settings');
|
import settings from '../utils/Settings';
|
||||||
const {Formidable} = require('formidable');
|
const {Formidable} = require('formidable');
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
const importHtml = require('../utils/ImportHtml');
|
const importHtml = require('../utils/ImportHtml');
|
||||||
|
|
|
@ -30,7 +30,7 @@ const AttributeManager = require('../../static/js/AttributeManager');
|
||||||
const authorManager = require('../db/AuthorManager');
|
const authorManager = require('../db/AuthorManager');
|
||||||
import padutils from '../../static/js/pad_utils';
|
import padutils from '../../static/js/pad_utils';
|
||||||
const readOnlyManager = require('../db/ReadOnlyManager');
|
const readOnlyManager = require('../db/ReadOnlyManager');
|
||||||
const settings = require('../utils/Settings');
|
import settings from '../utils/Settings';
|
||||||
const securityManager = require('../db/SecurityManager');
|
const securityManager = require('../db/SecurityManager');
|
||||||
const plugins = require('../../static/js/pluginfw/plugin_defs');
|
const plugins = require('../../static/js/pluginfw/plugin_defs');
|
||||||
import log4js from 'log4js';
|
import log4js from 'log4js';
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
import {MapArrayType} from "../types/MapType";
|
import {MapArrayType} from "../types/MapType";
|
||||||
import {SocketModule} from "../types/SocketModule";
|
import {SocketModule} from "../types/SocketModule";
|
||||||
const log4js = require('log4js');
|
const log4js = require('log4js');
|
||||||
const settings = require('../utils/Settings');
|
import settings from '../utils/Settings';
|
||||||
const stats = require('../../node/stats')
|
const stats = require('../../node/stats')
|
||||||
|
|
||||||
const logger = log4js.getLogger('socket.io');
|
const logger = log4js.getLogger('socket.io');
|
||||||
|
|
|
@ -14,7 +14,7 @@ import fs from 'fs';
|
||||||
const hooks = require('../../static/js/pluginfw/hooks');
|
const hooks = require('../../static/js/pluginfw/hooks');
|
||||||
import log4js from 'log4js';
|
import log4js from 'log4js';
|
||||||
const SessionStore = require('../db/SessionStore');
|
const SessionStore = require('../db/SessionStore');
|
||||||
const settings = require('../utils/Settings');
|
import settings from '../utils/Settings';
|
||||||
const stats = require('../stats')
|
const stats = require('../stats')
|
||||||
import util from 'util';
|
import util from 'util';
|
||||||
const webaccess = require('./express/webaccess');
|
const webaccess = require('./express/webaccess');
|
||||||
|
@ -190,6 +190,7 @@ exports.restartServer = async () => {
|
||||||
secretRotator = new SecretRotator(
|
secretRotator = new SecretRotator(
|
||||||
'expressSessionSecrets', keyRotationInterval, sessionLifetime, settings.sessionKey);
|
'expressSessionSecrets', keyRotationInterval, sessionLifetime, settings.sessionKey);
|
||||||
await secretRotator.start();
|
await secretRotator.start();
|
||||||
|
// @ts-ignore
|
||||||
secret = secretRotator.secrets;
|
secret = secretRotator.secrets;
|
||||||
}
|
}
|
||||||
if (!secret) throw new Error('missing cookie signing secret');
|
if (!secret) throw new Error('missing cookie signing secret');
|
||||||
|
|
|
@ -5,7 +5,7 @@ import fs from "fs";
|
||||||
import * as url from "node:url";
|
import * as url from "node:url";
|
||||||
import {MapArrayType} from "../../types/MapType";
|
import {MapArrayType} from "../../types/MapType";
|
||||||
|
|
||||||
const settings = require('ep_etherpad-lite/node/utils/Settings');
|
import settings from 'ep_etherpad-lite/node/utils/Settings';
|
||||||
|
|
||||||
const ADMIN_PATH = path.join(settings.root, 'src', 'templates');
|
const ADMIN_PATH = path.join(settings.root, 'src', 'templates');
|
||||||
const PROXY_HEADER = "x-proxy-path"
|
const PROXY_HEADER = "x-proxy-path"
|
||||||
|
|
|
@ -9,7 +9,7 @@ const eejs = require('../../eejs');
|
||||||
const fsp = require('fs').promises;
|
const fsp = require('fs').promises;
|
||||||
const hooks = require('../../../static/js/pluginfw/hooks');
|
const hooks = require('../../../static/js/pluginfw/hooks');
|
||||||
const plugins = require('../../../static/js/pluginfw/plugins');
|
const plugins = require('../../../static/js/pluginfw/plugins');
|
||||||
const settings = require('../../utils/Settings');
|
import settings from '../../utils/Settings';
|
||||||
const UpdateCheck = require('../../utils/UpdateCheck');
|
const UpdateCheck = require('../../utils/UpdateCheck');
|
||||||
const padManager = require('../../db/PadManager');
|
const padManager = require('../../db/PadManager');
|
||||||
const api = require('../../db/API');
|
const api = require('../../db/API');
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import {ArgsExpressType} from "../../types/ArgsExpressType";
|
import {ArgsExpressType} from "../../types/ArgsExpressType";
|
||||||
|
|
||||||
const hasPadAccess = require('../../padaccess');
|
const hasPadAccess = require('../../padaccess');
|
||||||
const settings = require('../../utils/Settings');
|
import settings from '../../utils/Settings';
|
||||||
const exportHandler = require('../../handler/ExportHandler');
|
const exportHandler = require('../../handler/ExportHandler');
|
||||||
const importHandler = require('../../handler/ImportHandler');
|
const importHandler = require('../../handler/ImportHandler');
|
||||||
const padManager = require('../../db/PadManager');
|
const padManager = require('../../db/PadManager');
|
||||||
|
|
|
@ -24,7 +24,7 @@ const cloneDeep = require('lodash.clonedeep');
|
||||||
const createHTTPError = require('http-errors');
|
const createHTTPError = require('http-errors');
|
||||||
|
|
||||||
const apiHandler = require('../../handler/APIHandler');
|
const apiHandler = require('../../handler/APIHandler');
|
||||||
const settings = require('../../utils/Settings');
|
import settings from '../../utils/Settings';
|
||||||
|
|
||||||
const log4js = require('log4js');
|
const log4js = require('log4js');
|
||||||
const logger = log4js.getLogger('API');
|
const logger = log4js.getLogger('API');
|
||||||
|
|
|
@ -6,7 +6,7 @@ import events from 'events';
|
||||||
const express = require('../express');
|
const express = require('../express');
|
||||||
import log4js from 'log4js';
|
import log4js from 'log4js';
|
||||||
const proxyaddr = require('proxy-addr');
|
const proxyaddr = require('proxy-addr');
|
||||||
const settings = require('../../utils/Settings');
|
import settings from '../../utils/Settings';
|
||||||
import {Server, Socket} from 'socket.io'
|
import {Server, Socket} from 'socket.io'
|
||||||
const socketIORouter = require('../../handler/SocketIORouter');
|
const socketIORouter = require('../../handler/SocketIORouter');
|
||||||
const hooks = require('../../../static/js/pluginfw/hooks');
|
const hooks = require('../../../static/js/pluginfw/hooks');
|
||||||
|
|
|
@ -6,7 +6,7 @@ import fs from 'node:fs';
|
||||||
const fsp = fs.promises;
|
const fsp = fs.promises;
|
||||||
const toolbar = require('../../utils/toolbar');
|
const toolbar = require('../../utils/toolbar');
|
||||||
const hooks = require('../../../static/js/pluginfw/hooks');
|
const hooks = require('../../../static/js/pluginfw/hooks');
|
||||||
const settings = require('../../utils/Settings');
|
import settings from '../../utils/Settings';
|
||||||
import util from 'node:util';
|
import util from 'node:util';
|
||||||
const webaccess = require('./webaccess');
|
const webaccess = require('./webaccess');
|
||||||
const plugins = require('../../../static/js/pluginfw/plugin_defs');
|
const plugins = require('../../../static/js/pluginfw/plugin_defs');
|
||||||
|
@ -40,7 +40,7 @@ exports.expressPreSession = async (hookName:string, {app}:any) => {
|
||||||
|
|
||||||
app.get('/robots.txt', (req:any, res:any) => {
|
app.get('/robots.txt', (req:any, res:any) => {
|
||||||
let filePath =
|
let filePath =
|
||||||
path.join(settings.root, 'src', 'static', 'skins', settings.skinName, 'robots.txt');
|
path.join(settings.root, 'src', 'static', 'skins', settings.skinName!, 'robots.txt');
|
||||||
res.sendFile(filePath, (err:any) => {
|
res.sendFile(filePath, (err:any) => {
|
||||||
// there is no custom robots.txt, send the default robots.txt which dissallows all
|
// there is no custom robots.txt, send the default robots.txt which dissallows all
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -64,7 +64,7 @@ exports.expressPreSession = async (hookName:string, {app}:any) => {
|
||||||
|
|
||||||
const fns = [
|
const fns = [
|
||||||
...(settings.favicon ? [path.resolve(settings.root, settings.favicon)] : []),
|
...(settings.favicon ? [path.resolve(settings.root, settings.favicon)] : []),
|
||||||
path.join(settings.root, 'src', 'static', 'skins', settings.skinName, 'favicon.ico'),
|
path.join(settings.root, 'src', 'static', 'skins', settings.skinName!, 'favicon.ico'),
|
||||||
path.join(settings.root, 'src', 'static', 'favicon.ico'),
|
path.join(settings.root, 'src', 'static', 'favicon.ico'),
|
||||||
];
|
];
|
||||||
for (const fn of fns) {
|
for (const fn of fns) {
|
||||||
|
@ -174,6 +174,7 @@ const handleLiveReload = async (args: any, padString: string, timeSliderString:
|
||||||
req,
|
req,
|
||||||
toolbar,
|
toolbar,
|
||||||
isReadOnly,
|
isReadOnly,
|
||||||
|
settings: settings,
|
||||||
entrypoint: '/watch/pad?hash=' + hash
|
entrypoint: '/watch/pad?hash=' + hash
|
||||||
})
|
})
|
||||||
res.send(content);
|
res.send(content);
|
||||||
|
@ -203,6 +204,7 @@ const handleLiveReload = async (args: any, padString: string, timeSliderString:
|
||||||
req,
|
req,
|
||||||
toolbar,
|
toolbar,
|
||||||
isReadOnly,
|
isReadOnly,
|
||||||
|
settings: settings,
|
||||||
entrypoint: '/watch/timeslider?hash=' + hash
|
entrypoint: '/watch/timeslider?hash=' + hash
|
||||||
})
|
})
|
||||||
res.send(content);
|
res.send(content);
|
||||||
|
|
|
@ -7,7 +7,7 @@ const fs = require('fs').promises;
|
||||||
import {minify} from '../../utils/Minify';
|
import {minify} from '../../utils/Minify';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
const plugins = require('../../../static/js/pluginfw/plugin_defs');
|
const plugins = require('../../../static/js/pluginfw/plugin_defs');
|
||||||
const settings = require('../../utils/Settings');
|
import settings from '../../utils/Settings';
|
||||||
|
|
||||||
// Rewrite tar to include modules with no extensions and proper rooted paths.
|
// Rewrite tar to include modules with no extensions and proper rooted paths.
|
||||||
const getTar = async () => {
|
const getTar = async () => {
|
||||||
|
|
|
@ -7,7 +7,7 @@ const path = require('path');
|
||||||
const fsp = require('fs').promises;
|
const fsp = require('fs').promises;
|
||||||
const plugins = require('../../../static/js/pluginfw/plugin_defs');
|
const plugins = require('../../../static/js/pluginfw/plugin_defs');
|
||||||
const sanitizePathname = require('../../utils/sanitizePathname');
|
const sanitizePathname = require('../../utils/sanitizePathname');
|
||||||
const settings = require('../../utils/Settings');
|
import settings from '../../utils/Settings';
|
||||||
|
|
||||||
// Returns all *.js files under specDir (recursively) as relative paths to specDir, using '/'
|
// Returns all *.js files under specDir (recursively) as relative paths to specDir, using '/'
|
||||||
// instead of path.sep to separate pathname components.
|
// instead of path.sep to separate pathname components.
|
||||||
|
|
|
@ -6,7 +6,7 @@ import {SocketClientRequest} from "../../types/SocketClientRequest";
|
||||||
import {WebAccessTypes} from "../../types/WebAccessTypes";
|
import {WebAccessTypes} from "../../types/WebAccessTypes";
|
||||||
import {SettingsUser} from "../../types/SettingsUser";
|
import {SettingsUser} from "../../types/SettingsUser";
|
||||||
const httpLogger = log4js.getLogger('http');
|
const httpLogger = log4js.getLogger('http');
|
||||||
const settings = require('../../utils/Settings');
|
import settings from '../../utils/Settings';
|
||||||
const hooks = require('../../../static/js/pluginfw/hooks');
|
const hooks = require('../../../static/js/pluginfw/hooks');
|
||||||
const readOnlyManager = require('../../db/ReadOnlyManager');
|
const readOnlyManager = require('../../db/ReadOnlyManager');
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ const path = require('path');
|
||||||
const _ = require('underscore');
|
const _ = require('underscore');
|
||||||
const pluginDefs = require('../../static/js/pluginfw/plugin_defs');
|
const pluginDefs = require('../../static/js/pluginfw/plugin_defs');
|
||||||
const existsSync = require('../utils/path_exists');
|
const existsSync = require('../utils/path_exists');
|
||||||
const settings = require('../utils/Settings');
|
import settings from '../utils/Settings';
|
||||||
|
|
||||||
// returns all existing messages merged together and grouped by langcode
|
// returns all existing messages merged together and grouped by langcode
|
||||||
// {es: {"foo": "string"}, en:...}
|
// {es: {"foo": "string"}, en:...}
|
||||||
|
|
|
@ -3,7 +3,7 @@ import Provider, {Account, Configuration} from 'oidc-provider';
|
||||||
import {generateKeyPair, exportJWK, KeyLike} from 'jose'
|
import {generateKeyPair, exportJWK, KeyLike} from 'jose'
|
||||||
import MemoryAdapter from "./OIDCAdapter";
|
import MemoryAdapter from "./OIDCAdapter";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
const settings = require('../utils/Settings');
|
import settings from '../utils/Settings';
|
||||||
import {IncomingForm} from 'formidable'
|
import {IncomingForm} from 'formidable'
|
||||||
import express, {Request, Response} from 'express';
|
import express, {Request, Response} from 'express';
|
||||||
import {format} from 'url'
|
import {format} from 'url'
|
||||||
|
@ -137,7 +137,7 @@ export const expressCreateServer = async (hookName: string, args: ArgsExpressTyp
|
||||||
} else if (token.kind === "ClientCredentials") {
|
} else if (token.kind === "ClientCredentials") {
|
||||||
let extraParams: MapArrayType<string> = {}
|
let extraParams: MapArrayType<string> = {}
|
||||||
|
|
||||||
settings.sso.clients
|
settings.sso.clients!
|
||||||
.filter((client:any) => client.client_id === token.clientId)
|
.filter((client:any) => client.client_id === token.clientId)
|
||||||
.forEach((client:any) => {
|
.forEach((client:any) => {
|
||||||
if(client.extraParams !== undefined) {
|
if(client.extraParams !== undefined) {
|
||||||
|
|
|
@ -29,7 +29,7 @@ import pkg from '../package.json';
|
||||||
import {checkForMigration} from "../static/js/pluginfw/installer";
|
import {checkForMigration} from "../static/js/pluginfw/installer";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
|
||||||
const settings = require('./utils/Settings');
|
import settings from './utils/Settings';
|
||||||
|
|
||||||
let wtfnode: any;
|
let wtfnode: any;
|
||||||
if (settings.dumpOnUncleanExit) {
|
if (settings.dumpOnUncleanExit) {
|
||||||
|
|
|
@ -24,7 +24,7 @@ import {AsyncQueueTask} from "../types/AsyncQueueTask";
|
||||||
|
|
||||||
const spawn = require('child_process').spawn;
|
const spawn = require('child_process').spawn;
|
||||||
const async = require('async');
|
const async = require('async');
|
||||||
const settings = require('./Settings');
|
import settings from './Settings';
|
||||||
const os = require('os');
|
const os = require('os');
|
||||||
|
|
||||||
// on windows we have to spawn a process for each convertion,
|
// on windows we have to spawn a process for each convertion,
|
||||||
|
|
|
@ -18,9 +18,9 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
const log4js = require('log4js');
|
import log4js from 'log4js';
|
||||||
const path = require('path');
|
import path from 'path';
|
||||||
const _ = require('underscore');
|
import _ from 'underscore';
|
||||||
|
|
||||||
const absPathLogger = log4js.getLogger('AbsolutePaths');
|
const absPathLogger = log4js.getLogger('AbsolutePaths');
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ const popIfEndsWith = (stringArray: string[], lastDesiredElements: string[]): st
|
||||||
* @return {string} The identified absolute base path. If such path cannot be
|
* @return {string} The identified absolute base path. If such path cannot be
|
||||||
* identified, prints a log and exits the application.
|
* identified, prints a log and exits the application.
|
||||||
*/
|
*/
|
||||||
exports.findEtherpadRoot = () => {
|
export const findEtherpadRoot = () => {
|
||||||
if (etherpadRoot != null) {
|
if (etherpadRoot != null) {
|
||||||
return etherpadRoot;
|
return etherpadRoot;
|
||||||
}
|
}
|
||||||
|
@ -130,12 +130,12 @@ exports.findEtherpadRoot = () => {
|
||||||
* it is returned unchanged. Otherwise it is interpreted
|
* it is returned unchanged. Otherwise it is interpreted
|
||||||
* relative to exports.root.
|
* relative to exports.root.
|
||||||
*/
|
*/
|
||||||
exports.makeAbsolute = (somePath: string) => {
|
export const makeAbsolute = (somePath: string) => {
|
||||||
if (path.isAbsolute(somePath)) {
|
if (path.isAbsolute(somePath)) {
|
||||||
return somePath;
|
return somePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
const rewrittenPath = path.join(exports.findEtherpadRoot(), somePath);
|
const rewrittenPath = path.join(findEtherpadRoot(), somePath);
|
||||||
|
|
||||||
absPathLogger.debug(`Relative path "${somePath}" can be rewritten to "${rewrittenPath}"`);
|
absPathLogger.debug(`Relative path "${somePath}" can be rewritten to "${rewrittenPath}"`);
|
||||||
return rewrittenPath;
|
return rewrittenPath;
|
||||||
|
@ -149,7 +149,7 @@ exports.makeAbsolute = (somePath: string) => {
|
||||||
* a subdirectory of the base one
|
* a subdirectory of the base one
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
exports.isSubdir = (parent: string, arbitraryDir: string): boolean => {
|
export const isSubdir = (parent: string, arbitraryDir: string): boolean => {
|
||||||
// modified from: https://stackoverflow.com/questions/37521893/determine-if-a-path-is-subdirectory-of-another-in-node-js#45242825
|
// modified from: https://stackoverflow.com/questions/37521893/determine-if-a-path-is-subdirectory-of-another-in-node-js#45242825
|
||||||
const relative = path.relative(parent, arbitraryDir);
|
const relative = path.relative(parent, arbitraryDir);
|
||||||
return !!relative && !relative.startsWith('..') && !path.isAbsolute(relative);
|
return !!relative && !relative.startsWith('..') && !path.isAbsolute(relative);
|
||||||
|
|
|
@ -21,7 +21,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// An object containing the parsed command-line options
|
// An object containing the parsed command-line options
|
||||||
exports.argv = {};
|
import {MapArrayType} from "../types/MapType";
|
||||||
|
|
||||||
|
export const argvP: MapArrayType<any> = {};
|
||||||
|
|
||||||
const argv = process.argv.slice(2);
|
const argv = process.argv.slice(2);
|
||||||
let arg, prevArg;
|
let arg, prevArg;
|
||||||
|
@ -32,22 +34,22 @@ for (let i = 0; i < argv.length; i++) {
|
||||||
|
|
||||||
// Override location of settings.json file
|
// Override location of settings.json file
|
||||||
if (prevArg === '--settings' || prevArg === '-s') {
|
if (prevArg === '--settings' || prevArg === '-s') {
|
||||||
exports.argv.settings = arg;
|
argvP.settings = arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Override location of credentials.json file
|
// Override location of credentials.json file
|
||||||
if (prevArg === '--credentials') {
|
if (prevArg === '--credentials') {
|
||||||
exports.argv.credentials = arg;
|
argvP.credentials = arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Override location of settings.json file
|
// Override location of settings.json file
|
||||||
if (prevArg === '--sessionkey') {
|
if (prevArg === '--sessionkey') {
|
||||||
exports.argv.sessionkey = arg;
|
argvP.sessionkey = arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Override location of APIKEY.txt file
|
// Override location of APIKEY.txt file
|
||||||
if (prevArg === '--apikey') {
|
if (prevArg === '--apikey') {
|
||||||
exports.argv.apikey = arg;
|
argvP.apikey = arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
prevArg = arg;
|
prevArg = arg;
|
||||||
|
|
|
@ -23,7 +23,7 @@ const log4js = require('log4js');
|
||||||
const os = require('os');
|
const os = require('os');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const runCmd = require('./run_cmd');
|
const runCmd = require('./run_cmd');
|
||||||
const settings = require('./Settings');
|
import settings from './Settings';
|
||||||
|
|
||||||
const logger = log4js.getLogger('LibreOffice');
|
const logger = log4js.getLogger('LibreOffice');
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ import mime from 'mime-types';
|
||||||
import log4js from 'log4js';
|
import log4js from 'log4js';
|
||||||
import {compressCSS, compressJS} from './MinifyWorker'
|
import {compressCSS, compressJS} from './MinifyWorker'
|
||||||
|
|
||||||
const settings = require('./Settings');
|
import settings from './Settings';
|
||||||
import {promises as fs} from 'fs';
|
import {promises as fs} from 'fs';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
const plugins = require('../../static/js/pluginfw/plugin_defs');
|
const plugins = require('../../static/js/pluginfw/plugin_defs');
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
const semver = require('semver');
|
const semver = require('semver');
|
||||||
const settings = require('./Settings');
|
import settings from './Settings';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
const headers = {
|
const headers = {
|
||||||
'User-Agent': 'Etherpad/' + settings.getEpVersion(),
|
'User-Agent': 'Etherpad/' + settings.getEpVersion(),
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
* Generates a random String with the given length. Is needed to generate the
|
* Generates a random String with the given length. Is needed to generate the
|
||||||
* Author, Group, readonly, session Ids
|
* Author, Group, readonly, session Ids
|
||||||
*/
|
*/
|
||||||
const cryptoMod = require('crypto');
|
import cryptoMod from 'crypto';
|
||||||
|
|
||||||
const randomString = (len: number) => cryptoMod.randomBytes(len).toString('hex');
|
const randomString = (len: number) => cryptoMod.randomBytes(len).toString('hex');
|
||||||
|
|
||||||
module.exports = randomString;
|
export default randomString
|
||||||
|
|
|
@ -8,7 +8,7 @@ import {Readable} from "node:stream";
|
||||||
const spawn = require('cross-spawn');
|
const spawn = require('cross-spawn');
|
||||||
const log4js = require('log4js');
|
const log4js = require('log4js');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const settings = require('./Settings');
|
import settings from './Settings';
|
||||||
|
|
||||||
const logger = log4js.getLogger('runCmd');
|
const logger = log4js.getLogger('runCmd');
|
||||||
|
|
||||||
|
|
|
@ -88,6 +88,7 @@
|
||||||
"@types/jquery": "^3.5.30",
|
"@types/jquery": "^3.5.30",
|
||||||
"@types/js-cookie": "^3.0.6",
|
"@types/js-cookie": "^3.0.6",
|
||||||
"@types/jsdom": "^21.1.7",
|
"@types/jsdom": "^21.1.7",
|
||||||
|
"@types/jsonminify": "^0.4.3",
|
||||||
"@types/jsonwebtoken": "^9.0.6",
|
"@types/jsonwebtoken": "^9.0.6",
|
||||||
"@types/mime-types": "^2.1.4",
|
"@types/mime-types": "^2.1.4",
|
||||||
"@types/mocha": "^10.0.7",
|
"@types/mocha": "^10.0.7",
|
||||||
|
|
|
@ -4,7 +4,7 @@ import {node_modules, pluginInstallPath} from "./installer";
|
||||||
import {accessSync, constants, rmSync, symlinkSync, unlinkSync} from "node:fs";
|
import {accessSync, constants, rmSync, symlinkSync, unlinkSync} from "node:fs";
|
||||||
import {dependencies, name} from '../../../package.json'
|
import {dependencies, name} from '../../../package.json'
|
||||||
import {pathToFileURL} from 'node:url';
|
import {pathToFileURL} from 'node:url';
|
||||||
const settings = require('../../../node/utils/Settings');
|
import settings from '../../../node/utils/Settings';
|
||||||
import {readFileSync} from "fs";
|
import {readFileSync} from "fs";
|
||||||
|
|
||||||
export class LinkInstaller {
|
export class LinkInstaller {
|
||||||
|
|
|
@ -13,7 +13,7 @@ import {promises as fs} from "fs";
|
||||||
const plugins = require('./plugins');
|
const plugins = require('./plugins');
|
||||||
const hooks = require('./hooks');
|
const hooks = require('./hooks');
|
||||||
const runCmd = require('../../../node/utils/run_cmd');
|
const runCmd = require('../../../node/utils/run_cmd');
|
||||||
const settings = require('../../../node/utils/Settings');
|
import settings from '../../../node/utils/Settings';
|
||||||
import {LinkInstaller} from "./LinkInstaller";
|
import {LinkInstaller} from "./LinkInstaller";
|
||||||
|
|
||||||
const {findEtherpadRoot} = require('../../../node/utils/AbsolutePaths');
|
const {findEtherpadRoot} = require('../../../node/utils/AbsolutePaths');
|
||||||
|
|
|
@ -9,7 +9,7 @@ const runCmd = require('../../../node/utils/run_cmd');
|
||||||
const tsort = require('./tsort');
|
const tsort = require('./tsort');
|
||||||
const pluginUtils = require('./shared');
|
const pluginUtils = require('./shared');
|
||||||
const defs = require('./plugin_defs');
|
const defs = require('./plugin_defs');
|
||||||
const settings = require('../../../node/utils/Settings');
|
import settings from '../../../node/utils/Settings'
|
||||||
|
|
||||||
const logger = log4js.getLogger('plugins');
|
const logger = log4js.getLogger('plugins');
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<%
|
<%
|
||||||
var settings = require("ep_etherpad-lite/node/utils/Settings")
|
var langs = require("ep_etherpad-lite/node/hooks/i18n").availableLangs
|
||||||
, langs = require("ep_etherpad-lite/node/hooks/i18n").availableLangs
|
|
||||||
, pluginUtils = require('ep_etherpad-lite/static/js/pluginfw/shared')
|
, pluginUtils = require('ep_etherpad-lite/static/js/pluginfw/shared')
|
||||||
;
|
;
|
||||||
%>
|
%>
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<%
|
<%
|
||||||
var settings = require("ep_etherpad-lite/node/utils/Settings")
|
var langs = require("ep_etherpad-lite/node/hooks/i18n").availableLangs
|
||||||
, langs = require("ep_etherpad-lite/node/hooks/i18n").availableLangs
|
|
||||||
%>
|
%>
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html translate="no" class="pad <%=settings.skinVariants%>">
|
<html translate="no" class="pad <%=settings.skinVariants%>">
|
||||||
|
|
|
@ -10,7 +10,7 @@ import padutils from '../../static/js/pad_utils';
|
||||||
const process = require('process');
|
const process = require('process');
|
||||||
const server = require('../../node/server');
|
const server = require('../../node/server');
|
||||||
const setCookieParser = require('set-cookie-parser');
|
const setCookieParser = require('set-cookie-parser');
|
||||||
const settings = require('../../node/utils/Settings');
|
import settings from '../../node/utils/Settings';
|
||||||
import supertest from 'supertest';
|
import supertest from 'supertest';
|
||||||
import TestAgent from "supertest/lib/agent";
|
import TestAgent from "supertest/lib/agent";
|
||||||
import {Http2Server} from "node:http2";
|
import {Http2Server} from "node:http2";
|
||||||
|
@ -26,7 +26,7 @@ export let baseUrl:string|null = null;
|
||||||
export let httpServer: Http2Server|null = null;
|
export let httpServer: Http2Server|null = null;
|
||||||
export const logger = log4js.getLogger('test');
|
export const logger = log4js.getLogger('test');
|
||||||
|
|
||||||
const logLevel = logger.level;
|
const logLevel = logger.level as log4js.Level;
|
||||||
|
|
||||||
// Mocha doesn't monitor unhandled Promise rejections, so convert them to uncaught exceptions.
|
// Mocha doesn't monitor unhandled Promise rejections, so convert them to uncaught exceptions.
|
||||||
// https://github.com/mochajs/mocha/issues/2640
|
// https://github.com/mochajs/mocha/issues/2640
|
||||||
|
|
Loading…
Reference in a new issue