Compare commits

..

No commits in common. "b12eacb5e1f796bed5766eb36f0f8686fec04eac" and "73ea81af549df7c4a659d9907d743e1b40c1d7e1" have entirely different histories.

6 changed files with 13 additions and 25 deletions

View File

@ -1,6 +1,4 @@
# TOTPFIT # TOTPFIT - Another 2FAuthenticator based on TOTP for Zepp Amazfit GTS 4
### Another 2FAuthenticator based on TOTP for Zepp Amazfit GTS 4
Features: Features:
- Supports of otpauth links with parameters "issuer", "algorithm", "digits", "period" - Supports otpauth links with parameters "issuer", "algorithm", "digits", "period"
- Addition/Edition/Deletion of TOTPs from mobile settings app

View File

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

View File

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

View File

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

View File

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

View File

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