diff --git a/nginx.conf b/nginx.conf index 4732c9f80..59a1bc30a 100644 --- a/nginx.conf +++ b/nginx.conf @@ -307,7 +307,8 @@ server { if ($worker = "39") { set $worker_port 3040; } if ($worker = "40") { set $worker_port 3041; } - proxy_pass http://127.0.0.1:$worker_port$2; + # Preserve query string by appending $is_args$args + proxy_pass http://127.0.0.1:$worker_port$2$is_args$args; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; diff --git a/src/server/GameServer.ts b/src/server/GameServer.ts index 927b8addc..530391604 100644 --- a/src/server/GameServer.ts +++ b/src/server/GameServer.ts @@ -40,7 +40,6 @@ export class GameServer { private turns: Turn[] = []; private intents: Intent[] = []; public activeClients: Client[] = []; - private LobbyCreatorID: string | undefined; private allClients: Map = new Map(); private clientsDisconnectedStatus: Map = new Map(); private _hasStarted = false; @@ -75,10 +74,9 @@ export class GameServer { public readonly createdAt: number, private config: ServerConfig, public gameConfig: GameConfig, - lobbyCreatorID?: string, + private lobbyCreatorID?: string, ) { this.log = log_.child({ gameID: id }); - this.LobbyCreatorID = lobbyCreatorID ?? undefined; } public updateGameConfig(gameConfig: Partial): void { @@ -140,10 +138,10 @@ export class GameServer { return; } // Log when lobby creator joins private game - if (client.clientID === this.LobbyCreatorID) { + if (client.clientID === this.lobbyCreatorID) { this.log.info("Lobby creator joined", { gameID: this.id, - creatorID: this.LobbyCreatorID, + creatorID: this.lobbyCreatorID, }); } this.log.info("client (re)joining game", { @@ -255,13 +253,11 @@ export class GameServer { // Handle kick_player intent via WebSocket case "kick_player": { - const authenticatedClientID = client.clientID; - // Check if the authenticated client is the lobby creator - if (authenticatedClientID !== this.LobbyCreatorID) { + if (client.clientID !== this.lobbyCreatorID) { this.log.warn(`Only lobby creator can kick players`, { - clientID: authenticatedClientID, - creatorID: this.LobbyCreatorID, + clientID: client.clientID, + creatorID: this.lobbyCreatorID, target: clientMsg.intent.target, gameID: this.id, }); @@ -269,16 +265,16 @@ export class GameServer { } // Don't allow lobby creator to kick themselves - if (authenticatedClientID === clientMsg.intent.target) { + if (client.clientID === clientMsg.intent.target) { this.log.warn(`Cannot kick yourself`, { - clientID: authenticatedClientID, + clientID: client.clientID, }); return; } // Log and execute the kick this.log.info(`Lobby creator initiated kick of player`, { - creatorID: authenticatedClientID, + creatorID: client.clientID, target: clientMsg.intent.target, gameID: this.id, kickMethod: "websocket", @@ -525,10 +521,6 @@ export class GameServer { } } - public isPrivateLobbyCreator(clientID: string): boolean { - return this.LobbyCreatorID === clientID; - } - phase(): GamePhase { const now = Date.now(); const alive: Client[] = [];