From 17c08792e1002926e1d254e3fbec63567f8adb72 Mon Sep 17 00:00:00 2001 From: redphx <96280+redphx@users.noreply.github.com> Date: Fri, 1 Nov 2024 17:02:30 +0700 Subject: [PATCH] Redirect to /en-US/play if visiting from an unsupported region --- dist/better-xcloud.user.js | 6 ++++++ src/utils/bx-exposed.ts | 12 ++++++++++++ 2 files changed, 18 insertions(+) diff --git a/dist/better-xcloud.user.js b/dist/better-xcloud.user.js index 339f174..01bd9d2 100644 --- a/dist/better-xcloud.user.js +++ b/dist/better-xcloud.user.js @@ -5803,6 +5803,12 @@ var BxExposed = { } catch (e) { BxLogger.error(LOG_TAG3, e); } + try { + let xCloud = state.xcloud.authentication.authStatusByStrategy.XCloud; + if (xCloud.type === 3 && xCloud.error.type === "UnsupportedMarketError") window.stop(), window.location.href = "https://www.xbox.com/en-US/play"; + } catch (e) { + BxLogger.error(LOG_TAG3, e); + } return state; }, modifyTitleInfo: function(titleInfo) { diff --git a/src/utils/bx-exposed.ts b/src/utils/bx-exposed.ts index 6b29e00..befe357 100644 --- a/src/utils/bx-exposed.ts +++ b/src/utils/bx-exposed.ts @@ -63,6 +63,18 @@ export const BxExposed = { BxLogger.error(LOG_TAG, e); } + // Redirect to /en-US/play if visiting from an unsupported region + try { + const xCloud = state.xcloud.authentication.authStatusByStrategy.XCloud; + if (xCloud.type === 3 && xCloud.error.type === 'UnsupportedMarketError') { + // Redirect to /en-US/play + window.stop(); + window.location.href = 'https://www.xbox.com/en-US/play'; + } + } catch (e) { + BxLogger.error(LOG_TAG, e); + } + return state; }),