@@ -5,7 +5,6 @@ import {createServer} from "node:http";
55import { createServer as createSecureServer } from "node:https" ;
66import type { Socket } from "node:net" ;
77import { posix } from "node:path" ;
8- import { parse } from "node:url" ;
98import bind from "bind-decorator" ;
109import expressStaticGzip from "express-static-gzip" ;
1110import finalhandler from "finalhandler" ;
@@ -157,10 +156,10 @@ export class Frontend extends Extension {
157156 @bind private onUpgrade ( request : IncomingMessage , socket : Socket , head : Buffer ) : void {
158157 this . wss . handleUpgrade ( request , socket , head , ( ws ) => {
159158 // biome-ignore lint/style/noNonNullAssertion: `Only valid for request obtained from Server`
160- const { query } = parse ( request . url ! , true ) ;
159+ const { searchParams } = new URL ( request . url ! , "http://localhost" ) ; // dummy base, may not be absolute
161160 const authToken = settings . get ( ) . frontend . auth_token ;
162161
163- if ( ! authToken || authToken === query . token ) {
162+ if ( ! authToken || authToken === searchParams . get ( " token" ) ) {
164163 this . wss . emit ( "connection" , ws , request ) ;
165164 } else {
166165 ws . close ( 4401 , "Unauthorized" ) ;
0 commit comments