From ddb234673cf962c604855151210e65dc78203c91 Mon Sep 17 00:00:00 2001 From: redphx <96280+redphx@users.noreply.github.com> Date: Wed, 31 Jul 2024 17:43:46 +0700 Subject: [PATCH] Update better-xcloud.user.js --- dist/better-xcloud.user.js | 52 ++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/dist/better-xcloud.user.js b/dist/better-xcloud.user.js index 40c81bf..86c838e 100644 --- a/dist/better-xcloud.user.js +++ b/dist/better-xcloud.user.js @@ -13,6 +13,27 @@ // @downloadURL https://github.com/redphx/better-xcloud/releases/latest/download/better-xcloud.user.js // ==/UserScript== "use strict"; + +/* ADDITIONAL CODE */ + +var DEFAULT_FLAGS = { + CheckForUpdate: !0, + EnableXcloudLogging: !1, + SafariWorkaround: !0, + ForceNativeMkbTitles: [], + FeatureGates: null, + DeviceInfo: { + deviceType: "unknown" + } +}, BX_FLAGS = Object.assign(DEFAULT_FLAGS, window.BX_FLAGS || {}); +try { + delete window.BX_FLAGS; +} catch (e) { +} +if (!BX_FLAGS.DeviceInfo.userAgent) + BX_FLAGS.DeviceInfo.userAgent = window.navigator.userAgent; +var NATIVE_FETCH = window.fetch; + var SMART_TV_UNIQUE_ID = "FC4A1DA2-711C-4E9C-BC7F-047AF8A672EA", CHROMIUM_VERSION = "123.0.0.0"; if (!!window.chrome || window.navigator.userAgent.includes("Chrome")) { const match = window.navigator.userAgent.match(/\s(?:Chrome|Edg)\/([\d\.]+)/); @@ -35,7 +56,7 @@ class UserAgent { }; static init() { if (UserAgent.#config = JSON.parse(window.localStorage.getItem(UserAgent.STORAGE_KEY) || "{}"), !UserAgent.#config.profile) - UserAgent.#config.profile = "default"; + UserAgent.#config.profile = BX_FLAGS.DeviceInfo.deviceType === "android-tv" || BX_FLAGS.DeviceInfo.deviceType === "webos" ? "vr-oculus" : "default"; if (!UserAgent.#config.custom) UserAgent.#config.custom = ""; UserAgent.spoof(); @@ -146,27 +167,6 @@ var BxEvent; })(BxEvent ||= {}); window.BxEvent = BxEvent; - -/* ADDITIONAL CODE */ - -var DEFAULT_FLAGS = { - CheckForUpdate: !0, - EnableXcloudLogging: !1, - SafariWorkaround: !0, - ForceNativeMkbTitles: [], - FeatureGates: null, - DeviceInfo: { - deviceType: "unknown" - } -}, BX_FLAGS = Object.assign(DEFAULT_FLAGS, window.BX_FLAGS || {}); -try { - delete window.BX_FLAGS; -} catch (e) { -} -if (!BX_FLAGS.DeviceInfo.userAgent) - BX_FLAGS.DeviceInfo.userAgent = window.navigator.userAgent; -var NATIVE_FETCH = window.fetch; - class NavigationUtils { static setNearby($elm, nearby) { $elm.nearby = $elm.nearby || {}; @@ -5764,8 +5764,10 @@ class HeaderSection { } static checkHeader() { if (!HeaderSection.#$buttonsWrapper.isConnected) { - const $rightHeader = document.querySelector("#PageContent div[class*=EdgewaterHeader-module__rightSectionSpacing]"); - HeaderSection.#injectSettingsButton($rightHeader); + let $target = document.querySelector("#PageContent div[class*=EdgewaterHeader-module__rightSectionSpacing]"); + if (!$target) + $target = document.querySelector("div[class^=UnsupportedMarketPage-module__buttons]"); + $target && HeaderSection.#injectSettingsButton($target); } } static showRemotePlayButton() { @@ -7868,7 +7870,7 @@ window.addEventListener("popstate", onHistoryChanged); window.history.pushState = patchHistoryMethod("pushState"); window.history.replaceState = patchHistoryMethod("replaceState"); window.addEventListener(BxEvent.XCLOUD_SERVERS_UNAVAILABLE, (e) => { - STATES.supportedRegion = !1, window.setTimeout(HeaderSection.watchHeader, 2000); + STATES.supportedRegion = !1, window.setTimeout(HeaderSection.watchHeader, 2000), SettingsNavigationDialog.getInstance().show(); }); window.addEventListener(BxEvent.XCLOUD_SERVERS_READY, (e) => { HeaderSection.watchHeader();