chore(server): fix type issue

This commit is contained in:
Elian Doran
2026-03-22 23:04:51 +02:00
parent b49912bf71
commit ccc0038d4e
2 changed files with 4 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
import type { WebSocketMessage } from "@triliumnext/commons";
import type { ClientMessageHandler, MessagingProvider } from "@triliumnext/core";
import type { IncomingMessage, Server as HttpServer } from "http";
import type express from "express";
import { WebSocket, WebSocketServer } from "ws";
import config from "./config.js";
@@ -20,10 +21,10 @@ export default class WebSocketMessagingProvider implements MessagingProvider {
private clientMap = new Map<string, WebSocket>();
private clientMessageHandler?: ClientMessageHandler;
init(httpServer: HttpServer, sessionParser: SessionParser) {
init(httpServer: HttpServer, sessionParser: express.RequestHandler) {
this.webSocketServer = new WebSocketServer({
verifyClient: (info, done) => {
sessionParser(info.req, {}, () => {
sessionParser(info.req as express.Request, {}, () => {
const allowed = isElectron || (info.req as any).session.loggedIn || (config.General && config.General.noAuthentication);
if (!allowed) {

View File

@@ -60,7 +60,7 @@ export default async function startTriliumServer() {
const httpServer = startHttpServer(app);
const sessionParser = (await import("./routes/session_parser.js")).default;
(getMessagingProvider() as WebSocketMessagingProvider).init(httpServer, sessionParser); // TODO: Not sure why session parser is incompatible.
(getMessagingProvider() as WebSocketMessagingProvider).init(httpServer, sessionParser);
if (utils.isElectron) {
const electronRouting = await import("./routes/electron.js");