From cf7e39a59d9e2880981a3e10c54cfafd61349a3f Mon Sep 17 00:00:00 2001 From: Kilian Saffran Date: Mon, 2 Jul 2018 08:55:28 +0200 Subject: [PATCH] license server accessible check --- app_v3/chrome/content/js/license.js | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/app_v3/chrome/content/js/license.js b/app_v3/chrome/content/js/license.js index 4d73ebf..863146f 100644 --- a/app_v3/chrome/content/js/license.js +++ b/app_v3/chrome/content/js/license.js @@ -64,12 +64,26 @@ var license = { if (!Components.isSuccessCode(status)) { document.getElementById("licerror").value="Impossible de verifier la license!"; document.getElementById("licerror").setAttribute("hidden",false); - // Handle error! - //dump("do Nothing! cannot access the server!\n"); + document.getElementById("apploadmsg").value="Serveur de DKS pas accessible! Contacter le support!"; } else { var strdata = NetUtil.readInputStreamToString(inputStream, inputStream.available()); + dump("Data returned:" + strdata + "\n"); - data = JSON.parse(strdata); + try { + data = JSON.parse(strdata); + } catch(e){ + document.getElementById("apploadmsg").value="Impossible de valider la license! Connection internet requis!"; +// var expiration = apppref.getpreference("support.expiration"); +// var today = new Date(); +// var test = today.toLocaleFormat("%Y-%m-%d"); +// var reglid = /(\w{4,})\-(\w{4,})\-(\w{4,})\-(\w{4,})\-(\w{4,})/; +// if (lickey.match(reglid) != "" && (expiration) && (test <= expiration)){ +// navigation.load_deck(2); +// } + dump(e.message); + return data; + } + if (callback != null){ callback(data) } -- 2.39.5