diff --git a/docs/screenshots/scr1.png b/docs/screenshots/scr1.png new file mode 100644 index 0000000..12d1a13 Binary files /dev/null and b/docs/screenshots/scr1.png differ diff --git a/docs/screenshots/scr2.png b/docs/screenshots/scr2.png new file mode 100644 index 0000000..e9665c7 Binary files /dev/null and b/docs/screenshots/scr2.png differ diff --git a/docs/screenshots/scr3.png b/docs/screenshots/scr3.png new file mode 100644 index 0000000..98b1832 Binary files /dev/null and b/docs/screenshots/scr3.png differ diff --git a/page/index.js b/page/index.js index c60a457..2f72254 100644 --- a/page/index.js +++ b/page/index.js @@ -23,10 +23,15 @@ Page( }) .catch((x) => { console.log(`Init failed: ${x}`); - let localStorage = new LocalStorage(); - app._options.globalData.TOTPS = JSON.parse( - localStorage.getItem("TOTPs", null) ?? [] - ); + try{ + let localStorage = new LocalStorage(); + app._options.globalData.TOTPS = JSON.parse( + localStorage.getItem("TOTPs", []) + ); + } + catch{ + app._options.globalData.TOTPS = []; + } this.initPage(); }); }, diff --git a/setting/utils/queryParser.js b/setting/utils/queryParser.js index 1a27e22..aca7871 100644 --- a/setting/utils/queryParser.js +++ b/setting/utils/queryParser.js @@ -33,6 +33,7 @@ function getByOtpauthScheme(link){ let period = args[3].split("period=")[1]?.split("&")[0]; //Returns period let digits = args[3].split("digits=")[1]?.split("&")[0]; //Returns digits let algorithm = args[3].split("algorithm=")[1]?.split("&")[0]; //Returns algorithm + let offset = args[3].split("offset=")[1]?.split("&")[0] ?? 0; //Returns offset if (type.toLowerCase() != "totp") throw new Error("Type is not valid, requires 'TOTP'"); @@ -52,7 +53,7 @@ function getByOtpauthScheme(link){ client, digits, period, - 0, + Number(offset), getHashType(algorithm) ); } catch (err) {