From 15ac42b4c1abb88f8be6f38acc596026c6e9ae99 Mon Sep 17 00:00:00 2001 From: Ryan <7389646+ryanbarlow97@users.noreply.github.com> Date: Tue, 19 May 2026 03:20:29 +0100 Subject: [PATCH] streamer mode bugfix (#3953) ## Description: fixes https://github.com/openfrontio/OpenFrontIO/issues/3572 streamer mode bufix ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced ## Please put your Discord username so you can be contacted if a bug or regression is found: w.o.n --- src/client/HostLobbyModal.ts | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/client/HostLobbyModal.ts b/src/client/HostLobbyModal.ts index 5b683ba56..b3991e000 100644 --- a/src/client/HostLobbyModal.ts +++ b/src/client/HostLobbyModal.ts @@ -10,6 +10,7 @@ import { GameMode, UnitType, } from "../core/game/Game"; +import { UserSettings } from "../core/game/UserSettings"; import { ClientInfo, GameConfig, @@ -92,6 +93,7 @@ export class HostLobbyModal extends BaseModal { private botsUpdateTimer: number | null = null; private nationsUpdateTimer: number | null = null; private mapLoader = terrainMapFileLoader; + private userSettings = new UserSettings(); private leaveLobbyOnClose = true; @@ -130,9 +132,18 @@ export class HostLobbyModal extends BaseModal { } private updateHistory(url: string): void { - if (!crazyGamesSDK.isOnCrazyGames()) { - history.replaceState(null, "", url); + if (crazyGamesSDK.isOnCrazyGames()) { + return; } + history.replaceState(null, "", url); + } + + private updateLobbyHistory(lobbyUrl: string): void { + if (crazyGamesSDK.isOnCrazyGames()) { + return; + } + const lobbyIdHidden = !this.userSettings.lobbyIdVisibility(); + history.replaceState(null, "", lobbyIdHidden ? "/streamer-mode" : lobbyUrl); } private startLobbyUpdates() { @@ -426,7 +437,7 @@ export class HostLobbyModal extends BaseModal { // Copy immediately so the host can share the link without waiting for the // server. If lobby creation fails, clear the clipboard to avoid a dead link. void this.constructUrl().then(async (url) => { - this.updateHistory(url); + this.updateLobbyHistory(url); await this.updateComplete; void (this.querySelector("copy-button") as CopyButton)?.handleCopy(); }); @@ -926,7 +937,7 @@ export class HostLobbyModal extends BaseModal { ? this.spawnImmunityDurationMinutes * 60 * 10 : 0; const url = await this.constructUrl(); - this.updateHistory(url); + this.updateLobbyHistory(url); this.dispatchEvent( new CustomEvent("update-game-config", { detail: {