mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-06-19 12:44:58 -04:00
feat: use ultimate express
This commit is contained in:
parent
0a4e7513aa
commit
512cb53249
7 changed files with 89 additions and 213 deletions
|
@ -6,7 +6,7 @@ import createHTTPError from "http-errors";
|
|||
|
||||
const apiHandler = require('./APIHandler')
|
||||
import {serve, setup} from 'swagger-ui-express'
|
||||
import express from "express";
|
||||
import express from "ultimate-express";
|
||||
|
||||
const settings = require('../utils/Settings')
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import _ from 'underscore';
|
|||
// @ts-ignore
|
||||
import cookieParser from 'cookie-parser';
|
||||
import events from 'events';
|
||||
import express from 'express';
|
||||
import express from 'ultimate-express';
|
||||
// @ts-ignore
|
||||
import expressSession from '@etherpad/express-session';
|
||||
import fs from 'fs';
|
||||
|
@ -124,7 +124,7 @@ exports.restartServer = async () => {
|
|||
exports.server = https.createServer(options, app);
|
||||
} else {
|
||||
const http = require('http');
|
||||
exports.server = http.createServer(app);
|
||||
exports.server = app;
|
||||
}
|
||||
|
||||
app.use((req, res, next) => {
|
||||
|
@ -251,7 +251,8 @@ exports.restartServer = async () => {
|
|||
socketsEvents.emit('updated');
|
||||
});
|
||||
});
|
||||
await util.promisify(exports.server.listen).bind(exports.server)(settings.port, settings.ip);
|
||||
app.listen(settings.port);
|
||||
//await util.promisify(exports.server.listen).bind(exports.server)(settings.port, settings.ip);
|
||||
startTime.setValue(Date.now());
|
||||
logger.info('HTTP server listening for connections');
|
||||
};
|
||||
|
|
|
@ -9,6 +9,7 @@ const path = require('path');
|
|||
const _ = require('underscore');
|
||||
const pluginDefs = require('../../static/js/pluginfw/plugin_defs');
|
||||
import existsSync from '../utils/path_exists';
|
||||
import {Express} from "ultimate-express";
|
||||
const settings = require('../utils/Settings');
|
||||
|
||||
// returns all existing messages merged together and grouped by langcode
|
||||
|
@ -123,14 +124,15 @@ const generateLocaleIndex = (locales:MapArrayType<string>) => {
|
|||
};
|
||||
|
||||
|
||||
exports.expressPreSession = async (hookName:string, {app}:any) => {
|
||||
exports.expressPreSession = async (hookName:string, {app}:{app: Express}) => {
|
||||
// regenerate locales on server restart
|
||||
const locales = getAllLocales();
|
||||
const localeIndex = generateLocaleIndex(locales);
|
||||
exports.availableLangs = getAvailableLangs(locales);
|
||||
|
||||
app.get('/locales/:locale', (req:any, res:any) => {
|
||||
app.get('/locales/:locale', (req, res) => {
|
||||
// works with /locale/en and /locale/en.json requests
|
||||
console.log(req.params)
|
||||
const locale = req.params.locale.split('.')[0];
|
||||
if (Object.prototype.hasOwnProperty.call(exports.availableLangs, locale)) {
|
||||
res.setHeader('Cache-Control', `public, max-age=${settings.maxAge}`);
|
||||
|
|
|
@ -5,7 +5,7 @@ import MemoryAdapter from "./OIDCAdapter";
|
|||
import path from "path";
|
||||
const settings = require('../utils/Settings');
|
||||
import {IncomingForm} from 'formidable'
|
||||
import express, {Request, Response} from 'express';
|
||||
import express, {Request, Response} from 'ultimate-express';
|
||||
import {format} from 'url'
|
||||
import {ParsedUrlQuery} from "node:querystring";
|
||||
import {Http2ServerRequest, Http2ServerResponse} from "node:http2";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {Express} from "express";
|
||||
import {Express} from "ultimate-express";
|
||||
|
||||
export type ArgsExpressType = {
|
||||
app:Express,
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
"cross-spawn": "^7.0.6",
|
||||
"ejs": "^3.1.10",
|
||||
"esbuild": "^0.25.2",
|
||||
"express": "4.21.2",
|
||||
"express-rate-limit": "^7.5.0",
|
||||
"fast-deep-equal": "^3.1.3",
|
||||
"find-root": "1.1.0",
|
||||
|
@ -74,6 +73,8 @@
|
|||
"tinycon": "0.6.8",
|
||||
"tsx": "4.19.3",
|
||||
"ueberdb2": "^5.0.6",
|
||||
"express": "npm:ultimate-express@^1.4.7",
|
||||
"ultimate-express": "^1.4.7",
|
||||
"underscore": "1.13.7",
|
||||
"unorm": "1.6.0",
|
||||
"wtfnode": "^0.10.0"
|
||||
|
@ -85,7 +86,6 @@
|
|||
"devDependencies": {
|
||||
"@playwright/test": "^1.52.0",
|
||||
"@types/async": "^3.2.24",
|
||||
"@types/express": "^4.17.21",
|
||||
"@types/formidable": "^3.4.5",
|
||||
"@types/http-errors": "^2.0.4",
|
||||
"@types/jquery": "^3.5.32",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue