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