From 5b3ec00426cf8abf489dd1208d8a82364c5457b9 Mon Sep 17 00:00:00 2001 From: yoprogramo Date: Mon, 26 Jul 2021 11:52:29 +0200 Subject: [PATCH] Updated with BLE keys --- lib/nomorepass.js | 9 +++++---- www/js/nomorepass.js | 21 +++++++++++---------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/lib/nomorepass.js b/lib/nomorepass.js index 7f5c0ef..d38fd7b 100644 --- a/lib/nomorepass.js +++ b/lib/nomorepass.js @@ -226,7 +226,7 @@ exports.getQrNomoreKeys = function (site, user, pass, type, extra, callback) { // Protocol 2 reverse // First we made grant then ping // for nomorekeys phisical keys (soundkey or lightkey) - if (type!='SOUNDKEY' && type!='LIGHTKEY') + if (type!='SOUNDKEY' && type!='LIGHTKEY' && type!='BLEKEY') return null; if (site==null) { // site is the id device of origin, if null use generic WEBDEVICE @@ -248,9 +248,10 @@ exports.getQrNomoreKeys = function (site, user, pass, type, extra, callback) { NoMorePass.ticket = data.ticket; if (type=='SOUNDKEY'){ pass = pass.substr(0,14).padEnd(14," "); - } else { - pass=""+parseInt(pass)%65536; - } + } else + if (type=='LIGHTKEY'){ + pass=""+parseInt(pass)%65536; + } var ep = CryptoJS.AES.encrypt(pass, tk); // Make the grant and return text if (typeof extra == 'object') { diff --git a/www/js/nomorepass.js b/www/js/nomorepass.js index 16c23ae..300363d 100644 --- a/www/js/nomorepass.js +++ b/www/js/nomorepass.js @@ -26,19 +26,19 @@ var NomorePass = { NomorePass.config = config; } if (!('getidUrl' in NomorePass.config)) - NomorePass.config.getidUrl = "https://www.nomorepass.com/api/getid.php"; + NomorePass.config.getidUrl = "https://nomorepass.com/api/getid.php"; if (!('checkUrl' in NomorePass.config)) - NomorePass.config.checkUrl = "https://www.nomorepass.com/api/check.php"; + NomorePass.config.checkUrl = "https://nomorepass.com/api/check.php"; if (!('authUrl' in NomorePass.config)) - NomorePass.config.authUrl = "https://www.nomorepass.com/api/auth.php"; + NomorePass.config.authUrl = "https://nomorepass.com/api/auth.php"; if (!('assocUrl' in NomorePass.config)) - NomorePass.config.assocUrl = "https://www.nomorepass.com/api/assoc.php"; + NomorePass.config.assocUrl = "https://nomorepass.com/api/assoc.php"; if (!('pingUrl' in NomorePass.config)) - NomorePass.config.pingUrl = "https://www.nomorepass.com/api/ping.php"; + NomorePass.config.pingUrl = "https://nomorepass.com/api/ping.php"; if (!('referenceUrl' in NomorePass.config)) - NomorePass.config.referenceUrl = "https://www.nomorepass.com/api/reference.php"; + NomorePass.config.referenceUrl = "https://nomorepass.com/api/reference.php"; if (!('grantUrl' in NomorePass.config)) - NomorePass.config.grantUrl = "https://www.nomorepass.com/api/grant.php"; + NomorePass.config.grantUrl = "https://nomorepass.com/api/grant.php"; if (!('apikey' in NomorePass.config)) NomorePass.config.apikey='FREEAPIKEY'; NomorePass.stopped = false; @@ -179,7 +179,7 @@ var NomorePass = { // Protocol 2 reverse // First we made grant then ping // for nomorekeys phisical keys (soundkey or lightkey) - if (type!='SOUNDKEY' && type!='LIGHTKEY') + if (type!='SOUNDKEY' && type!='LIGHTKEY' && type!='BLEKEY') return null; if (site==null) { // site is the id device of origin, if null use generic WEBDEVICE @@ -201,7 +201,8 @@ var NomorePass = { NomorePass.ticket = data.ticket; if (type=='SOUNDKEY'){ pass = pass.substr(0,14).padEnd(14," "); - } else { + } else + if (type=='LIGHTKEY') { pass=""+parseInt(pass)%65536; } var ep = CryptoJS.AES.encrypt(pass, tk); @@ -235,7 +236,7 @@ var NomorePass = { console.log(response); } }); - var text = 'nomorepass://SENDPASS'+tk+data.ticket+site; + var text = 'nomorepass://'+type+tk+data.ticket+site; if (typeof callback == 'function') { callback(text); }