Update better-xcloud.user.js

This commit is contained in:
redphx
2024-07-06 20:58:08 +07:00
parent cafeed1a3c
commit 5763701355

View File

@@ -25,8 +25,29 @@ var UserAgentProfile;
UserAgentProfile2["CUSTOM"] = "custom"; UserAgentProfile2["CUSTOM"] = "custom";
})(UserAgentProfile || (UserAgentProfile = {})); })(UserAgentProfile || (UserAgentProfile = {}));
// src/utils/bx-flags.ts
/* ADDITIONAL CODE */
var DEFAULT_FLAGS = {
CheckForUpdate: !0,
PreloadRemotePlay: !0,
PreloadUi: !1,
EnableXcloudLogging: !1,
SafariWorkaround: !0,
UseDevTouchLayout: !1,
ForceNativeMkbTitles: [],
FeatureGates: null,
ScriptUi: "default"
}, BX_FLAGS = Object.assign(DEFAULT_FLAGS, window.BX_FLAGS || {});
try {
delete window.BX_FLAGS;
} catch (e) {
}
var NATIVE_FETCH = window.fetch;
// src/utils/user-agent.ts // src/utils/user-agent.ts
var CHROMIUM_VERSION = "123.0.0.0"; var SMART_TV_UNIQUE_ID = "FC4A1DA2-711C-4E9C-BC7F-047AF8A672EA", CHROMIUM_VERSION = "123.0.0.0";
if (!!window.chrome || window.navigator.userAgent.includes("Chrome")) { if (!!window.chrome || window.navigator.userAgent.includes("Chrome")) {
const match = window.navigator.userAgent.match(/\s(?:Chrome|Edg)\/([\d\.]+)/); const match = window.navigator.userAgent.match(/\s(?:Chrome|Edg)\/([\d\.]+)/);
if (match) if (match)
@@ -42,8 +63,8 @@ class UserAgent {
static #USER_AGENTS = { static #USER_AGENTS = {
[UserAgentProfile.WINDOWS_EDGE]: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${CHROMIUM_VERSION} Safari/537.36 Edg/${CHROMIUM_VERSION}`, [UserAgentProfile.WINDOWS_EDGE]: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${CHROMIUM_VERSION} Safari/537.36 Edg/${CHROMIUM_VERSION}`,
[UserAgentProfile.MACOS_SAFARI]: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.5.2 Safari/605.1.1", [UserAgentProfile.MACOS_SAFARI]: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.5.2 Safari/605.1.1",
[UserAgentProfile.SMARTTV_GENERIC]: window.navigator.userAgent + " SmartTV", [UserAgentProfile.SMARTTV_GENERIC]: `${window.navigator.userAgent} SmartTV ${SMART_TV_UNIQUE_ID}`,
[UserAgentProfile.SMARTTV_TIZEN]: `Mozilla/5.0 (SMART-TV; LINUX; Tizen 7.0) AppleWebKit/537.36 (KHTML, like Gecko) ${CHROMIUM_VERSION}/7.0 TV Safari/537.36`, [UserAgentProfile.SMARTTV_TIZEN]: `Mozilla/5.0 (SMART-TV; LINUX; Tizen 7.0) AppleWebKit/537.36 (KHTML, like Gecko) ${CHROMIUM_VERSION}/7.0 TV Safari/537.36 ${SMART_TV_UNIQUE_ID}`,
[UserAgentProfile.VR_OCULUS]: window.navigator.userAgent + " OculusBrowser VR" [UserAgentProfile.VR_OCULUS]: window.navigator.userAgent + " OculusBrowser VR"
}; };
static init() { static init() {
@@ -96,7 +117,9 @@ class UserAgent {
const profile = UserAgent.#config.profile; const profile = UserAgent.#config.profile;
if (profile === UserAgentProfile.DEFAULT) if (profile === UserAgentProfile.DEFAULT)
return; return;
const newUserAgent = UserAgent.get(profile); let newUserAgent = UserAgent.get(profile);
if (BX_FLAGS.IsSupportedTvBrowser)
newUserAgent += ` SmartTV ${SMART_TV_UNIQUE_ID}`;
window.navigator.orgUserAgentData = window.navigator.userAgentData, Object.defineProperty(window.navigator, "userAgentData", {}), window.navigator.orgUserAgent = window.navigator.userAgent, Object.defineProperty(window.navigator, "userAgent", { window.navigator.orgUserAgentData = window.navigator.userAgentData, Object.defineProperty(window.navigator, "userAgentData", {}), window.navigator.orgUserAgent = window.navigator.userAgent, Object.defineProperty(window.navigator, "userAgent", {
value: newUserAgent value: newUserAgent
}); });
@@ -117,8 +140,17 @@ var userAgent = window.navigator.userAgent.toLowerCase(), isTv = userAgent.inclu
isPlaying: !1, isPlaying: !1,
appContext: {}, appContext: {},
serverRegions: {}, serverRegions: {},
userAgentHasTouchSupport, browser: {
browserHasTouchSupport, capabilities: {
touch: browserHasTouchSupport,
batteryApi: "getBattery" in window.navigator
}
},
userAgent: {
capabilities: {
touch: userAgentHasTouchSupport
}
},
currentStream: {}, currentStream: {},
remotePlay: {}, remotePlay: {},
pointerServerPort: 9269 pointerServerPort: 9269
@@ -176,27 +208,6 @@ var XcloudEvent;
})(BxEvent || (BxEvent = {})); })(BxEvent || (BxEvent = {}));
window.BxEvent = BxEvent; window.BxEvent = BxEvent;
// src/utils/bx-flags.ts
/* ADDITIONAL CODE */
var DEFAULT_FLAGS = {
CheckForUpdate: !0,
PreloadRemotePlay: !0,
PreloadUi: !1,
EnableXcloudLogging: !1,
SafariWorkaround: !0,
UseDevTouchLayout: !1,
ForceNativeMkbTitles: [],
FeatureGates: null,
ScriptUi: "default"
}, BX_FLAGS = Object.assign(DEFAULT_FLAGS, window.BX_FLAGS || {});
try {
delete window.BX_FLAGS;
} catch (e) {
}
var NATIVE_FETCH = window.fetch;
// src/enums/stream-player.ts // src/enums/stream-player.ts
var StreamPlayerType; var StreamPlayerType;
(function(StreamPlayerType2) { (function(StreamPlayerType2) {
@@ -1172,7 +1183,7 @@ class Preferences {
all: t("tc-all-games"), all: t("tc-all-games"),
off: t("off") off: t("off")
}, },
unsupported: !STATES.userAgentHasTouchSupport, unsupported: !STATES.userAgent.capabilities.touch,
ready: (setting) => { ready: (setting) => {
if (setting.unsupported) if (setting.unsupported)
setting.default = "default"; setting.default = "default";
@@ -1181,7 +1192,7 @@ class Preferences {
[PrefKey.STREAM_TOUCH_CONTROLLER_AUTO_OFF]: { [PrefKey.STREAM_TOUCH_CONTROLLER_AUTO_OFF]: {
label: t("tc-auto-off"), label: t("tc-auto-off"),
default: !1, default: !1,
unsupported: !STATES.userAgentHasTouchSupport unsupported: !STATES.userAgent.capabilities.touch
}, },
[PrefKey.STREAM_TOUCH_CONTROLLER_DEFAULT_OPACITY]: { [PrefKey.STREAM_TOUCH_CONTROLLER_DEFAULT_OPACITY]: {
type: SettingElementType.NUMBER_STEPPER, type: SettingElementType.NUMBER_STEPPER,
@@ -1195,7 +1206,7 @@ class Preferences {
ticks: 10, ticks: 10,
hideSlider: !0 hideSlider: !0
}, },
unsupported: !STATES.userAgentHasTouchSupport unsupported: !STATES.userAgent.capabilities.touch
}, },
[PrefKey.STREAM_TOUCH_CONTROLLER_STYLE_STANDARD]: { [PrefKey.STREAM_TOUCH_CONTROLLER_STYLE_STANDARD]: {
label: t("tc-standard-layout-style"), label: t("tc-standard-layout-style"),
@@ -1205,7 +1216,7 @@ class Preferences {
white: t("tc-all-white"), white: t("tc-all-white"),
muted: t("tc-muted-colors") muted: t("tc-muted-colors")
}, },
unsupported: !STATES.userAgentHasTouchSupport unsupported: !STATES.userAgent.capabilities.touch
}, },
[PrefKey.STREAM_TOUCH_CONTROLLER_STYLE_CUSTOM]: { [PrefKey.STREAM_TOUCH_CONTROLLER_STYLE_CUSTOM]: {
label: t("tc-custom-layout-style"), label: t("tc-custom-layout-style"),
@@ -1214,7 +1225,7 @@ class Preferences {
default: t("default"), default: t("default"),
muted: t("tc-muted-colors") muted: t("tc-muted-colors")
}, },
unsupported: !STATES.userAgentHasTouchSupport unsupported: !STATES.userAgent.capabilities.touch
}, },
[PrefKey.STREAM_SIMPLIFY_MENU]: { [PrefKey.STREAM_SIMPLIFY_MENU]: {
label: t("simplify-stream-menu"), label: t("simplify-stream-menu"),
@@ -1413,7 +1424,7 @@ class Preferences {
}, },
[PrefKey.UI_HOME_CONTEXT_MENU_DISABLED]: { [PrefKey.UI_HOME_CONTEXT_MENU_DISABLED]: {
label: t("disable-home-context-menu"), label: t("disable-home-context-menu"),
default: STATES.browserHasTouchSupport default: STATES.browser.capabilities.touch
}, },
[PrefKey.BLOCK_SOCIAL_FEATURES]: { [PrefKey.BLOCK_SOCIAL_FEATURES]: {
label: t("disable-social-features"), label: t("disable-social-features"),
@@ -3406,7 +3417,7 @@ class StreamSettings {
onChange: () => VibrationManager.updateGlobalVars() onChange: () => VibrationManager.updateGlobalVars()
}] }]
}, },
STATES.userAgentHasTouchSupport && { STATES.userAgent.capabilities.touch && {
group: "touch-controller", group: "touch-controller",
label: t("touch-controller"), label: t("touch-controller"),
items: [{ items: [{
@@ -4217,7 +4228,7 @@ var BxExposed = {
supportedInputTypes.push(InputType.MKB); supportedInputTypes.push(InputType.MKB);
if (getPref(PrefKey.NATIVE_MKB_ENABLED) === "off") if (getPref(PrefKey.NATIVE_MKB_ENABLED) === "off")
supportedInputTypes = supportedInputTypes.filter((i) => i !== InputType.MKB); supportedInputTypes = supportedInputTypes.filter((i) => i !== InputType.MKB);
if (titleInfo.details.hasMkbSupport = supportedInputTypes.includes(InputType.MKB), STATES.userAgentHasTouchSupport) { if (titleInfo.details.hasMkbSupport = supportedInputTypes.includes(InputType.MKB), STATES.userAgent.capabilities.touch) {
let touchControllerAvailability = getPref(PrefKey.STREAM_TOUCH_CONTROLLER); let touchControllerAvailability = getPref(PrefKey.STREAM_TOUCH_CONTROLLER);
if (touchControllerAvailability !== "off" && getPref(PrefKey.STREAM_TOUCH_CONTROLLER_AUTO_OFF)) { if (touchControllerAvailability !== "off" && getPref(PrefKey.STREAM_TOUCH_CONTROLLER_AUTO_OFF)) {
const gamepads = window.navigator.getGamepads(); const gamepads = window.navigator.getGamepads();
@@ -4395,6 +4406,7 @@ function localRedirect(path) {
function setupStreamUi() { function setupStreamUi() {
StreamSettings.getInstance(), onChangeVideoPlayerType(); StreamSettings.getInstance(), onChangeVideoPlayerType();
} }
window.localRedirect = localRedirect;
// src/modules/remote-play.ts // src/modules/remote-play.ts
var LOG_TAG4 = "RemotePlay", RemotePlayConsoleState; var LOG_TAG4 = "RemotePlay", RemotePlayConsoleState;
@@ -4673,7 +4685,7 @@ class StreamBadges {
let now = +new Date; let now = +new Date;
const diffSeconds = Math.ceil((now - this.startTimestamp) / 1000), playtime = this.#secondsToHm(diffSeconds); const diffSeconds = Math.ceil((now - this.startTimestamp) / 1000), playtime = this.#secondsToHm(diffSeconds);
let batteryLevel = "100%", batteryLevelInt = 100, isCharging = !1; let batteryLevel = "100%", batteryLevelInt = 100, isCharging = !1;
if ("getBattery" in navigator) if (STATES.browser.capabilities.batteryApi)
try { try {
const bm = await navigator.getBattery(); const bm = await navigator.getBattery();
if (isCharging = bm.charging, batteryLevelInt = Math.round(bm.level * 100), batteryLevel = `${batteryLevelInt}%`, batteryLevelInt != this.startBatteryLevel) { if (isCharging = bm.charging, batteryLevelInt = Math.round(bm.level * 100), batteryLevel = `${batteryLevelInt}%`, batteryLevelInt != this.startBatteryLevel) {
@@ -4751,7 +4763,7 @@ class StreamBadges {
audio += ` (${bitrate} kHz)`; audio += ` (${bitrate} kHz)`;
} }
let batteryLevel = ""; let batteryLevel = "";
if ("getBattery" in navigator) if (STATES.browser.capabilities.batteryApi)
batteryLevel = "100%"; batteryLevel = "100%";
let server = this.#region; let server = this.#region;
server += "@" + (this.#ipv6 ? "IPv6" : "IPv4"); server += "@" + (this.#ipv6 ? "IPv6" : "IPv4");
@@ -4822,7 +4834,7 @@ class StreamBadges {
height: $video.videoHeight height: $video.videoHeight
}, streamBadges.startTimestamp = +new Date; }, streamBadges.startTimestamp = +new Date;
try { try {
"getBattery" in navigator && navigator.getBattery().then((bm) => { STATES.browser.capabilities.batteryApi && navigator.getBattery().then((bm) => {
streamBadges.startBatteryLevel = Math.round(bm.level * 100); streamBadges.startBatteryLevel = Math.round(bm.level * 100);
}); });
} catch (e2) { } catch (e2) {
@@ -4962,7 +4974,7 @@ function interceptHttpRequests() {
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }
if (STATES.userAgentHasTouchSupport && url.includes("catalog.gamepass.com/sigls/")) { if (STATES.userAgent.capabilities.touch && url.includes("catalog.gamepass.com/sigls/")) {
const response = await NATIVE_FETCH(request, init), obj = await response.clone().json(); const response = await NATIVE_FETCH(request, init), obj = await response.clone().json();
if (url.includes(GamePassCloudGallery.ALL)) if (url.includes(GamePassCloudGallery.ALL))
for (let i = 1;i < obj.length; i++) for (let i = 1;i < obj.length; i++)
@@ -5752,6 +5764,18 @@ true` + ",this._connectionType=";
if (!str2.includes("return{goBack:function(){")) if (!str2.includes("return{goBack:function(){"))
return !1; return !1;
return str2 = str2.replace("return{goBack:function(){", "return window.BX_EXPOSED.dialogRoutes = {goBack:function(){"), str2; return str2 = str2.replace("return{goBack:function(){", "return window.BX_EXPOSED.dialogRoutes = {goBack:function(){"), str2;
},
enableTvRoutes(str2) {
let index = str2.indexOf(".LoginDeviceCode.path,");
if (index < 0)
return !1;
const match = /render:.*?jsx\)\(([^,]+),/.exec(str2.substring(index, index + 100));
if (!match)
return !1;
const funcName = match[1];
if (index = str2.indexOf(`const ${funcName}=e=>{`), index > -1 && (index = str2.indexOf("return ", index)), index > -1 && (index = str2.indexOf("?", index)), index === -1)
return !1;
return str2 = str2.substring(0, index) + "|| true" + str2.substring(index), str2;
} }
}, PATCH_ORDERS = [ }, PATCH_ORDERS = [
...getPref(PrefKey.NATIVE_MKB_ENABLED) === "on" ? [ ...getPref(PrefKey.NATIVE_MKB_ENABLED) === "on" ? [
@@ -5766,6 +5790,7 @@ true` + ",this._connectionType=";
"broadcastPollingMode", "broadcastPollingMode",
"exposeStreamSession", "exposeStreamSession",
"exposeDialogRoutes", "exposeDialogRoutes",
"enableTvRoutes",
getPref(PrefKey.UI_LAYOUT) !== "default" && "websiteLayout", getPref(PrefKey.UI_LAYOUT) !== "default" && "websiteLayout",
getPref(PrefKey.LOCAL_CO_OP_ENABLED) && "supportLocalCoOp", getPref(PrefKey.LOCAL_CO_OP_ENABLED) && "supportLocalCoOp",
getPref(PrefKey.GAME_FORTNITE_FORCE_CONSOLE) && "forceFortniteConsole", getPref(PrefKey.GAME_FORTNITE_FORCE_CONSOLE) && "forceFortniteConsole",
@@ -5781,7 +5806,7 @@ true` + ",this._connectionType=";
"remotePlayKeepAlive", "remotePlayKeepAlive",
"remotePlayDirectConnectUrl", "remotePlayDirectConnectUrl",
"remotePlayDisableAchievementToast", "remotePlayDisableAchievementToast",
STATES.userAgentHasTouchSupport && "patchUpdateInputConfigurationAsync" STATES.userAgent.capabilities.touch && "patchUpdateInputConfigurationAsync"
] : [], ] : [],
...BX_FLAGS.EnableXcloudLogging ? [ ...BX_FLAGS.EnableXcloudLogging ? [
"enableConsoleLogging", "enableConsoleLogging",
@@ -5795,7 +5820,7 @@ true` + ",this._connectionType=";
getPref(PrefKey.AUDIO_ENABLE_VOLUME_CONTROL) && !getPref(PrefKey.STREAM_COMBINE_SOURCES) && "patchAudioMediaStream", getPref(PrefKey.AUDIO_ENABLE_VOLUME_CONTROL) && !getPref(PrefKey.STREAM_COMBINE_SOURCES) && "patchAudioMediaStream",
getPref(PrefKey.AUDIO_ENABLE_VOLUME_CONTROL) && getPref(PrefKey.STREAM_COMBINE_SOURCES) && "patchCombinedAudioVideoMediaStream", getPref(PrefKey.AUDIO_ENABLE_VOLUME_CONTROL) && getPref(PrefKey.STREAM_COMBINE_SOURCES) && "patchCombinedAudioVideoMediaStream",
getPref(PrefKey.STREAM_DISABLE_FEEDBACK_DIALOG) && "skipFeedbackDialog", getPref(PrefKey.STREAM_DISABLE_FEEDBACK_DIALOG) && "skipFeedbackDialog",
...STATES.userAgentHasTouchSupport ? [ ...STATES.userAgent.capabilities.touch ? [
getPref(PrefKey.STREAM_TOUCH_CONTROLLER) === "all" && "patchShowSensorControls", getPref(PrefKey.STREAM_TOUCH_CONTROLLER) === "all" && "patchShowSensorControls",
getPref(PrefKey.STREAM_TOUCH_CONTROLLER) === "all" && "exposeTouchLayoutManager", getPref(PrefKey.STREAM_TOUCH_CONTROLLER) === "all" && "exposeTouchLayoutManager",
(getPref(PrefKey.STREAM_TOUCH_CONTROLLER) === "off" || getPref(PrefKey.STREAM_TOUCH_CONTROLLER_AUTO_OFF)) && "disableTakRenderer", (getPref(PrefKey.STREAM_TOUCH_CONTROLLER) === "off" || getPref(PrefKey.STREAM_TOUCH_CONTROLLER_AUTO_OFF)) && "disableTakRenderer",
@@ -6139,8 +6164,8 @@ var SETTINGS_UI = {
] ]
}, },
[t("touch-controller")]: { [t("touch-controller")]: {
note: !STATES.userAgentHasTouchSupport ? "⚠️ " + t("device-unsupported-touch") : null, note: !STATES.userAgent.capabilities.touch ? "⚠️ " + t("device-unsupported-touch") : null,
unsupported: !STATES.userAgentHasTouchSupport, unsupported: !STATES.userAgent.capabilities.touch,
items: [ items: [
PrefKey.STREAM_TOUCH_CONTROLLER, PrefKey.STREAM_TOUCH_CONTROLLER,
PrefKey.STREAM_TOUCH_CONTROLLER_AUTO_OFF, PrefKey.STREAM_TOUCH_CONTROLLER_AUTO_OFF,
@@ -6259,7 +6284,7 @@ function overridePreloadState() {
} catch (e) { } catch (e) {
BxLogger.error(LOG_TAG6, e); BxLogger.error(LOG_TAG6, e);
} }
if (STATES.userAgentHasTouchSupport) if (STATES.userAgent.capabilities.touch)
try { try {
const sigls = state.xcloud.sigls; const sigls = state.xcloud.sigls;
if (GamePassCloudGallery.TOUCH in sigls) { if (GamePassCloudGallery.TOUCH in sigls) {
@@ -6773,7 +6798,7 @@ var cloneStreamHudButton = function($orgButton, label, svgIcon) {
$container.style.pointerEvents = "auto"; $container.style.pointerEvents = "auto";
}, 100); }, 100);
}; };
if (STATES.browserHasTouchSupport) if (STATES.browser.capabilities.touch)
$container.addEventListener("transitionstart", onTransitionStart), $container.addEventListener("transitionend", onTransitionEnd); $container.addEventListener("transitionstart", onTransitionStart), $container.addEventListener("transitionend", onTransitionEnd);
const $button = $container.querySelector("button"); const $button = $container.querySelector("button");
$button.setAttribute("title", label); $button.setAttribute("title", label);
@@ -6967,7 +6992,7 @@ class GameBar {
const position = getPref(PrefKey.GAME_BAR_POSITION), $gameBar = CE("div", { id: "bx-game-bar", class: "bx-gone", "data-position": position }, $container = CE("div", { class: "bx-game-bar-container bx-offscreen" }), createSvgIcon(position === "bottom-left" ? BxIcon.CARET_RIGHT : BxIcon.CARET_LEFT)); const position = getPref(PrefKey.GAME_BAR_POSITION), $gameBar = CE("div", { id: "bx-game-bar", class: "bx-gone", "data-position": position }, $container = CE("div", { class: "bx-game-bar-container bx-offscreen" }), createSvgIcon(position === "bottom-left" ? BxIcon.CARET_RIGHT : BxIcon.CARET_LEFT));
if (this.actions = [ if (this.actions = [
new ScreenshotAction, new ScreenshotAction,
...STATES.userAgentHasTouchSupport && getPref(PrefKey.STREAM_TOUCH_CONTROLLER) !== "off" ? [new TouchControlAction] : [], ...STATES.userAgent.capabilities.touch && getPref(PrefKey.STREAM_TOUCH_CONTROLLER) !== "off" ? [new TouchControlAction] : [],
new MicrophoneAction new MicrophoneAction
], position === "bottom-right") ], position === "bottom-right")
this.actions.reverse(); this.actions.reverse();
@@ -7153,7 +7178,7 @@ var unload = function() {
}); });
observer.observe(document.documentElement, { subtree: !0, childList: !0 }); observer.observe(document.documentElement, { subtree: !0, childList: !0 });
}, main = function() { }, main = function() {
if (waitForRootDialog(), patchRtcPeerConnection(), patchRtcCodecs(), interceptHttpRequests(), patchVideoApi(), patchCanvasContext(), AppInterface && patchPointerLockApi(), getPref(PrefKey.AUDIO_ENABLE_VOLUME_CONTROL) && patchAudioContext(), getPref(PrefKey.BLOCK_TRACKING) && patchMeControl(), STATES.userAgentHasTouchSupport && TouchController.updateCustomList(), overridePreloadState(), VibrationManager.initialSetup(), BX_FLAGS.CheckForUpdate && checkForUpdate(), addCss(), preloadFonts(), Toast.setup(), getPref(PrefKey.GAME_BAR_POSITION) !== "off" && GameBar.getInstance(), BX_FLAGS.PreloadUi && setupStreamUi(), Screenshot.setup(), GuideMenu.observe(), StreamBadges.setupEvents(), StreamStats.setupEvents(), EmulatedMkbHandler.setupEvents(), Patcher.init(), disablePwa(), getPref(PrefKey.CONTROLLER_SHOW_CONNECTION_STATUS)) if (waitForRootDialog(), patchRtcPeerConnection(), patchRtcCodecs(), interceptHttpRequests(), patchVideoApi(), patchCanvasContext(), AppInterface && patchPointerLockApi(), getPref(PrefKey.AUDIO_ENABLE_VOLUME_CONTROL) && patchAudioContext(), getPref(PrefKey.BLOCK_TRACKING) && patchMeControl(), STATES.userAgent.capabilities.touch && TouchController.updateCustomList(), overridePreloadState(), VibrationManager.initialSetup(), BX_FLAGS.CheckForUpdate && checkForUpdate(), addCss(), preloadFonts(), Toast.setup(), getPref(PrefKey.GAME_BAR_POSITION) !== "off" && GameBar.getInstance(), BX_FLAGS.PreloadUi && setupStreamUi(), Screenshot.setup(), GuideMenu.observe(), StreamBadges.setupEvents(), StreamStats.setupEvents(), EmulatedMkbHandler.setupEvents(), Patcher.init(), disablePwa(), getPref(PrefKey.CONTROLLER_SHOW_CONNECTION_STATUS))
window.addEventListener("gamepadconnected", (e) => showGamepadToast(e.gamepad)), window.addEventListener("gamepaddisconnected", (e) => showGamepadToast(e.gamepad)); window.addEventListener("gamepadconnected", (e) => showGamepadToast(e.gamepad)), window.addEventListener("gamepaddisconnected", (e) => showGamepadToast(e.gamepad));
if (getPref(PrefKey.REMOTE_PLAY_ENABLED)) if (getPref(PrefKey.REMOTE_PLAY_ENABLED))
RemotePlay.detect(); RemotePlay.detect();
@@ -7167,7 +7192,7 @@ if (window.location.pathname.includes("/auth/msa")) {
throw window.history.pushState = function(...args) { throw window.history.pushState = function(...args) {
const url = args[2]; const url = args[2];
if (url && (url.startsWith("/play") || url.substring(6).startsWith("/play"))) { if (url && (url.startsWith("/play") || url.substring(6).startsWith("/play"))) {
window.stop(), window.location.href = "https://www.xbox.com" + url; console.log("Redirecting to xbox.com/play"), window.stop(), window.location.href = "https://www.xbox.com" + url;
return; return;
} }
return nativePushState.apply(this, arguments); return nativePushState.apply(this, arguments);