From dd3091c78a26ee50a76efee14f596f9e7ba789ea Mon Sep 17 00:00:00 2001 From: SamTV12345 <40429738+samtv12345@users.noreply.github.com> Date: Fri, 8 Mar 2024 18:24:28 +0100 Subject: [PATCH] uSE ESM: --- src/node/db/DB.ts | 4 ++-- src/node/hooks/express/socketio.ts | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/node/db/DB.ts b/src/node/db/DB.ts index 1daab8dd3..542da6735 100644 --- a/src/node/db/DB.ts +++ b/src/node/db/DB.ts @@ -21,9 +21,9 @@ * limitations under the License. */ -const ueberDB = require('ueberdb2'); +import ueberDB from 'ueberdb2'; const settings = require('../utils/Settings'); -const log4js = require('log4js'); +import log4js from 'log4js'; const stats = require('../stats') const logger = log4js.getLogger('ueberDB'); diff --git a/src/node/hooks/express/socketio.ts b/src/node/hooks/express/socketio.ts index cbf08be64..961e2cfd3 100644 --- a/src/node/hooks/express/socketio.ts +++ b/src/node/hooks/express/socketio.ts @@ -17,7 +17,7 @@ const logger = log4js.getLogger('socket.io'); const sockets = new Set(); const socketsEvents = new events.EventEmitter(); -exports.expressCloseServer = async () => { +export const expressCloseServer = async () => { if (io == null) return; logger.info('Closing socket.io engine...'); // Close the socket.io engine to disconnect existing clients and reject new clients. Don't call @@ -48,7 +48,7 @@ exports.expressCloseServer = async () => { logger.info('All socket.io clients have disconnected'); }; -export const socketSessionMiddleware = (args: any) => (socket: any, next: Function) => { +const socketSessionMiddleware = (args: any) => (socket: any, next: Function) => { const req = socket.request; // Express sets req.ip but socket.io does not. Replicate Express's behavior here. if (req.ip == null) { @@ -65,7 +65,7 @@ export const socketSessionMiddleware = (args: any) => (socket: any, next: Functi express.sessionMiddleware(req, {}, next); }; -exports.expressCreateServer = (hookName:string, args:ArgsExpressType, cb:Function) => { +export const expressCreateServer = (hookName:string, args:ArgsExpressType, cb:Function) => { // init socket.io and redirect all requests to the MessageHandler // there shouldn't be a browser that isn't compatible to all // transports in this list at once