mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-05-07 23:55:12 -04:00
Fixed import.
This commit is contained in:
parent
6fdf9ed812
commit
b617ac4c58
11 changed files with 37 additions and 27 deletions
|
@ -24,7 +24,7 @@
|
||||||
const ueberDB = require('ueberdb2');
|
const ueberDB = require('ueberdb2');
|
||||||
const settings = require('../utils/Settings');
|
const settings = require('../utils/Settings');
|
||||||
const log4js = require('log4js');
|
const log4js = require('log4js');
|
||||||
const stats = require('../stats');
|
import stats from '../stats';
|
||||||
|
|
||||||
const logger = log4js.getLogger('ueberDB');
|
const logger = log4js.getLogger('ueberDB');
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ const log4js = require('log4js');
|
||||||
const messageLogger = log4js.getLogger('message');
|
const messageLogger = log4js.getLogger('message');
|
||||||
const accessLogger = log4js.getLogger('access');
|
const accessLogger = log4js.getLogger('access');
|
||||||
const hooks = require('../../static/js/pluginfw/hooks.js');
|
const hooks = require('../../static/js/pluginfw/hooks.js');
|
||||||
const stats = require('../stats');
|
import stats from '../stats'
|
||||||
const assert = require('assert').strict;
|
const assert = require('assert').strict;
|
||||||
const {RateLimiterMemory} = require('rate-limiter-flexible');
|
const {RateLimiterMemory} = require('rate-limiter-flexible');
|
||||||
const webaccess = require('../hooks/express/webaccess');
|
const webaccess = require('../hooks/express/webaccess');
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
const log4js = require('log4js');
|
const log4js = require('log4js');
|
||||||
const settings = require('../utils/Settings');
|
const settings = require('../utils/Settings');
|
||||||
const stats = require('../stats');
|
import stats from '../stats'
|
||||||
|
|
||||||
const logger = log4js.getLogger('socket.io');
|
const logger = log4js.getLogger('socket.io');
|
||||||
|
|
||||||
|
|
|
@ -1,26 +1,27 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import {Socket} from "node:net";
|
import {Socket} from "node:net";
|
||||||
import {MapArrayType} from "../types/MapType";
|
import type {MapArrayType} from "../types/MapType";
|
||||||
|
|
||||||
const _ = require('underscore');
|
import _ from 'underscore';
|
||||||
const cookieParser = require('cookie-parser');
|
// @ts-ignore
|
||||||
const events = require('events');
|
import cookieParser from 'cookie-parser';
|
||||||
const express = require('express');
|
import events from 'events';
|
||||||
const expressSession = require('express-session');
|
import express from 'express';
|
||||||
const fs = require('fs');
|
// @ts-ignore
|
||||||
|
import expressSession from 'express-session';
|
||||||
|
import fs from 'fs';
|
||||||
const hooks = require('../../static/js/pluginfw/hooks');
|
const hooks = require('../../static/js/pluginfw/hooks');
|
||||||
const log4js = require('log4js');
|
import log4js from 'log4js';
|
||||||
const SessionStore = require('../db/SessionStore');
|
const SessionStore = require('../db/SessionStore');
|
||||||
const settings = require('../utils/Settings');
|
const settings = require('../utils/Settings');
|
||||||
const stats = require('../stats');
|
import stats from '../stats';
|
||||||
const util = require('util');
|
import util from 'util';
|
||||||
const webaccess = require('./express/webaccess');
|
const webaccess = require('./express/webaccess');
|
||||||
|
|
||||||
import SecretRotator from '../security/SecretRotator';
|
import SecretRotator from '../security/SecretRotator';
|
||||||
|
|
||||||
// TODO once we have ESM we can use the type of the class
|
let secretRotator: SecretRotator|null = null;
|
||||||
let secretRotator: any|null = null;
|
|
||||||
const logger = log4js.getLogger('http');
|
const logger = log4js.getLogger('http');
|
||||||
let serverName:string;
|
let serverName:string;
|
||||||
let sessionStore: { shutdown: () => void; } | null;
|
let sessionStore: { shutdown: () => void; } | null;
|
||||||
|
@ -126,7 +127,7 @@ exports.restartServer = async () => {
|
||||||
exports.server = http.createServer(app);
|
exports.server = http.createServer(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
app.use((req:any, res:any, next:Function) => {
|
app.use((req, res, next) => {
|
||||||
// res.header("X-Frame-Options", "deny"); // breaks embedded pads
|
// res.header("X-Frame-Options", "deny"); // breaks embedded pads
|
||||||
if (settings.ssl) {
|
if (settings.ssl) {
|
||||||
// we use SSL
|
// we use SSL
|
||||||
|
@ -165,10 +166,10 @@ exports.restartServer = async () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Measure response time
|
// Measure response time
|
||||||
app.use((req:any, res:any, next:Function) => {
|
app.use((req, res, next) => {
|
||||||
const stopWatch = stats.timer('httpRequests').start();
|
const stopWatch = stats.timer('httpRequests').start();
|
||||||
const sendFn = res.send.bind(res);
|
const sendFn = res.send.bind(res);
|
||||||
res.send = (...args: any) => { stopWatch.end(); sendFn(...args); };
|
res.send = (...args) => { stopWatch.end(); return sendFn(...args); };
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -178,7 +179,7 @@ exports.restartServer = async () => {
|
||||||
// anyway.
|
// anyway.
|
||||||
if (!(settings.loglevel === 'WARN' && settings.loglevel === 'ERROR')) {
|
if (!(settings.loglevel === 'WARN' && settings.loglevel === 'ERROR')) {
|
||||||
app.use(log4js.connectLogger(logger, {
|
app.use(log4js.connectLogger(logger, {
|
||||||
level: log4js.levels.DEBUG,
|
level: log4js.levels.DEBUG.levelStr,
|
||||||
format: ':status, :method :url',
|
format: ':status, :method :url',
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import {ArgsExpressType} from "../../types/ArgsExpressType";
|
import {ArgsExpressType} from "../../types/ArgsExpressType";
|
||||||
import {ErrorCaused} from "../../types/ErrorCaused";
|
import {ErrorCaused} from "../../types/ErrorCaused";
|
||||||
|
|
||||||
const stats = require('../../stats');
|
import stats from '../../stats';
|
||||||
|
|
||||||
exports.expressCreateServer = (hook_name:string, args: ArgsExpressType, cb:Function) => {
|
exports.expressCreateServer = (hook_name:string, args: ArgsExpressType, cb:Function) => {
|
||||||
exports.app = args.app;
|
exports.app = args.app;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import {MapArrayType, MapType} from "../types/MapType";
|
import type {MapArrayType} from "../types/MapType";
|
||||||
import {I18nPluginDefs} from "../types/I18nPluginDefs";
|
import {I18nPluginDefs} from "../types/I18nPluginDefs";
|
||||||
|
|
||||||
const languages = require('languages4translatewiki');
|
const languages = require('languages4translatewiki');
|
||||||
|
|
|
@ -64,7 +64,7 @@ const intervalStart = (t:number, interval:number) => t - mod(t, interval);
|
||||||
* from a long-lived secret stored in the database (generated if missing).
|
* from a long-lived secret stored in the database (generated if missing).
|
||||||
*/
|
*/
|
||||||
export class SecretRotator {
|
export class SecretRotator {
|
||||||
private readonly secrets: string[];
|
readonly secrets: string[];
|
||||||
private readonly _dbPrefix
|
private readonly _dbPrefix
|
||||||
private readonly _interval
|
private readonly _interval
|
||||||
private readonly _legacyStaticSecret
|
private readonly _legacyStaticSecret
|
||||||
|
|
|
@ -55,7 +55,7 @@ const pluginDefs = require('../static/js/pluginfw/plugin_defs');
|
||||||
const plugins = require('../static/js/pluginfw/plugins');
|
const plugins = require('../static/js/pluginfw/plugins');
|
||||||
const installer = require('../static/js/pluginfw/installer');
|
const installer = require('../static/js/pluginfw/installer');
|
||||||
const {Gate} = require('./utils/promises');
|
const {Gate} = require('./utils/promises');
|
||||||
import * as stats from './stats';
|
import stats from './stats';
|
||||||
|
|
||||||
const logger = log4js.getLogger('server');
|
const logger = log4js.getLogger('server');
|
||||||
|
|
||||||
|
@ -107,7 +107,9 @@ exports.start = async () => {
|
||||||
// Check if Etherpad version is up-to-date
|
// Check if Etherpad version is up-to-date
|
||||||
UpdateCheck.check();
|
UpdateCheck.check();
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
stats.gauge('memoryUsage', () => process.memoryUsage().rss);
|
stats.gauge('memoryUsage', () => process.memoryUsage().rss);
|
||||||
|
// @ts-ignore
|
||||||
stats.gauge('memoryUsageHeap', () => process.memoryUsage().heapUsed);
|
stats.gauge('memoryUsageHeap', () => process.memoryUsage().heapUsed);
|
||||||
|
|
||||||
process.on('uncaughtException', (err: ErrorCaused) => {
|
process.on('uncaughtException', (err: ErrorCaused) => {
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import measured from 'measured-core';
|
import measured from 'measured-core';
|
||||||
|
|
||||||
module.exports = measured.createCollection();
|
export default measured.createCollection();
|
||||||
|
|
||||||
module.exports.shutdown = async (hookName: string, context:any) => {
|
export const shutdown = async (hookName: string, context:any) => {
|
||||||
module.exports.end();
|
module.exports.end();
|
||||||
};
|
};
|
||||||
|
|
6
src/package-lock.json
generated
6
src/package-lock.json
generated
|
@ -512,6 +512,12 @@
|
||||||
"minipass": "^4.0.0"
|
"minipass": "^4.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@types/underscore": {
|
||||||
|
"version": "1.11.15",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/underscore/-/underscore-1.11.15.tgz",
|
||||||
|
"integrity": "sha512-HP38xE+GuWGlbSRq9WrZkousaQ7dragtZCruBVMi0oX1migFZavZ3OROKHSkNp/9ouq82zrWtZpg18jFnVN96g==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"@types/unist": {
|
"@types/unist": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.0.tgz",
|
||||||
|
|
|
@ -80,8 +80,8 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/async": "^3.2.24",
|
"@types/async": "^3.2.24",
|
||||||
"typescript": "^5.3.3",
|
|
||||||
"@types/node": "^20.11.5",
|
"@types/node": "^20.11.5",
|
||||||
|
"@types/underscore": "^1.11.15",
|
||||||
"eslint": "^8.56.0",
|
"eslint": "^8.56.0",
|
||||||
"eslint-config-etherpad": "^3.0.22",
|
"eslint-config-etherpad": "^3.0.22",
|
||||||
"etherpad-cli-client": "^2.0.2",
|
"etherpad-cli-client": "^2.0.2",
|
||||||
|
@ -93,7 +93,8 @@
|
||||||
"set-cookie-parser": "^2.6.0",
|
"set-cookie-parser": "^2.6.0",
|
||||||
"sinon": "^17.0.1",
|
"sinon": "^17.0.1",
|
||||||
"split-grid": "^1.0.11",
|
"split-grid": "^1.0.11",
|
||||||
"supertest": "^6.3.4"
|
"supertest": "^6.3.4",
|
||||||
|
"typescript": "^5.3.3"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.18.2",
|
"node": ">=18.18.2",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue