aboutsummaryrefslogtreecommitdiffhomepage
path: root/js
diff options
context:
space:
mode:
authorcglatot <[email protected]>2020-10-08 18:42:01 +0100
committercglatot <[email protected]>2020-10-08 18:42:01 +0100
commit4cb8e38cb72ddd6e57841ce609a8ddee55b90d4f (patch)
tree26e976f13d31c6481e37b1a01094515e7b3c54e4 /js
parent8251dd6d0dec4aae833e8134b8b4a235b648dacd (diff)
downloadpasta-4cb8e38cb72ddd6e57841ce609a8ddee55b90d4f.tar.gz
pasta-4cb8e38cb72ddd6e57841ce609a8ddee55b90d4f.zip
Update main.js
Diffstat (limited to 'js')
-rw-r--r--js/main.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/js/main.js b/js/main.js
index c063c91..813ba50 100644
--- a/js/main.js
+++ b/js/main.js
@@ -1,7 +1,7 @@
// Variables for the Authorised Devices card
var clientIdentifier; // UID for the device being used
var plexProduct = "PASTA"; // X-Plex-Product - Application name
-var pastaVersion = "1.5.0"; // X-Plex-Version - Application version
+var pastaVersion = "1.5.2"; // X-Plex-Version - Application version
var pastaPlatform; // X-Plex-Platform - Web Browser
var pastaPlatformVersion; // X-Plex-Platform-Version - Web Browser version
var deviceInfo; // X-Plex-Device - Operation system?
@@ -166,9 +166,9 @@ function authenticateWithPlex() {
$('#waitOnPinAuth').show();
$('#loginWithPlexBtn').hide();
- window.open(authAppUrl, 'PlexSignIn', 'width=800,height=730');
+ let popupWindow = window.open(authAppUrl, 'PlexSignIn', 'width=800,height=730');
backOffTimer = Date.now();
- listenForValidPincode(data.id, clientIdentifier, data.code);
+ listenForValidPincode(data.id, clientIdentifier, data.code, popupWindow);
},
"error": (data) => {
console.log("ERROR L121");
@@ -177,7 +177,7 @@ function authenticateWithPlex() {
});
}
-function listenForValidPincode(pinId, clientId, pinCode) {
+function listenForValidPincode(pinId, clientId, pinCode, popWindow) {
let currentTime = Date.now();
if ((currentTime - backOffTimer)/1000 < 180) {
$.ajax({
@@ -196,9 +196,10 @@ function listenForValidPincode(pinId, clientId, pinCode) {
localStorage.pinAuthToken = data.authToken;
plexToken = data.authToken;
checkIfAuthTokenIsValid();
+ popWindow.close();
} else {
setTimeout(() => {
- listenForValidPincode(pinId, clientId, pinCode);
+ listenForValidPincode(pinId, clientId, pinCode, popWindow);
}, 3000); // Check every 3 seconds
}
},