From de3970807a1bcef931a14d948d4a3f18808e3a27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Paulo=20Barbosa=20Marques=20dos=20Santos?= Date: Tue, 20 Aug 2024 14:14:06 -0500 Subject: [PATCH] add user variable dial params --- public/full.js | 33 +++++++++++++++++++++++++++++++++ views/index.ejs | 1 + 2 files changed, 34 insertions(+) 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 @@ +