Add setting to bypass region restriction

This commit is contained in:
redphx
2024-07-13 17:27:40 +07:00
parent ce1901b300
commit ef2e0892bc
7 changed files with 33 additions and 9 deletions

View File

@@ -12,7 +12,17 @@ import { getPreferredServerRegion } from "./region";
export
class XcloudInterceptor {
static async #handleLogin(request: RequestInfo | URL, init?: RequestInit) {
if (getPref(PrefKey.SERVER_BYPASS_RESTRICTION)) {
(request as Request).headers.set('X-Forwarded-For', '9.9.9.9');
}
const response = await NATIVE_FETCH(request, init);
if (response.status !== 200) {
// Unsupported region
BxEvent.dispatch(window, BxEvent.XCLOUD_SERVERS_UNAVAILABLE);
return response;
}
const obj = await response.clone().json();
// Preload Remote Play