From 8bee5b2073face44b3a60285d1797ffc9e599ee6 Mon Sep 17 00:00:00 2001 From: redphx <96280+redphx@users.noreply.github.com> Date: Sat, 11 May 2024 09:39:50 +0700 Subject: [PATCH] Init UserAgent before STATES --- src/index.ts | 4 +--- src/utils/global.ts | 4 ++++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/index.ts b/src/index.ts index 7fa6fd4..d0de5ea 100644 --- a/src/index.ts +++ b/src/index.ts @@ -28,7 +28,7 @@ import { STATES } from "@utils/global"; import { injectStreamMenuButtons } from "@modules/stream/stream-ui"; import { BxLogger } from "@utils/bx-logger"; import { GameBar } from "./modules/game-bar/game-bar"; -import { UserAgent } from "./utils/user-agent"; + // Handle login page if (window.location.pathname.includes('/auth/msa')) { @@ -188,8 +188,6 @@ window.addEventListener(BxEvent.STREAM_STOPPED, e => { function main() { - UserAgent.init(); - // Monkey patches patchRtcPeerConnection(); patchRtcCodecs(); diff --git a/src/utils/global.ts b/src/utils/global.ts index 4614e6b..c7d3303 100644 --- a/src/utils/global.ts +++ b/src/utils/global.ts @@ -1,8 +1,12 @@ +import { UserAgent } from "./user-agent"; + export const SCRIPT_VERSION = Bun.env.SCRIPT_VERSION; export const SCRIPT_HOME = 'https://github.com/redphx/better-xcloud'; export const AppInterface = window.AppInterface; +UserAgent.init(); + export const STATES: BxStates = { isPlaying: false, appContext: {},