mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-07 08:07:18 +02:00
Fix crashing on Kiwi v124
This commit is contained in:
parent
3847c27a1d
commit
e6504d246f
@ -6917,13 +6917,22 @@ class UserAgent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static spoof() {
|
static spoof() {
|
||||||
|
let newUserAgent;
|
||||||
|
|
||||||
const profile = getPref(Preferences.USER_AGENT_PROFILE);
|
const profile = getPref(Preferences.USER_AGENT_PROFILE);
|
||||||
if (profile === UserAgent.PROFILE_DEFAULT) {
|
if (profile === UserAgent.PROFILE_DEFAULT) {
|
||||||
|
// Fix Kiwi 124
|
||||||
|
if (window.navigator.userAgent.includes('Chrome/124.0.0.0')) {
|
||||||
|
newUserAgent = window.navigator.userAgent.replace('Chrome/124.0.0.0', 'Chrome/122.0.0.0')
|
||||||
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const defaultUserAgent = window.navigator.userAgent;
|
}
|
||||||
const userAgent = UserAgent.get(profile) || defaultUserAgent;
|
|
||||||
|
if (!newUserAgent) {
|
||||||
|
newUserAgent = UserAgent.get(profile) || defaultUserAgent;
|
||||||
|
}
|
||||||
|
|
||||||
// Clear data of navigator.userAgentData, force xCloud to detect browser based on navigator.userAgent
|
// Clear data of navigator.userAgentData, force xCloud to detect browser based on navigator.userAgent
|
||||||
Object.defineProperty(window.navigator, 'userAgentData', {});
|
Object.defineProperty(window.navigator, 'userAgentData', {});
|
||||||
@ -6931,10 +6940,10 @@ class UserAgent {
|
|||||||
// Override navigator.userAgent
|
// Override navigator.userAgent
|
||||||
window.navigator.orgUserAgent = window.navigator.userAgent;
|
window.navigator.orgUserAgent = window.navigator.userAgent;
|
||||||
Object.defineProperty(window.navigator, 'userAgent', {
|
Object.defineProperty(window.navigator, 'userAgent', {
|
||||||
value: userAgent,
|
value: newUserAgent,
|
||||||
});
|
});
|
||||||
|
|
||||||
return userAgent;
|
return newUserAgent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user