From c1a48e7b48ddb4087b63171bde681ea1e79ca76f Mon Sep 17 00:00:00 2001 From: Andrew Gregory Date: Wed, 1 Dec 2021 00:09:52 +0800 Subject: [PATCH 1/7] Try different JSON format --- apps/authentiwatch/interface.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/authentiwatch/interface.html b/apps/authentiwatch/interface.html index 12c0c1d8d..0b7774557 100644 --- a/apps/authentiwatch/interface.html +++ b/apps/authentiwatch/interface.html @@ -333,7 +333,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(); }); } From f127bef66b9c4c88e8094594a90ac4aad53b26e9 Mon Sep 17 00:00:00 2001 From: Andrew Gregory Date: Wed, 1 Dec 2021 00:14:47 +0800 Subject: [PATCH 2/7] Load new JSON format --- apps/authentiwatch/interface.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/authentiwatch/interface.html b/apps/authentiwatch/interface.html index 0b7774557..17b7648ea 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 saved = JSON.parse(data); + tokens = saved.data; updateTokens(); } catch { tokens = []; From 51c91bf9eede044c0093bf265855d149547697d2 Mon Sep 17 00:00:00 2001 From: Andrew Gregory Date: Wed, 1 Dec 2021 00:17:26 +0800 Subject: [PATCH 3/7] Rename variable --- apps/authentiwatch/interface.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/authentiwatch/interface.html b/apps/authentiwatch/interface.html index 17b7648ea..6b39c148b 100644 --- a/apps/authentiwatch/interface.html +++ b/apps/authentiwatch/interface.html @@ -322,8 +322,8 @@ function loadTokens() { Puck.eval(`require('Storage').read(${JSON.stringify('authentiwatch.json')})`,data=>{ Util.hideModal(); try { - let saved = JSON.parse(data); - tokens = saved.data; + let load = JSON.parse(data); + tokens = load.data; updateTokens(); } catch { tokens = []; From 989dc5ccd4ede2fcc8f9bc82d9d5c4ad84981360 Mon Sep 17 00:00:00 2001 From: Andrew Gregory Date: Wed, 1 Dec 2021 00:18:44 +0800 Subject: [PATCH 4/7] Use new JSON format. --- apps/authentiwatch/app.js | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/authentiwatch/app.js b/apps/authentiwatch/app.js index 43eff4709..c1316fe45 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 // From e1c67cf345cf0b1093caa7c41c8e8981de8f24cb Mon Sep 17 00:00:00 2001 From: Andrew Gregory Date: Wed, 1 Dec 2021 00:22:23 +0800 Subject: [PATCH 5/7] Save in new JSON format too --- apps/authentiwatch/app.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/authentiwatch/app.js b/apps/authentiwatch/app.js index c1316fe45..da8b6d220 100644 --- a/apps/authentiwatch/app.js +++ b/apps/authentiwatch/app.js @@ -258,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(); From f094cc6e354ada59d50719bd8af60bfe1f258cb3 Mon Sep 17 00:00:00 2001 From: Andrew Gregory Date: Wed, 1 Dec 2021 00:25:00 +0800 Subject: [PATCH 6/7] Update ChangeLog --- apps/authentiwatch/ChangeLog | 1 + 1 file changed, 1 insertion(+) 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 From 31eaeadee2929e93fdee2ee01974cf2779e5ed13 Mon Sep 17 00:00:00 2001 From: Andrew Gregory Date: Wed, 1 Dec 2021 00:26:39 +0800 Subject: [PATCH 7/7] Update Authentiwatch version --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index 2e338a432..36102264e 100644 --- a/apps.json +++ b/apps.json @@ -4433,7 +4433,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",