Support updated settings file

pull/981/head
Andrew Gregory 2021-12-01 22:05:53 +08:00 committed by GitHub
parent 7a9b64a7fd
commit 60a8c487ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 4 deletions

View File

@ -10,8 +10,9 @@ const calculating = "Calculating";
const notokens = "No tokens"; const notokens = "No tokens";
const notsupported = "Not supported"; const notsupported = "Not supported";
var tokens = require("Storage").readJSON("authentiwatch.json", true) || {data:[],count:0}; var settings = require("Storage").readJSON("authentiwatch.json", true) || {tokens:[],misc:{}};
tokens = tokens.data; if (settings.data ) tokens = settings.data ; /* v0.02 settings */
if (settings.tokens) tokens = settings.tokens; /* v0.03+ settings */
// QR Code Text // QR Code Text
// //
@ -272,8 +273,8 @@ function onSwipe(e) {
} }
if (e == -1 && state.curtoken != -1 && tokens[state.curtoken].period <= 0) { if (e == -1 && state.curtoken != -1 && tokens[state.curtoken].period <= 0) {
tokens[state.curtoken].period--; tokens[state.curtoken].period--;
let save={data:tokens,count:tokens.length}; let newsettings={tokens:tokens,misc:settings.misc};
require("Storage").writeJSON("authentiwatch.json", save); require("Storage").writeJSON("authentiwatch.json", newsettings);
state.nextTime = 0; state.nextTime = 0;
state.otp = ""; state.otp = "";
state.hide = 2; state.hide = 2;