mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-03 06:07:19 +02:00
Declare window.navigator typing
This commit is contained in:
parent
8c446ceec3
commit
e1ba2344b7
@ -318,7 +318,7 @@ export class SettingsDialog extends NavigationDialog {
|
||||
pref: PrefKey.USER_AGENT_PROFILE,
|
||||
multiLines: true,
|
||||
onCreated: (setting, $control) => {
|
||||
const defaultUserAgent = (window.navigator as any).orgUserAgent || window.navigator.userAgent;
|
||||
const defaultUserAgent = window.navigator.orgUserAgent || window.navigator.userAgent;
|
||||
|
||||
const $inpCustomUserAgent = CE<HTMLInputElement>('input', {
|
||||
type: 'text',
|
||||
|
5
src/types/global.d.ts
vendored
5
src/types/global.d.ts
vendored
@ -45,4 +45,9 @@ declare global {
|
||||
MeControl: any;
|
||||
adobe: any;
|
||||
}
|
||||
|
||||
interface Navigator {
|
||||
orgUserAgent?: string;
|
||||
orgUserAgentData?: any;
|
||||
}
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ export class UserAgent {
|
||||
}
|
||||
|
||||
static getDefault(): string {
|
||||
return (window.navigator as any).orgUserAgent || window.navigator.userAgent;
|
||||
return window.navigator.orgUserAgent || window.navigator.userAgent;
|
||||
}
|
||||
|
||||
static get(profile: UserAgentProfile): string {
|
||||
@ -123,12 +123,12 @@ export class UserAgent {
|
||||
|
||||
// Clear data of navigator.userAgentData, force xCloud to detect browser based on navigator.userAgent
|
||||
if ('userAgentData' in window.navigator) {
|
||||
(window.navigator as any).orgUserAgentData = (window.navigator as any).userAgentData;
|
||||
window.navigator.orgUserAgentData = window.navigator.userAgentData;
|
||||
Object.defineProperty(window.navigator, 'userAgentData', {});
|
||||
}
|
||||
|
||||
// Override navigator.userAgent
|
||||
(window.navigator as any).orgUserAgent = window.navigator.userAgent;
|
||||
window.navigator.orgUserAgent = window.navigator.userAgent;
|
||||
Object.defineProperty(window.navigator, 'userAgent', {
|
||||
value: newUserAgent,
|
||||
});
|
||||
|
@ -44,7 +44,7 @@ export function checkForUpdate() {
|
||||
* Disable PWA requirement on Safari
|
||||
*/
|
||||
export function disablePwa() {
|
||||
const userAgent = ((window.navigator as any).orgUserAgent || window.navigator.userAgent || '').toLowerCase();
|
||||
const userAgent = (window.navigator.orgUserAgent || window.navigator.userAgent || '').toLowerCase();
|
||||
if (!userAgent) {
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user