diff --git a/apps.json b/apps.json index 371a4f2f3..56c984034 100644 --- a/apps.json +++ b/apps.json @@ -4434,7 +4434,7 @@ "shortName": "AuthWatch", "icon": "app.png", "screenshots": [{"url":"screenshot.png"}], - "version": "0.01", + "version": "0.02", "description": "Google Authenticator compatible tool.", "tags": "tool", "interface": "interface.html", diff --git a/apps/authentiwatch/ChangeLog b/apps/authentiwatch/ChangeLog index 7b83706bf..67cb00c67 100644 --- a/apps/authentiwatch/ChangeLog +++ b/apps/authentiwatch/ChangeLog @@ -1 +1,2 @@ +0.02: Fix JSON save format 0.01: First release diff --git a/apps/authentiwatch/app.js b/apps/authentiwatch/app.js index 43eff4709..da8b6d220 100644 --- a/apps/authentiwatch/app.js +++ b/apps/authentiwatch/app.js @@ -8,6 +8,7 @@ const algos = { }; var tokens = require("Storage").readJSON("authentiwatch.json", true) || []; +tokens = tokens.data; // QR Code Text // @@ -257,7 +258,8 @@ function onSwipe(e) { } if (e == -1 && state.curtoken != -1 && tokens[state.curtoken].period <= 0) { tokens[state.curtoken].period--; - require("Storage").writeJSON("authentiwatch.json", tokens); + let save={data:tokens,count:tokens.length}; + require("Storage").writeJSON("authentiwatch.json", save); state.nextTime = 0; state.hide = 2; draw(); diff --git a/apps/authentiwatch/interface.html b/apps/authentiwatch/interface.html index 12c0c1d8d..6b39c148b 100644 --- a/apps/authentiwatch/interface.html +++ b/apps/authentiwatch/interface.html @@ -322,7 +322,8 @@ function loadTokens() { Puck.eval(`require('Storage').read(${JSON.stringify('authentiwatch.json')})`,data=>{ Util.hideModal(); try { - tokens = JSON.parse(data); + let load = JSON.parse(data); + tokens = load.data; updateTokens(); } catch { tokens = []; @@ -333,7 +334,8 @@ function loadTokens() { */ function saveTokens() { Util.showModal('Saving...'); - Puck.write(`\x10require('Storage').write(${JSON.stringify('authentiwatch.json')},${JSON.stringify(tokens)})\n`,()=>{ + let save={data:tokens,count:tokens.length}; + Puck.write(`\x10require('Storage').write(${JSON.stringify('authentiwatch.json')},${JSON.stringify(save)})\n`,()=>{ Util.hideModal(); }); }