mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-06 15:47:18 +02:00
Update better-xcloud.user.js
This commit is contained in:
parent
0f4195246b
commit
c836e33f7b
79
dist/better-xcloud.user.js
vendored
79
dist/better-xcloud.user.js
vendored
@ -1,7 +1,7 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Better xCloud
|
// @name Better xCloud
|
||||||
// @namespace https://github.com/redphx
|
// @namespace https://github.com/redphx
|
||||||
// @version 6.0.0-beta-2
|
// @version 6.0.0-beta-3
|
||||||
// @description Improve Xbox Cloud Gaming (xCloud) experience
|
// @description Improve Xbox Cloud Gaming (xCloud) experience
|
||||||
// @author redphx
|
// @author redphx
|
||||||
// @license MIT
|
// @license MIT
|
||||||
@ -107,7 +107,7 @@ class UserAgent {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var SCRIPT_VERSION = "6.0.0-beta-2", SCRIPT_VARIANT = "full", AppInterface = window.AppInterface;
|
var SCRIPT_VERSION = "6.0.0-beta-3", SCRIPT_VARIANT = "full", AppInterface = window.AppInterface;
|
||||||
UserAgent.init();
|
UserAgent.init();
|
||||||
var userAgent = window.navigator.userAgent.toLowerCase(), isTv = userAgent.includes("smart-tv") || userAgent.includes("smarttv") || /\baft.*\b/.test(userAgent), isVr = window.navigator.userAgent.includes("VR") && window.navigator.userAgent.includes("OculusBrowser"), browserHasTouchSupport = "ontouchstart" in window || navigator.maxTouchPoints > 0, userAgentHasTouchSupport = !isTv && !isVr && browserHasTouchSupport, STATES = {
|
var userAgent = window.navigator.userAgent.toLowerCase(), isTv = userAgent.includes("smart-tv") || userAgent.includes("smarttv") || /\baft.*\b/.test(userAgent), isVr = window.navigator.userAgent.includes("VR") && window.navigator.userAgent.includes("OculusBrowser"), browserHasTouchSupport = "ontouchstart" in window || navigator.maxTouchPoints > 0, userAgentHasTouchSupport = !isTv && !isVr && browserHasTouchSupport, STATES = {
|
||||||
supportedRegion: !0,
|
supportedRegion: !0,
|
||||||
@ -1304,7 +1304,8 @@ class GlobalSettingsStorage extends BaseSettingsStore {
|
|||||||
options: {
|
options: {
|
||||||
auto: t("default"),
|
auto: t("default"),
|
||||||
"720p": "720p",
|
"720p": "720p",
|
||||||
"1080p": "1080p"
|
"1080p": "1080p",
|
||||||
|
"1080p-hq": "1080p (HQ)"
|
||||||
},
|
},
|
||||||
suggest: {
|
suggest: {
|
||||||
lowest: "720p",
|
lowest: "720p",
|
||||||
@ -1901,8 +1902,9 @@ class GlobalSettingsStorage extends BaseSettingsStore {
|
|||||||
requiredVariants: "full",
|
requiredVariants: "full",
|
||||||
default: "1080p",
|
default: "1080p",
|
||||||
options: {
|
options: {
|
||||||
|
"720p": "720p",
|
||||||
"1080p": "1080p",
|
"1080p": "1080p",
|
||||||
"720p": "720p"
|
"1080p-hq": "1080p (HQ)"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
gameFortniteForceConsole: {
|
gameFortniteForceConsole: {
|
||||||
@ -7259,7 +7261,14 @@ class XhomeInterceptor {
|
|||||||
headers[pair[0]] = pair[1];
|
headers[pair[0]] = pair[1];
|
||||||
headers.authorization = `Bearer ${RemotePlayManager.getInstance().getXhomeToken()}`;
|
headers.authorization = `Bearer ${RemotePlayManager.getInstance().getXhomeToken()}`;
|
||||||
let deviceInfo = XhomeInterceptor.BASE_DEVICE_INFO;
|
let deviceInfo = XhomeInterceptor.BASE_DEVICE_INFO;
|
||||||
if (getPref("xhomeStreamResolution") === "720p") deviceInfo.dev.os.name = "android";
|
switch (getPref("xhomeStreamResolution")) {
|
||||||
|
case "1080p-hq":
|
||||||
|
deviceInfo.dev.os.name = "tizen";
|
||||||
|
break;
|
||||||
|
case "720p":
|
||||||
|
deviceInfo.dev.os.name = "android";
|
||||||
|
break;
|
||||||
|
}
|
||||||
headers["x-ms-device-info"] = JSON.stringify(deviceInfo);
|
headers["x-ms-device-info"] = JSON.stringify(deviceInfo);
|
||||||
let opts = {
|
let opts = {
|
||||||
method: clone.method,
|
method: clone.method,
|
||||||
@ -7649,6 +7658,44 @@ class XcloudInterceptor {
|
|||||||
UKSouth: ["🇬🇧", "europe"],
|
UKSouth: ["🇬🇧", "europe"],
|
||||||
WestEurope: ["🇪🇺", "europe"]
|
WestEurope: ["🇪🇺", "europe"]
|
||||||
};
|
};
|
||||||
|
static BASE_DEVICE_INFO = {
|
||||||
|
appInfo: {
|
||||||
|
env: {
|
||||||
|
clientAppId: window.location.host,
|
||||||
|
clientAppType: "browser",
|
||||||
|
clientAppVersion: "24.17.36",
|
||||||
|
clientSdkVersion: "10.1.14",
|
||||||
|
httpEnvironment: "prod",
|
||||||
|
sdkInstallId: ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
dev: {
|
||||||
|
displayInfo: {
|
||||||
|
dimensions: {
|
||||||
|
widthInPixels: 1920,
|
||||||
|
heightInPixels: 1080
|
||||||
|
},
|
||||||
|
pixelDensity: {
|
||||||
|
dpiX: 1,
|
||||||
|
dpiY: 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
hw: {
|
||||||
|
make: "Microsoft",
|
||||||
|
model: "unknown",
|
||||||
|
sdktype: "web"
|
||||||
|
},
|
||||||
|
os: {
|
||||||
|
name: "windows",
|
||||||
|
ver: "22631.2715",
|
||||||
|
platform: "desktop"
|
||||||
|
},
|
||||||
|
browser: {
|
||||||
|
browserName: "chrome",
|
||||||
|
browserVersion: "125.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
static async handleLogin(request, init) {
|
static async handleLogin(request, init) {
|
||||||
let bypassServer = getPref("serverBypassRestriction");
|
let bypassServer = getPref("serverBypassRestriction");
|
||||||
if (bypassServer !== "off") {
|
if (bypassServer !== "off") {
|
||||||
@ -7687,14 +7734,30 @@ class XcloudInterceptor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
StreamBadges.getInstance().setRegion(badgeRegion);
|
StreamBadges.getInstance().setRegion(badgeRegion);
|
||||||
let body = await request.clone().json();
|
let clone = request.clone(), body = await clone.json(), headers = {};
|
||||||
|
for (let pair of clone.headers.entries())
|
||||||
|
headers[pair[0]] = pair[1];
|
||||||
if (PREF_STREAM_TARGET_RESOLUTION !== "auto") {
|
if (PREF_STREAM_TARGET_RESOLUTION !== "auto") {
|
||||||
let osName = PREF_STREAM_TARGET_RESOLUTION === "720p" ? "android" : "windows";
|
let osName;
|
||||||
|
switch (PREF_STREAM_TARGET_RESOLUTION) {
|
||||||
|
case "1080p-hq":
|
||||||
|
osName = "tizen";
|
||||||
|
let deviceInfo = XcloudInterceptor.BASE_DEVICE_INFO;
|
||||||
|
deviceInfo.dev.os.name = "tizen", headers["x-ms-device-info"] = JSON.stringify(deviceInfo);
|
||||||
|
break;
|
||||||
|
case "1080p":
|
||||||
|
osName = "windows";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
osName = "android";
|
||||||
|
break;
|
||||||
|
}
|
||||||
body.settings.osName = osName;
|
body.settings.osName = osName;
|
||||||
}
|
}
|
||||||
if (PREF_STREAM_PREFERRED_LOCALE !== "default") body.settings.locale = PREF_STREAM_PREFERRED_LOCALE;
|
if (PREF_STREAM_PREFERRED_LOCALE !== "default") body.settings.locale = PREF_STREAM_PREFERRED_LOCALE;
|
||||||
let newRequest = new Request(request, {
|
let newRequest = new Request(request, {
|
||||||
body: JSON.stringify(body)
|
body: JSON.stringify(body),
|
||||||
|
headers
|
||||||
});
|
});
|
||||||
return NATIVE_FETCH(newRequest);
|
return NATIVE_FETCH(newRequest);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user