mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-08-01 10:56:42 +02:00
Update servers
This commit is contained in:
13
src/enums/bypass-servers.ts
Normal file
13
src/enums/bypass-servers.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
export const BypassServers = {
|
||||
'br': 'Brazil',
|
||||
'jp': 'Japan',
|
||||
'pl': 'Poland',
|
||||
'us': 'United States',
|
||||
}
|
||||
|
||||
export const BypassServerIps = {
|
||||
'br': '169.150.198.66',
|
||||
'jp': '138.199.21.239',
|
||||
'pl': '45.134.212.66',
|
||||
'us': '143.244.47.65',
|
||||
}
|
@@ -8,6 +8,7 @@ import { AppInterface, STATES } from "@utils/global";
|
||||
import { StreamPlayerType, StreamVideoProcessing } from "@enums/stream-player";
|
||||
import { UserAgentProfile } from "@/enums/user-agent";
|
||||
import { UiSection } from "@/enums/ui-sections";
|
||||
import { BypassServers } from "@/enums/bypass-servers";
|
||||
|
||||
export enum PrefKey {
|
||||
LAST_UPDATE_CHECK = 'version_last_check',
|
||||
@@ -128,7 +129,10 @@ export class Preferences {
|
||||
[PrefKey.SERVER_BYPASS_RESTRICTION]: {
|
||||
label: t('bypass-region-restriction'),
|
||||
note: t('use-this-at-your-own-risk'),
|
||||
default: false,
|
||||
default: 'off',
|
||||
options: Object.assign({
|
||||
'off': t('off'),
|
||||
}, BypassServers),
|
||||
},
|
||||
|
||||
[PrefKey.STREAM_PREFERRED_LOCALE]: {
|
||||
|
@@ -8,12 +8,15 @@ import { STATES } from "./global";
|
||||
import { patchIceCandidates } from "./network";
|
||||
import { getPref, PrefKey } from "./preferences";
|
||||
import { getPreferredServerRegion } from "./region";
|
||||
import { BypassServerIps } from "@/enums/bypass-servers";
|
||||
|
||||
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 bypassServer = getPref(PrefKey.SERVER_BYPASS_RESTRICTION);
|
||||
if (bypassServer !== 'off') {
|
||||
const ip = BypassServerIps[bypassServer as keyof typeof BypassServerIps];
|
||||
ip && (request as Request).headers.set('X-Forwarded-For', ip);
|
||||
}
|
||||
|
||||
const response = await NATIVE_FETCH(request, init);
|
||||
|
Reference in New Issue
Block a user