aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorcglatot <[email protected]>2020-07-07 12:51:43 +0100
committercglatot <[email protected]>2020-07-07 12:51:43 +0100
commitd1ccf6836e660d89bf550253d73b8568e126cbbc (patch)
tree2d33ae7b8f30feff55fbfc60bf4fd6b9088927c6
parent68a3a2f769683a733ad3e7129b8a78c54324d0ca (diff)
downloadpasta-d1ccf6836e660d89bf550253d73b8568e126cbbc.tar.gz
pasta-d1ccf6836e660d89bf550253d73b8568e126cbbc.zip
Fix for mobile site
-rw-r--r--js/main.js34
1 files changed, 24 insertions, 10 deletions
diff --git a/js/main.js b/js/main.js
index 716e8d8..12a2368 100644
--- a/js/main.js
+++ b/js/main.js
@@ -41,16 +41,30 @@ $(document).ready(() => {
}
}
// SET THE VARIABLES FOR PLEX PIN AUTH REQUESTS
- let browserInfo = getBrowser();
- // Set the clientID, this might get overridden if one is saved to localstorage
- clientIdentifier = `PASTA-cglatot-${Date.now()}-${Math.round(Math.random() * 1000)}`;
- // Set the OS
- deviceInfo = browserInfo.os;
- // Set the web browser and version
- pastaPlatform = browserInfo.browser;
- pastaPlatformVersion = browserInfo.browserVersion;
- // Set the main display name
- deviceName = `PASTA (${pastaPlatform})`;
+ try {
+ let browserInfo = getBrowser();
+ // Set the clientID, this might get overridden if one is saved to localstorage
+ clientIdentifier = `PASTA-cglatot-${Date.now()}-${Math.round(Math.random() * 1000)}`;
+ // Set the OS
+ deviceInfo = browserInfo.os || "";
+ // Set the web browser and version
+ pastaPlatform = browserInfo.browser || "";
+ pastaPlatformVersion = browserInfo.browserVersion || "";
+ // Set the main display name
+ deviceName = `PASTA (${pastaPlatform})` || "PASTA";
+ } catch (e) {
+ console.log(e);
+ // Fallback values
+ // Set the clientID, this might get overridden if one is saved to localstorage
+ clientIdentifier = `PASTA-cglatot-${Date.now()}-${Math.round(Math.random() * 1000)}`;
+ // Set the OS
+ deviceInfo = "";
+ // Set the web browser and version
+ pastaPlatform = "";
+ pastaPlatformVersion = "";
+ // Set the main display name
+ deviceName = "PASTA";
+ }
// Validation listeners on the Plex URL Input
$('#plexUrl').on("input", () => {