mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-06 23:57:19 +02:00
Detect hasTouchSupport based on spoofed User-Agent
This commit is contained in:
parent
8bee5b2073
commit
b866cc95a3
@ -6,12 +6,17 @@ export const SCRIPT_HOME = 'https://github.com/redphx/better-xcloud';
|
|||||||
export const AppInterface = window.AppInterface;
|
export const AppInterface = window.AppInterface;
|
||||||
|
|
||||||
UserAgent.init();
|
UserAgent.init();
|
||||||
|
const userAgent = window.navigator.userAgent.toLowerCase();
|
||||||
|
|
||||||
|
const isTv = userAgent.includes('smart-tv') || userAgent.includes('smarttv') || /\baft.*\b/.test(userAgent);
|
||||||
|
const isVr = window.navigator.userAgent.includes('VR') && window.navigator.userAgent.includes('OculusBrowser');
|
||||||
|
const hasTouchSupport = !isTv && !isVr && ('ontouchstart' in window || navigator.maxTouchPoints > 0);
|
||||||
|
|
||||||
export const STATES: BxStates = {
|
export const STATES: BxStates = {
|
||||||
isPlaying: false,
|
isPlaying: false,
|
||||||
appContext: {},
|
appContext: {},
|
||||||
serverRegions: {},
|
serverRegions: {},
|
||||||
hasTouchSupport: ('ontouchstart' in window || navigator.maxTouchPoints > 0),
|
hasTouchSupport: hasTouchSupport,
|
||||||
|
|
||||||
currentStream: {},
|
currentStream: {},
|
||||||
remotePlay: {},
|
remotePlay: {},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user