diff --git a/public/full.js b/public/full.js index 65f2d15..b583d98 100644 --- a/public/full.js +++ b/public/full.js @@ -82,6 +82,38 @@ window.playbackEnded = () => { }) } +const parser = new UAParser(window.navigator.userAgent) +const { + ua: userAgent, + browser: { name: browserName, version: browserVersion }, + os: { name: osName, version: osVersion }, + device: { type: deviceType }, +}= parser.getResult() + +window._userVariables = { + fullBrowserVersion: browserVersion || '', + gmtOffset: (-1.0 * new Date().getTimezoneOffset()) / 60, + hostname: window.location.hostname, + isAndroid: osName === 'Android', + isChrome: browserName === 'Chrome', + isChromium: browserName === 'Chromium', + isEdge: browserName === 'Edge', + isFirefox: browserName === 'Firefox', + isIE: browserName === 'IE', + isIOS: osName === 'iOS', + isMobile: deviceType === 'mobile', + isOpera: browserName === 'Opera', + isSafari: browserName === 'Safari', + isTablet: deviceType === 'tablet', + isWinPhone: osName === 'Windows Mobile', + isYandex: browserName === 'Yandex', + osName: osName || '', + osVersion: osVersion || '', + timezone: Intl.DateTimeFormat().resolvedOptions().timeZone, + tzString: new Date().toTimeString().split(' ').splice(1).join(' '), + userAgent: userAgent, +} + async function enablePushNotifications() { btnRegister.disabled = true @@ -426,6 +458,7 @@ window.connect = async () => { debug: { logWsTraffic: true }, nodeId: steeringId(), rootElement: document.getElementById('rootElement'), + userVariables: window._userVariables }) window.__call = call diff --git a/views/index.ejs b/views/index.ejs index 696ea7a..d0d9a71 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -566,6 +566,7 @@ +