chore: cleanup, v1.1.0

This commit is contained in:
Pavel-Savely Savianok 2025-02-26 01:58:11 +03:00
parent 5fa5455e00
commit 43af7e2055
5 changed files with 19 additions and 14 deletions

View File

@ -6,11 +6,11 @@
"appType": "app",
"version": {
"code": 1,
"name": "1.0.1"
"name": "1.1.0"
},
"icon": "icon.png",
"vender": "zepp",
"description": "TOTP Authenticator for Amazfit devices"
"description": "Another 2FAuthenticator based on TOTP for Zepp Amazfit GTS 4"
},
"permissions": [
"data:os.device.info",

View File

@ -1,12 +1,9 @@
{
"name": "totpfit",
"version": "1.0.0",
"description": "TOTP Authenticator for Amazfit devices",
"version": "1.1.0",
"description": "Another 2FAuthenticator based on TOTP for Zepp Amazfit GTS 4",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"author": "Lisoveliy",
"license": "MIT",
"devDependencies": {
"@zeppos/device-types": "^3.0.0"

View File

@ -1,23 +1,30 @@
import { RenderAddButton } from "./render/totpRenderer";
import { initLoop } from "./render/index/renderer";
import { BasePage } from "@zeppos/zml/base-page";
import { LocalStorage } from '@zos/storage';
import { LocalStorage } from "@zos/storage";
const app = getApp();
let waitForFetch = true;
let localStorage = new LocalStorage();
Page(
BasePage({
onInit() {
this.getTOTPData()
.then((x) => {
app._options.globalData.TOTPS = JSON.parse(x) ?? []
localStorage.setItem('TOTPs', JSON.stringify(app._options.globalData.TOTPS))
app._options.globalData.TOTPS = JSON.parse(x) ?? [];
localStorage.setItem(
"TOTPs",
JSON.stringify(app._options.globalData.TOTPS)
);
this.initPage();
})
.catch((x) => {
console.log(`Init failed: ${x}`)
app._options.globalData.TOTPS = JSON.parse(localStorage.getItem('TOTPs', null) ?? []);
console.log(`Init failed: ${x}`);
app._options.globalData.TOTPS = JSON.parse(
localStorage.getItem("TOTPs", null) ?? []
);
this.initPage();
});
},

View File

@ -20,8 +20,8 @@ function renderContainers(buffer) {
RenderTOTPContainer(i, buffer[i].issuer, buffer[i].client);
}
}
const renderData = [];
const renderData = [];
function renderTOTPs(buffer) {
for (let i = 0; i < buffer.length; i++) {
let otpData = TOTP.copy(buffer[i]).getOTP();

View File

@ -7,6 +7,7 @@ import { createWidget, widget, align, text_style } from "@zos/ui";
const { width, height } = getDeviceInfo();
const buttonWidth = width - width / 20; //Width of container
const buttonHeight = height / 4; //Height of container
const containerColor = 0x303030; //Color of container
const containerRadius = 20; //Corner radius of container