mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-06 07:37:19 +02:00
Fix not able to get Remote Play consoles
This commit is contained in:
parent
06ffcf20f7
commit
d376e4b8be
@ -219,16 +219,17 @@ export class RemotePlay {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch('https://xhome.gssv-play-prod.xboxlive.com/v2/login/user', {
|
const request = new Request('https://xhome.gssv-play-prod.xboxlive.com/v2/login/user', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
offeringId: 'xhome',
|
offeringId: 'xhome',
|
||||||
token: GSSV_TOKEN,
|
token: GSSV_TOKEN,
|
||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json; charset=utf-8',
|
'Content-Type': 'application/json; charset=utf-8',
|
||||||
},
|
},
|
||||||
}).then(resp => resp.json())
|
});
|
||||||
|
fetch(request).then(resp => resp.json())
|
||||||
.then(json => {
|
.then(json => {
|
||||||
RemotePlay.#REGIONS = json.offeringSettings.regions;
|
RemotePlay.#REGIONS = json.offeringSettings.regions;
|
||||||
RemotePlay.XHOME_TOKEN = json.gsToken;
|
RemotePlay.XHOME_TOKEN = json.gsToken;
|
||||||
@ -252,8 +253,8 @@ export class RemotePlay {
|
|||||||
// Test servers one by one
|
// Test servers one by one
|
||||||
for (const region of RemotePlay.#REGIONS) {
|
for (const region of RemotePlay.#REGIONS) {
|
||||||
try {
|
try {
|
||||||
const url = `${region.baseUri}/v6/servers/home?mr=50`;
|
const request = new Request(`${region.baseUri}/v6/servers/home?mr=50`, options);
|
||||||
const resp = await fetch(url, options);
|
const resp = await fetch(request);
|
||||||
|
|
||||||
const json = await resp.json();
|
const json = await resp.json();
|
||||||
RemotePlay.#CONSOLES = json.results;
|
RemotePlay.#CONSOLES = json.results;
|
||||||
|
@ -264,8 +264,11 @@ class XhomeInterceptor {
|
|||||||
opts.body = await clone.text();
|
opts.body = await clone.text();
|
||||||
}
|
}
|
||||||
|
|
||||||
const index = request.url.indexOf('.xboxlive.com');
|
let newUrl = request.url;
|
||||||
let newUrl = STATES.remotePlay.server + request.url.substring(index + 13);
|
if (!newUrl.includes('/servers/home')) {
|
||||||
|
const index = request.url.indexOf('.xboxlive.com');
|
||||||
|
newUrl = STATES.remotePlay.server + request.url.substring(index + 13);
|
||||||
|
}
|
||||||
|
|
||||||
request = new Request(newUrl, opts);
|
request = new Request(newUrl, opts);
|
||||||
let url = (typeof request === 'string') ? request : request.url;
|
let url = (typeof request === 'string') ? request : request.url;
|
||||||
@ -292,7 +295,7 @@ class XcloudInterceptor {
|
|||||||
const obj = await response.clone().json();
|
const obj = await response.clone().json();
|
||||||
|
|
||||||
// Preload Remote Play
|
// Preload Remote Play
|
||||||
BX_FLAGS.PreloadRemotePlay && RemotePlay.preload();
|
getPref(PrefKey.REMOTE_PLAY_ENABLED) && BX_FLAGS.PreloadRemotePlay && RemotePlay.preload();
|
||||||
|
|
||||||
// Store xCloud token
|
// Store xCloud token
|
||||||
RemotePlay.XCLOUD_TOKEN = obj.gsToken;
|
RemotePlay.XCLOUD_TOKEN = obj.gsToken;
|
||||||
@ -573,7 +576,7 @@ export function interceptHttpRequests() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let requestType: RequestType;
|
let requestType: RequestType;
|
||||||
if (STATES.remotePlay.isPlaying || url.includes('/sessions/home')) {
|
if (STATES.remotePlay.isPlaying || url.includes('/sessions/home') || url.includes('xhome.')) {
|
||||||
requestType = RequestType.XHOME;
|
requestType = RequestType.XHOME;
|
||||||
} else {
|
} else {
|
||||||
requestType = RequestType.XCLOUD;
|
requestType = RequestType.XCLOUD;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user