@samitouri / QOSami-HFS / commits / ad701d0c

fix: don't serve gui on websockets requests

Massimo Melina committed Jul 8, 2023 at 19:16 UTC ad701d0cdcecf6a48e8c41a43982453e09c69b0c
1 file changed +1 -1
src/serveGuiFiles.ts
+1 -1
@@ -61,7 +61,7 @@ function serveStatic(uri: string): Koa.Middleware {
61 }
62
63 function shouldServeApp(ctx: Koa.Context) {
64 - return ctx.state.serveApp ||= ctx.path.endsWith('/')
64 + return ctx.state.serveApp ||= ctx.path.endsWith('/') && !ctx.headers.upgrade // skip websockets
65 }
66
67 function adjustBundlerLinks(ctx: Koa.Context, uri: string, data: string | Buffer) {