mirror of https://github.com/espruino/BangleApps
commit
3ddd169612
|
@ -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",
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
0.02: Fix JSON save format
|
||||
0.01: First release
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue