Skip to content

Commit 3589861

Browse files
committed
prettier
1 parent 3e6d773 commit 3589861

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/client/Main.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ import {
4545
SendKickPlayerIntentEvent,
4646
SendUpdateGameConfigIntentEvent,
4747
} from "./Transport";
48+
import { TurnstileManager } from "./TurnstileManager";
4849
import { UserSettingModal } from "./UserSettingModal";
4950
import "./UsernameInput";
5051
import { UsernameInput } from "./UsernameInput";
@@ -54,7 +55,6 @@ import {
5455
isInIframe,
5556
translateText,
5657
} from "./Utils";
57-
import { TurnstileManager } from "./TurnstileManager";
5858
import "./components/DesktopNavBar";
5959
import "./components/Footer";
6060
import "./components/MainLayout";
@@ -234,6 +234,7 @@ class Client {
234234
private matchmakingModal: MatchmakingModal;
235235

236236
private gutterAds: GutterAds;
237+
private isJoiningLobby = false;
237238

238239
private turnstileManager: TurnstileManager;
239240
private serverConfigPrefetch: Promise<
@@ -697,6 +698,9 @@ class Client {
697698
}
698699

699700
private handleUrl() {
701+
if (this.isJoiningLobby) {
702+
return;
703+
}
700704
// Check if CrazyGames SDK is enabled first (no hash needed in CrazyGames)
701705
if (crazyGamesSDK.isOnCrazyGames()) {
702706
const lobbyId = crazyGamesSDK.getInviteGameId();
@@ -802,13 +806,15 @@ class Client {
802806
private async handleJoinLobby(event: CustomEvent<JoinLobbyEvent>) {
803807
const lobby = event.detail;
804808
const joinAttemptId = ++this.joinAttemptId;
809+
this.isJoiningLobby = true;
805810
console.log(`joining lobby ${lobby.gameID}`);
806811
if (this.gameStop !== null) {
807812
console.log("joining lobby, stopping existing game");
808813
this.gameStop(true);
809814
document.body.classList.remove("in-game");
810815
}
811816
if (lobby.source === "public") {
817+
this.joinModal?.close();
812818
this.joinPublicModal?.open(lobby.gameID, lobby.publicLobbyInfo);
813819
}
814820
const configPromise = this.getServerConfigPrefetched();
@@ -907,6 +913,7 @@ class Client {
907913
this.gutterAds.hide();
908914
},
909915
() => {
916+
this.isJoiningLobby = false;
910917
this.joinModal.close();
911918
this.joinPublicModal?.closeWithoutLeaving();
912919
this.publicLobby.stop();
@@ -950,6 +957,7 @@ class Client {
950957

951958
private async handleLeaveLobby(/* event: CustomEvent */) {
952959
this.joinAttemptId++;
960+
this.isJoiningLobby = false;
953961
if (this.gameStop === null) {
954962
try {
955963
history.replaceState(null, "", "/");

src/client/TurnstileManager.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ export class TurnstileManager {
5252
}
5353
}
5454

55-
async getTokenForJoin(
56-
gameStartInfo?: GameStartInfo,
57-
): Promise<string | null> {
55+
async getTokenForJoin(gameStartInfo?: GameStartInfo): Promise<string | null> {
5856
const config = await this.getServerConfig();
5957
if (
6058
config.env() === GameEnv.Dev ||

0 commit comments

Comments
 (0)