mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-07 08:07:18 +02:00
Switch to another Remote Play server if one is down
This commit is contained in:
parent
07e4f9dffd
commit
c1684abf27
@ -21,7 +21,7 @@ const ENABLE_XCLOUD_LOGGER = false;
|
|||||||
const ENABLE_PRELOAD_BX_UI = false;
|
const ENABLE_PRELOAD_BX_UI = false;
|
||||||
const USE_DEV_TOUCH_LAYOUT = false;
|
const USE_DEV_TOUCH_LAYOUT = false;
|
||||||
|
|
||||||
const REMOTE_PLAY_SERVER = 'eus'; // Possible values: wus2 (WestUS2), eus (EastUS), uks (UkSouth)
|
let REMOTE_PLAY_SERVER;
|
||||||
|
|
||||||
const ENABLE_NATIVE_MKB_BETA = false;
|
const ENABLE_NATIVE_MKB_BETA = false;
|
||||||
window.NATIVE_MKB_TITLES = [
|
window.NATIVE_MKB_TITLES = [
|
||||||
@ -3163,22 +3163,47 @@ class RemotePlay {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static #getConsolesList(callback) {
|
static async #getConsolesList(callback) {
|
||||||
if (RemotePlay.#CONSOLES) {
|
if (RemotePlay.#CONSOLES) {
|
||||||
callback();
|
callback();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch(`https://${REMOTE_PLAY_SERVER}.gssv-play-prodxhome.xboxlive.com/v6/servers/home?mr=50`, {
|
let servers;
|
||||||
method: 'GET',
|
if (!REMOTE_PLAY_SERVER) {
|
||||||
headers: {
|
servers = ['wus2', 'eus', 'uks']; // Possible values: wus2 (WestUS2), eus (EastUS), uks (UkSouth)
|
||||||
'Authorization': `Bearer ${RemotePlay.XHOME_TOKEN}`,
|
} else {
|
||||||
},
|
servers = REMOTE_PLAY_SERVER;
|
||||||
}).then(resp => resp.json())
|
}
|
||||||
.then(json => {
|
|
||||||
|
const options = {
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
'Authorization': `Bearer ${RemotePlay.XHOME_TOKEN}`,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
// Test servers one by one
|
||||||
|
for (const server of servers) {
|
||||||
|
try {
|
||||||
|
const url = `https://${server}.gssv-play-prodxhome.xboxlive.com/v6/servers/home?mr=50`;
|
||||||
|
const resp = await fetch(url, options);
|
||||||
|
|
||||||
|
const json = await resp.json();
|
||||||
RemotePlay.#CONSOLES = json.results;
|
RemotePlay.#CONSOLES = json.results;
|
||||||
|
|
||||||
|
// Store working server
|
||||||
|
REMOTE_PLAY_SERVER = server;
|
||||||
|
|
||||||
callback();
|
callback();
|
||||||
});
|
break;
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// None of the servers worked
|
||||||
|
if (!REMOTE_PLAY_SERVER) {
|
||||||
|
RemotePlay.#CONSOLES = [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static showDialog() {
|
static showDialog() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user