Update TOTP

This commit is contained in:
MX
2023-05-26 13:22:06 +03:00
parent 12f9b6a89e
commit 24ad48d390
23 changed files with 6631 additions and 315 deletions

View File

@@ -0,0 +1,940 @@
#include "712serif.h"
/* GENERATED BY https://github.com/pavius/the-dot-factory */
/*
** Font data for 7:12 Serif 24pt
*/
/* Character bitmaps for 7:12 Serif 24pt */
const uint8_t _712Serif_24ptBitmaps[] = {
/* @0 '-' (14 pixels wide) */
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0xFC,
0x0F,
0xFC,
0x0F,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
/* @28 '0' (14 pixels wide) */
0xF0,
0x03,
0xF0,
0x03,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0xF0,
0x03,
0xF0,
0x03,
/* @56 '1' (14 pixels wide) */
0xC0,
0x00,
0xC0,
0x00,
0xFC,
0x00,
0xFC,
0x00,
0xC0,
0x00,
0xC0,
0x00,
0xC0,
0x00,
0xC0,
0x00,
0xC0,
0x00,
0xC0,
0x00,
0xC0,
0x00,
0xC0,
0x00,
0xFC,
0x0F,
0xFC,
0x0F,
/* @84 '2' (14 pixels wide) */
0xF0,
0x03,
0xF0,
0x03,
0x0C,
0x0C,
0x0C,
0x0C,
0x00,
0x0C,
0x00,
0x0C,
0xC0,
0x03,
0xC0,
0x03,
0x30,
0x00,
0x30,
0x00,
0x0C,
0x0C,
0x0C,
0x0C,
0xFC,
0x0F,
0xFC,
0x0F,
/* @112 '3' (14 pixels wide) */
0xF0,
0x03,
0xF0,
0x03,
0x0C,
0x0C,
0x0C,
0x0C,
0x00,
0x0C,
0x00,
0x0C,
0xC0,
0x03,
0xC0,
0x03,
0x00,
0x0C,
0x00,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0xF0,
0x03,
0xF0,
0x03,
/* @140 '4' (14 pixels wide) */
0x30,
0x03,
0x30,
0x03,
0x30,
0x03,
0x30,
0x03,
0x0C,
0x03,
0x0C,
0x03,
0x0C,
0x03,
0x0C,
0x03,
0xFC,
0x0F,
0xFC,
0x0F,
0x00,
0x03,
0x00,
0x03,
0xC0,
0x0F,
0xC0,
0x0F,
/* @168 '5' (14 pixels wide) */
0xFC,
0x0F,
0xFC,
0x0F,
0x0C,
0x00,
0x0C,
0x00,
0xFC,
0x03,
0xFC,
0x03,
0x00,
0x0C,
0x00,
0x0C,
0x00,
0x0C,
0x00,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0xF0,
0x03,
0xF0,
0x03,
/* @196 '6' (14 pixels wide) */
0xF0,
0x03,
0xF0,
0x03,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x00,
0x0C,
0x00,
0xFC,
0x03,
0xFC,
0x03,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0xF0,
0x03,
0xF0,
0x03,
/* @224 '7' (14 pixels wide) */
0xFC,
0x0F,
0xFC,
0x0F,
0x0C,
0x0C,
0x0C,
0x0C,
0x00,
0x03,
0x00,
0x03,
0x00,
0x03,
0x00,
0x03,
0xC0,
0x00,
0xC0,
0x00,
0xC0,
0x00,
0xC0,
0x00,
0xC0,
0x00,
0xC0,
0x00,
/* @252 '8' (14 pixels wide) */
0xF0,
0x03,
0xF0,
0x03,
0x0C,
0x0C,
0x0C,
0x0C,
0xF0,
0x03,
0xF0,
0x03,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0xF0,
0x03,
0xF0,
0x03,
/* @280 '9' (14 pixels wide) */
0xF0,
0x03,
0xF0,
0x03,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0xF0,
0x0F,
0xF0,
0x0F,
0x00,
0x0C,
0x00,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0xF0,
0x03,
0xF0,
0x03,
/* @308 'B' (14 pixels wide) */
0xFF,
0x00,
0xFF,
0x00,
0x0C,
0x03,
0x0C,
0x03,
0x0C,
0x03,
0x0C,
0x03,
0xFC,
0x0F,
0xFC,
0x0F,
0x0C,
0x30,
0x0C,
0x30,
0x0C,
0x30,
0x0C,
0x30,
0xFF,
0x0F,
0xFF,
0x0F,
/* @336 'C' (14 pixels wide) */
0xF0,
0x33,
0xF0,
0x33,
0x0C,
0x3C,
0x0C,
0x3C,
0x03,
0x00,
0x03,
0x00,
0x03,
0x00,
0x03,
0x00,
0x03,
0x30,
0x03,
0x30,
0x0C,
0x0C,
0x0C,
0x0C,
0xF0,
0x03,
0xF0,
0x03,
/* @364 'D' (14 pixels wide) */
0xFF,
0x03,
0xFF,
0x03,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x30,
0x0C,
0x30,
0x0C,
0x30,
0x0C,
0x30,
0x0C,
0x30,
0x0C,
0x30,
0x0C,
0x0C,
0x0C,
0x0C,
0xFF,
0x03,
0xFF,
0x03,
/* @392 'F' (14 pixels wide) */
0xFF,
0x3F,
0xFF,
0x3F,
0x0C,
0x30,
0x0C,
0x30,
0x0C,
0x03,
0x0C,
0x03,
0xFC,
0x03,
0xFC,
0x03,
0x0C,
0x03,
0x0C,
0x03,
0x0C,
0x00,
0x0C,
0x00,
0x3F,
0x00,
0x3F,
0x00,
/* @420 'G' (14 pixels wide) */
0xF0,
0x33,
0xF0,
0x33,
0x0C,
0x3C,
0x0C,
0x3C,
0x03,
0x00,
0x03,
0x00,
0x03,
0x3F,
0x03,
0x3F,
0x03,
0x30,
0x03,
0x30,
0x0C,
0x3C,
0x0C,
0x3C,
0xF0,
0x33,
0xF0,
0x33,
/* @448 'H' (14 pixels wide) */
0x3F,
0x3F,
0x3F,
0x3F,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0xFC,
0x0F,
0xFC,
0x0F,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x3F,
0x3F,
0x3F,
0x3F,
/* @476 'J' (14 pixels wide) */
0x00,
0x3F,
0x00,
0x3F,
0x00,
0x0C,
0x00,
0x0C,
0x00,
0x0C,
0x00,
0x0C,
0x00,
0x0C,
0x00,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0xF0,
0x03,
0xF0,
0x03,
/* @504 'K' (14 pixels wide) */
0x3F,
0x3F,
0x3F,
0x3F,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x03,
0x0C,
0x03,
0xFC,
0x00,
0xFC,
0x00,
0x0C,
0x03,
0x0C,
0x03,
0x0C,
0x0C,
0x0C,
0x0C,
0x3F,
0x3F,
0x3F,
0x3F,
/* @532 'M' (14 pixels wide) */
0x0F,
0x3C,
0x0F,
0x3C,
0x3C,
0x0F,
0x3C,
0x0F,
0xCC,
0x0C,
0xCC,
0x0C,
0xCC,
0x0C,
0xCC,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x3F,
0x3F,
0x3F,
0x3F,
/* @560 'N' (14 pixels wide) */
0x0F,
0x3F,
0x0F,
0x3F,
0x3C,
0x0C,
0x3C,
0x0C,
0xCC,
0x0C,
0xCC,
0x0C,
0xCC,
0x0C,
0xCC,
0x0C,
0xCC,
0x0C,
0xCC,
0x0C,
0x0C,
0x0F,
0x0C,
0x0F,
0x3F,
0x0C,
0x3F,
0x0C,
/* @588 'P' (14 pixels wide) */
0xFF,
0x0F,
0xFF,
0x0F,
0x0C,
0x30,
0x0C,
0x30,
0x0C,
0x30,
0x0C,
0x30,
0x3C,
0x30,
0x3C,
0x30,
0xCC,
0x0F,
0xCC,
0x0F,
0x0C,
0x00,
0x0C,
0x00,
0x3F,
0x00,
0x3F,
0x00,
/* @616 'Q' (14 pixels wide) */
0xF0,
0x03,
0xF0,
0x03,
0x0C,
0x0C,
0x0C,
0x0C,
0x03,
0x30,
0x03,
0x30,
0xF3,
0x30,
0xF3,
0x30,
0x03,
0x33,
0x03,
0x33,
0x0C,
0x0C,
0x0C,
0x0C,
0xF0,
0x33,
0xF0,
0x33,
/* @644 'R' (14 pixels wide) */
0xFF,
0x0F,
0xFF,
0x0F,
0x0C,
0x30,
0x0C,
0x30,
0x0C,
0x30,
0x0C,
0x30,
0xFC,
0x0F,
0xFC,
0x0F,
0x0C,
0x03,
0x0C,
0x03,
0x0C,
0x0C,
0x0C,
0x0C,
0x3F,
0x3F,
0x3F,
0x3F,
/* @672 'T' (14 pixels wide) */
0xFF,
0x3F,
0xFF,
0x3F,
0xC3,
0x30,
0xC3,
0x30,
0xC0,
0x00,
0xC0,
0x00,
0xC0,
0x00,
0xC0,
0x00,
0xC0,
0x00,
0xC0,
0x00,
0xC0,
0x00,
0xC0,
0x00,
0xF0,
0x03,
0xF0,
0x03,
/* @700 'V' (14 pixels wide) */
0x3F,
0x3F,
0x3F,
0x3F,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x30,
0x03,
0x30,
0x03,
0x30,
0x03,
0x30,
0x03,
0xC0,
0x00,
0xC0,
0x00,
/* @728 'W' (14 pixels wide) */
0x3F,
0x3F,
0x3F,
0x3F,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0x0C,
0xCC,
0x0C,
0xCC,
0x0C,
0xCC,
0x0C,
0xCC,
0x0C,
0x30,
0x03,
0x30,
0x03,
0x30,
0x03,
0x30,
0x03,
/* @756 'X' (14 pixels wide) */
0x3F,
0x3F,
0x3F,
0x3F,
0x0C,
0x0C,
0x0C,
0x0C,
0x30,
0x03,
0x30,
0x03,
0xC0,
0x00,
0xC0,
0x00,
0x30,
0x03,
0x30,
0x03,
0x0C,
0x0C,
0x0C,
0x0C,
0x3F,
0x3F,
0x3F,
0x3F,
/* @784 'Y' (14 pixels wide) */
0x3F,
0x3F,
0x3F,
0x3F,
0x0C,
0x0C,
0x0C,
0x0C,
0x30,
0x03,
0x30,
0x03,
0xC0,
0x00,
0xC0,
0x00,
0xC0,
0x00,
0xC0,
0x00,
0xC0,
0x00,
0xC0,
0x00,
0xF0,
0x03,
0xF0,
0x03,
};
/* Character descriptors for 7:12 Serif 24pt */
/* { [Char width in bits], [Offset into _712Serif_24ptCharBitmaps in bytes] } */
const FONT_CHAR_INFO _712Serif_24ptDescriptors[] = {
{14, 0}, /* - */
{0, 0}, /* . */
{0, 0}, /* / */
{14, 28}, /* 0 */
{14, 56}, /* 1 */
{14, 84}, /* 2 */
{14, 112}, /* 3 */
{14, 140}, /* 4 */
{14, 168}, /* 5 */
{14, 196}, /* 6 */
{14, 224}, /* 7 */
{14, 252}, /* 8 */
{14, 280}, /* 9 */
{0, 0}, /* : */
{0, 0}, /* ; */
{0, 0}, /* < */
{0, 0}, /* = */
{0, 0}, /* > */
{0, 0}, /* ? */
{0, 0}, /* @ */
{0, 0}, /* A */
{14, 308}, /* B */
{14, 336}, /* C */
{14, 364}, /* D */
{0, 0}, /* E */
{14, 392}, /* F */
{14, 420}, /* G */
{14, 448}, /* H */
{0, 0}, /* I */
{14, 476}, /* J */
{14, 504}, /* K */
{0, 0}, /* L */
{14, 532}, /* M */
{14, 560}, /* N */
{0, 0}, /* O */
{14, 588}, /* P */
{14, 616}, /* Q */
{14, 644}, /* R */
{0, 0}, /* S */
{14, 672}, /* T */
{0, 0}, /* U */
{14, 700}, /* V */
{14, 728}, /* W */
{14, 756}, /* X */
{14, 784}, /* Y */
};
/* Font information for 7:12 Serif 24pt */
const FONT_INFO _712Serif_24ptFontInfo = {
14, /* Character height */
'-', /* Start character */
'Y', /* End character */
2, /* Width, in pixels, of space character */
_712Serif_24ptDescriptors, /* Character descriptor array */
_712Serif_24ptBitmaps, /* Character bitmap array */
};

View File

@@ -0,0 +1,8 @@
#pragma once
/* GENERATED BY https://github.com/pavius/the-dot-factory */
#include "../font_info.h"
/* Font data for 7:12 Serif 24pt */
extern const FONT_INFO _712Serif_24ptFontInfo;

View File

@@ -0,0 +1,27 @@
#pragma once
#include "../../features_config.h"
#include "font_info.h"
#if TOTP_FONT == TOTP_FONT_MODENINE
#include "mode_nine/mode_nine.h"
#define TOTP_CODE_FONT_INFO modeNine_15ptFontInfo
#elif TOTP_FONT == TOTP_FONT_REDHATMONO
#include "redhat_mono/redhat_mono.h"
#define TOTP_CODE_FONT_INFO redHatMono_16ptFontInfo
#elif TOTP_FONT == TOTP_FONT_BEDSTEAD
#include "bedstead/bedstead.h"
#define TOTP_CODE_FONT_INFO bedstead_17ptFontInfo
#elif TOTP_FONT == TOTP_FONT_ZECTOR
#include "zector/zector.h"
#define TOTP_CODE_FONT_INFO zector_18ptFontInfo
#elif TOTP_FONT == TOTP_FONT_712SERIF
#include "712serif/712serif.h"
#define TOTP_CODE_FONT_INFO _712Serif_24ptFontInfo
#elif TOTP_FONT == TOTP_FONT_GRAPH35PIX
#include "graph35pix/graph35pix.h"
#define TOTP_CODE_FONT_INFO graph35pix_12ptFontInfo
#elif TOTP_FONT == TOTP_FONT_KARMAFUTURE
#include "karma_future/karma_future.h"
#define TOTP_CODE_FONT_INFO karmaFuture_14ptFontInfo
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,8 @@
#pragma once
/* GENERATED BY https://github.com/pavius/the-dot-factory */
#include "../font_info.h"
/* Font data for Bedstead 17pt */
extern const FONT_INFO bedstead_17ptFontInfo;

View File

@@ -0,0 +1,940 @@
#include "graph35pix.h"
/* GENERATED BY https://github.com/pavius/the-dot-factory */
/*
** Font data for Graph 35+ pix 12pt
*/
/* Character bitmaps for Graph 35+ pix 12pt */
const uint8_t graph35pix_12ptBitmaps[] = {
/* @0 '-' (10 pixels wide) */
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0xFF,
0x03,
0xFF,
0x03,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
/* @28 '0' (10 pixels wide) */
0xFC,
0x00,
0xFC,
0x00,
0x03,
0x03,
0x03,
0x03,
0xC3,
0x03,
0xC3,
0x03,
0x33,
0x03,
0x33,
0x03,
0x0F,
0x03,
0x0F,
0x03,
0x03,
0x03,
0x03,
0x03,
0xFC,
0x00,
0xFC,
0x00,
/* @56 '1' (10 pixels wide) */
0x30,
0x00,
0x30,
0x00,
0x3C,
0x00,
0x3C,
0x00,
0x30,
0x00,
0x30,
0x00,
0x30,
0x00,
0x30,
0x00,
0x30,
0x00,
0x30,
0x00,
0x30,
0x00,
0x30,
0x00,
0xFC,
0x00,
0xFC,
0x00,
/* @84 '2' (10 pixels wide) */
0xFC,
0x00,
0xFC,
0x00,
0x03,
0x03,
0x03,
0x03,
0x00,
0x03,
0x00,
0x03,
0xC0,
0x00,
0xC0,
0x00,
0x30,
0x00,
0x30,
0x00,
0x0C,
0x00,
0x0C,
0x00,
0xFF,
0x03,
0xFF,
0x03,
/* @112 '3' (10 pixels wide) */
0xFF,
0x03,
0xFF,
0x03,
0xC0,
0x00,
0xC0,
0x00,
0x30,
0x00,
0x30,
0x00,
0xC0,
0x00,
0xC0,
0x00,
0x00,
0x03,
0x00,
0x03,
0x03,
0x03,
0x03,
0x03,
0xFC,
0x00,
0xFC,
0x00,
/* @140 '4' (10 pixels wide) */
0xC0,
0x00,
0xC0,
0x00,
0xF0,
0x00,
0xF0,
0x00,
0xCC,
0x00,
0xCC,
0x00,
0xC3,
0x00,
0xC3,
0x00,
0xFF,
0x03,
0xFF,
0x03,
0xC0,
0x00,
0xC0,
0x00,
0xC0,
0x00,
0xC0,
0x00,
/* @168 '5' (10 pixels wide) */
0xFF,
0x03,
0xFF,
0x03,
0x03,
0x00,
0x03,
0x00,
0xFF,
0x00,
0xFF,
0x00,
0x00,
0x03,
0x00,
0x03,
0x00,
0x03,
0x00,
0x03,
0x03,
0x03,
0x03,
0x03,
0xFC,
0x00,
0xFC,
0x00,
/* @196 '6' (10 pixels wide) */
0xF0,
0x00,
0xF0,
0x00,
0x0C,
0x00,
0x0C,
0x00,
0x03,
0x00,
0x03,
0x00,
0xFF,
0x00,
0xFF,
0x00,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0xFC,
0x00,
0xFC,
0x00,
/* @224 '7' (10 pixels wide) */
0xFF,
0x03,
0xFF,
0x03,
0x00,
0x03,
0x00,
0x03,
0xC0,
0x00,
0xC0,
0x00,
0x30,
0x00,
0x30,
0x00,
0x30,
0x00,
0x30,
0x00,
0x30,
0x00,
0x30,
0x00,
0x30,
0x00,
0x30,
0x00,
/* @252 '8' (10 pixels wide) */
0xFC,
0x00,
0xFC,
0x00,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0xFC,
0x00,
0xFC,
0x00,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0xFC,
0x00,
0xFC,
0x00,
/* @280 '9' (10 pixels wide) */
0xFC,
0x00,
0xFC,
0x00,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0xFC,
0x03,
0xFC,
0x03,
0x00,
0x03,
0x00,
0x03,
0xC0,
0x00,
0xC0,
0x00,
0x3C,
0x00,
0x3C,
0x00,
/* @308 'B' (10 pixels wide) */
0xFF,
0x00,
0xFF,
0x00,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0xFF,
0x00,
0xFF,
0x00,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0xFF,
0x00,
0xFF,
0x00,
/* @336 'C' (10 pixels wide) */
0xFC,
0x00,
0xFC,
0x00,
0x03,
0x03,
0x03,
0x03,
0x03,
0x00,
0x03,
0x00,
0x03,
0x00,
0x03,
0x00,
0x03,
0x00,
0x03,
0x00,
0x03,
0x03,
0x03,
0x03,
0xFC,
0x00,
0xFC,
0x00,
/* @364 'D' (10 pixels wide) */
0x3F,
0x00,
0x3F,
0x00,
0xC3,
0x00,
0xC3,
0x00,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0xC3,
0x00,
0xC3,
0x00,
0x3F,
0x00,
0x3F,
0x00,
/* @392 'F' (10 pixels wide) */
0xFF,
0x03,
0xFF,
0x03,
0x03,
0x00,
0x03,
0x00,
0x03,
0x00,
0x03,
0x00,
0xFF,
0x00,
0xFF,
0x00,
0x03,
0x00,
0x03,
0x00,
0x03,
0x00,
0x03,
0x00,
0x03,
0x00,
0x03,
0x00,
/* @420 'G' (10 pixels wide) */
0xFC,
0x00,
0xFC,
0x00,
0x03,
0x03,
0x03,
0x03,
0x03,
0x00,
0x03,
0x00,
0xF3,
0x03,
0xF3,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0xFC,
0x03,
0xFC,
0x03,
/* @448 'H' (10 pixels wide) */
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0xFF,
0x03,
0xFF,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
/* @476 'J' (10 pixels wide) */
0xF0,
0x03,
0xF0,
0x03,
0xC0,
0x00,
0xC0,
0x00,
0xC0,
0x00,
0xC0,
0x00,
0xC0,
0x00,
0xC0,
0x00,
0xC0,
0x00,
0xC0,
0x00,
0xC3,
0x00,
0xC3,
0x00,
0x3C,
0x00,
0x3C,
0x00,
/* @504 'K' (10 pixels wide) */
0x03,
0x03,
0x03,
0x03,
0xC3,
0x00,
0xC3,
0x00,
0x33,
0x00,
0x33,
0x00,
0x0F,
0x00,
0x0F,
0x00,
0x33,
0x00,
0x33,
0x00,
0xC3,
0x00,
0xC3,
0x00,
0x03,
0x03,
0x03,
0x03,
/* @532 'M' (10 pixels wide) */
0x03,
0x03,
0x03,
0x03,
0xCF,
0x03,
0xCF,
0x03,
0x33,
0x03,
0x33,
0x03,
0x33,
0x03,
0x33,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
/* @560 'N' (10 pixels wide) */
0x03,
0x03,
0x03,
0x03,
0x0F,
0x03,
0x0F,
0x03,
0x0F,
0x03,
0x0F,
0x03,
0x33,
0x03,
0x33,
0x03,
0xC3,
0x03,
0xC3,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
/* @588 'P' (10 pixels wide) */
0xFF,
0x00,
0xFF,
0x00,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0xFF,
0x00,
0xFF,
0x00,
0x03,
0x00,
0x03,
0x00,
0x03,
0x00,
0x03,
0x00,
0x03,
0x00,
0x03,
0x00,
/* @616 'Q' (10 pixels wide) */
0xFC,
0x00,
0xFC,
0x00,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x33,
0x03,
0x33,
0x03,
0xC3,
0x00,
0xC3,
0x00,
0x3C,
0x03,
0x3C,
0x03,
/* @644 'R' (10 pixels wide) */
0xFF,
0x00,
0xFF,
0x00,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0xFF,
0x00,
0xFF,
0x00,
0x33,
0x00,
0x33,
0x00,
0xC3,
0x00,
0xC3,
0x00,
0x03,
0x03,
0x03,
0x03,
/* @672 'T' (10 pixels wide) */
0xFF,
0x03,
0xFF,
0x03,
0x30,
0x00,
0x30,
0x00,
0x30,
0x00,
0x30,
0x00,
0x30,
0x00,
0x30,
0x00,
0x30,
0x00,
0x30,
0x00,
0x30,
0x00,
0x30,
0x00,
0x30,
0x00,
0x30,
0x00,
/* @700 'V' (10 pixels wide) */
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0xCC,
0x00,
0xCC,
0x00,
0x30,
0x00,
0x30,
0x00,
/* @728 'W' (10 pixels wide) */
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x33,
0x03,
0x33,
0x03,
0x33,
0x03,
0x33,
0x03,
0x33,
0x03,
0x33,
0x03,
0xCC,
0x00,
0xCC,
0x00,
/* @756 'X' (10 pixels wide) */
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0xCC,
0x00,
0xCC,
0x00,
0x30,
0x00,
0x30,
0x00,
0xCC,
0x00,
0xCC,
0x00,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
/* @784 'Y' (10 pixels wide) */
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0x03,
0xCC,
0x00,
0xCC,
0x00,
0x30,
0x00,
0x30,
0x00,
0x30,
0x00,
0x30,
0x00,
0x30,
0x00,
0x30,
0x00,
};
/* Character descriptors for Graph 35+ pix 12pt */
/* { [Char width in bits], [Offset into graph35pix_12ptCharBitmaps in bytes] } */
const FONT_CHAR_INFO graph35pix_12ptDescriptors[] = {
{10, 0}, /* - */
{0, 0}, /* . */
{0, 0}, /* / */
{10, 28}, /* 0 */
{10, 56}, /* 1 */
{10, 84}, /* 2 */
{10, 112}, /* 3 */
{10, 140}, /* 4 */
{10, 168}, /* 5 */
{10, 196}, /* 6 */
{10, 224}, /* 7 */
{10, 252}, /* 8 */
{10, 280}, /* 9 */
{0, 0}, /* : */
{0, 0}, /* ; */
{0, 0}, /* < */
{0, 0}, /* = */
{0, 0}, /* > */
{0, 0}, /* ? */
{0, 0}, /* @ */
{0, 0}, /* A */
{10, 308}, /* B */
{10, 336}, /* C */
{10, 364}, /* D */
{0, 0}, /* E */
{10, 392}, /* F */
{10, 420}, /* G */
{10, 448}, /* H */
{0, 0}, /* I */
{10, 476}, /* J */
{10, 504}, /* K */
{0, 0}, /* L */
{10, 532}, /* M */
{10, 560}, /* N */
{0, 0}, /* O */
{10, 588}, /* P */
{10, 616}, /* Q */
{10, 644}, /* R */
{0, 0}, /* S */
{10, 672}, /* T */
{0, 0}, /* U */
{10, 700}, /* V */
{10, 728}, /* W */
{10, 756}, /* X */
{10, 784}, /* Y */
};
/* Font information for Graph 35+ pix 12pt */
const FONT_INFO graph35pix_12ptFontInfo = {
14, /* Character height */
'-', /* Start character */
'Y', /* End character */
2, /* Width, in pixels, of space character */
graph35pix_12ptDescriptors, /* Character descriptor array */
graph35pix_12ptBitmaps, /* Character bitmap array */
};

View File

@@ -0,0 +1,8 @@
#pragma once
/* GENERATED BY https://github.com/pavius/the-dot-factory */
#include "../font_info.h"
/* Font data for Graph 35+ pix 12pt */
extern const FONT_INFO graph35pix_12ptFontInfo;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,8 @@
#pragma once
/* GENERATED BY https://github.com/pavius/the-dot-factory */
#include "../font_info.h"
/* Font data for Karma Future 14pt */
extern const FONT_INFO karmaFuture_14ptFontInfo;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,8 @@
#pragma once
/* GENERATED BY https://github.com/pavius/the-dot-factory */
#include "../font_info.h"
/* Font data for Redhat Mono 16pt */
extern const FONT_INFO redHatMono_16ptFontInfo;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,8 @@
#pragma once
/* GENERATED BY https://github.com/pavius/the-dot-factory */
#include "../font_info.h"
/* Font information for Zector 18pt */
extern const FONT_INFO zector_18ptFontInfo;

View File

@@ -29,7 +29,7 @@ void view_unlock_model(View* view) {
static void commit_text_input_callback(void* context) { static void commit_text_input_callback(void* context) {
InputTextSceneState* text_input_state = (InputTextSceneState*)context; InputTextSceneState* text_input_state = (InputTextSceneState*)context;
if(text_input_state->callback != 0) { if(text_input_state->callback != NULL) {
InputTextSceneCallbackResult* result = malloc(sizeof(InputTextSceneCallbackResult)); InputTextSceneCallbackResult* result = malloc(sizeof(InputTextSceneCallbackResult));
furi_check(result != NULL); furi_check(result != NULL);
result->user_input_length = result->user_input_length =

View File

@@ -36,7 +36,7 @@ typedef struct {
InputTextSceneContext* token_name_input_context; InputTextSceneContext* token_name_input_context;
InputTextSceneContext* token_secret_input_context; InputTextSceneContext* token_secret_input_context;
InputTextSceneState* input_state; InputTextSceneState* input_state;
uint32_t input_started_at; bool text_input_mode;
int16_t screen_y_offset; int16_t screen_y_offset;
TokenHashAlgo algo; TokenHashAlgo algo;
uint8_t digits_count_index; uint8_t digits_count_index;
@@ -56,7 +56,7 @@ static void on_token_name_user_comitted(InputTextSceneCallbackResult* result) {
free(scene_state->token_name); free(scene_state->token_name);
scene_state->token_name = result->user_input; scene_state->token_name = result->user_input;
scene_state->token_name_length = result->user_input_length; scene_state->token_name_length = result->user_input_length;
scene_state->input_started_at = 0; scene_state->text_input_mode = false;
free(result); free(result);
} }
@@ -65,7 +65,7 @@ static void on_token_secret_user_comitted(InputTextSceneCallbackResult* result)
free(scene_state->token_secret); free(scene_state->token_secret);
scene_state->token_secret = result->user_input; scene_state->token_secret = result->user_input;
scene_state->token_secret_length = result->user_input_length; scene_state->token_secret_length = result->user_input_length;
scene_state->input_started_at = 0; scene_state->text_input_mode = false;
free(result); free(result);
} }
@@ -127,8 +127,8 @@ void totp_scene_add_new_token_activate(PluginState* plugin_state) {
} }
void totp_scene_add_new_token_render(Canvas* const canvas, PluginState* plugin_state) { void totp_scene_add_new_token_render(Canvas* const canvas, PluginState* plugin_state) {
SceneState* scene_state = (SceneState*)plugin_state->current_scene_state; SceneState* scene_state = plugin_state->current_scene_state;
if(scene_state->input_started_at > 0) { if(scene_state->text_input_mode) {
totp_input_text_render(canvas, scene_state->input_state); totp_input_text_render(canvas, scene_state->input_state);
return; return;
} }
@@ -200,63 +200,81 @@ bool totp_scene_add_new_token_handle_event(PluginEvent* const event, PluginState
return true; return true;
} }
SceneState* scene_state = (SceneState*)plugin_state->current_scene_state; SceneState* scene_state = plugin_state->current_scene_state;
if(scene_state->input_started_at > 0 &&
furi_get_tick() - scene_state->input_started_at > 300) { if(event->input.type == InputTypeLong && event->input.key == InputKeyBack) {
if(scene_state->text_input_mode) {
scene_state->text_input_mode = false;
} else {
return false;
}
}
if(scene_state->text_input_mode) {
if(event->input.type == InputTypeShort && event->input.key == InputKeyBack) {
PluginEvent long_back_cb_evt = {
.type = event->type, .input.key = InputKeyBack, .input.type = InputTypeLong};
return totp_input_text_handle_event(&long_back_cb_evt, scene_state->input_state);
}
return totp_input_text_handle_event(event, scene_state->input_state); return totp_input_text_handle_event(event, scene_state->input_state);
} }
if(event->input.type == InputTypeLong && event->input.key == InputKeyBack) { if(event->input.type == InputTypePress) {
return false; switch(event->input.key) {
} case InputKeyUp:
if(event->input.type != InputTypePress) {
return true;
}
switch(event->input.key) {
case InputKeyUp:
totp_roll_value_uint8_t(
&scene_state->selected_control,
-1,
TokenNameTextBox,
ConfirmButton,
RollOverflowBehaviorStop);
update_screen_y_offset(scene_state);
break;
case InputKeyDown:
totp_roll_value_uint8_t(
&scene_state->selected_control,
1,
TokenNameTextBox,
ConfirmButton,
RollOverflowBehaviorStop);
update_screen_y_offset(scene_state);
break;
case InputKeyRight:
if(scene_state->selected_control == TokenAlgoSelect) {
totp_roll_value_uint8_t(&scene_state->algo, 1, SHA1, STEAM, RollOverflowBehaviorRoll);
} else if(scene_state->selected_control == TokenLengthSelect) {
totp_roll_value_uint8_t( totp_roll_value_uint8_t(
&scene_state->digits_count_index, 1, 0, 2, RollOverflowBehaviorRoll); &scene_state->selected_control,
} else if(scene_state->selected_control == TokenDurationSelect) { -1,
totp_roll_value_uint8_t(&scene_state->duration, 15, 15, 255, RollOverflowBehaviorStop); TokenNameTextBox,
update_duration_text(scene_state); ConfirmButton,
RollOverflowBehaviorStop);
update_screen_y_offset(scene_state);
break;
case InputKeyDown:
totp_roll_value_uint8_t(
&scene_state->selected_control,
1,
TokenNameTextBox,
ConfirmButton,
RollOverflowBehaviorStop);
update_screen_y_offset(scene_state);
break;
case InputKeyRight:
if(scene_state->selected_control == TokenAlgoSelect) {
totp_roll_value_uint8_t(
&scene_state->algo, 1, SHA1, STEAM, RollOverflowBehaviorRoll);
} else if(scene_state->selected_control == TokenLengthSelect) {
totp_roll_value_uint8_t(
&scene_state->digits_count_index, 1, 0, 2, RollOverflowBehaviorRoll);
} else if(scene_state->selected_control == TokenDurationSelect) {
totp_roll_value_uint8_t(
&scene_state->duration, 15, 15, 255, RollOverflowBehaviorStop);
update_duration_text(scene_state);
}
break;
case InputKeyLeft:
if(scene_state->selected_control == TokenAlgoSelect) {
totp_roll_value_uint8_t(
&scene_state->algo, -1, SHA1, STEAM, RollOverflowBehaviorRoll);
} else if(scene_state->selected_control == TokenLengthSelect) {
totp_roll_value_uint8_t(
&scene_state->digits_count_index, -1, 0, 2, RollOverflowBehaviorRoll);
} else if(scene_state->selected_control == TokenDurationSelect) {
totp_roll_value_uint8_t(
&scene_state->duration, -15, 15, 255, RollOverflowBehaviorStop);
update_duration_text(scene_state);
}
break;
case InputKeyOk:
break;
case InputKeyBack:
totp_scene_director_activate_scene(plugin_state, TotpSceneGenerateToken);
break;
default:
break;
} }
break; } else if(event->input.type == InputTypeRelease && event->input.key == InputKeyOk) {
case InputKeyLeft:
if(scene_state->selected_control == TokenAlgoSelect) {
totp_roll_value_uint8_t(&scene_state->algo, -1, SHA1, STEAM, RollOverflowBehaviorRoll);
} else if(scene_state->selected_control == TokenLengthSelect) {
totp_roll_value_uint8_t(
&scene_state->digits_count_index, -1, 0, 2, RollOverflowBehaviorRoll);
} else if(scene_state->selected_control == TokenDurationSelect) {
totp_roll_value_uint8_t(
&scene_state->duration, -15, 15, 255, RollOverflowBehaviorStop);
update_duration_text(scene_state);
}
break;
case InputKeyOk:
switch(scene_state->selected_control) { switch(scene_state->selected_control) {
case TokenNameTextBox: case TokenNameTextBox:
if(scene_state->input_state != NULL) { if(scene_state->input_state != NULL) {
@@ -264,7 +282,8 @@ bool totp_scene_add_new_token_handle_event(PluginEvent* const event, PluginState
} }
scene_state->input_state = scene_state->input_state =
totp_input_text_activate(scene_state->token_name_input_context); totp_input_text_activate(scene_state->token_name_input_context);
scene_state->input_started_at = furi_get_tick();
scene_state->text_input_mode = true;
break; break;
case TokenSecretTextBox: case TokenSecretTextBox:
if(scene_state->input_state != NULL) { if(scene_state->input_state != NULL) {
@@ -272,7 +291,8 @@ bool totp_scene_add_new_token_handle_event(PluginEvent* const event, PluginState
} }
scene_state->input_state = scene_state->input_state =
totp_input_text_activate(scene_state->token_secret_input_context); totp_input_text_activate(scene_state->token_secret_input_context);
scene_state->input_started_at = furi_get_tick();
scene_state->text_input_mode = true;
break; break;
case TokenAlgoSelect: case TokenAlgoSelect:
break; break;
@@ -313,12 +333,6 @@ bool totp_scene_add_new_token_handle_event(PluginEvent* const event, PluginState
default: default:
break; break;
} }
break;
case InputKeyBack:
totp_scene_director_activate_scene(plugin_state, TotpSceneGenerateToken);
break;
default:
break;
} }
return true; return true;

View File

@@ -60,17 +60,17 @@ void totp_scene_app_settings_activate(PluginState* plugin_state) {
} }
static void two_digit_to_str(int8_t num, char* str) { static void two_digit_to_str(int8_t num, char* str) {
uint8_t index = 0; char* s = str;
if(num < 0) { if(num < 0) {
str[index++] = '-'; *(s++) = '-';
num = -num; num = -num;
} }
uint8_t d1 = (num / 10) % 10; uint8_t d1 = (num / 10) % 10;
uint8_t d2 = num % 10; uint8_t d2 = num % 10;
str[index++] = CONVERT_DIGIT_TO_CHAR(d1); *(s++) = CONVERT_DIGIT_TO_CHAR(d1);
str[index++] = CONVERT_DIGIT_TO_CHAR(d2); *(s++) = CONVERT_DIGIT_TO_CHAR(d2);
str[index++] = '\0'; *(s++) = '\0';
} }
void totp_scene_app_settings_render(Canvas* const canvas, const PluginState* plugin_state) { void totp_scene_app_settings_render(Canvas* const canvas, const PluginState* plugin_state) {
@@ -183,116 +183,117 @@ bool totp_scene_app_settings_handle_event(
} }
SceneState* scene_state = (SceneState*)plugin_state->current_scene_state; SceneState* scene_state = (SceneState*)plugin_state->current_scene_state;
if(event->input.type != InputTypePress && event->input.type != InputTypeRepeat) { if(event->input.type == InputTypePress || event->input.type == InputTypeRepeat) {
return true; switch(event->input.key) {
} case InputKeyUp:
switch(event->input.key) {
case InputKeyUp:
totp_roll_value_uint8_t(
&scene_state->selected_control,
-1,
HoursInput,
ConfirmButton,
RollOverflowBehaviorStop);
if(scene_state->selected_control > Vibro) {
scene_state->y_offset = 128;
} else if(scene_state->selected_control > MinutesInput) {
scene_state->y_offset = 64;
} else {
scene_state->y_offset = 0;
}
break;
case InputKeyDown:
totp_roll_value_uint8_t(
&scene_state->selected_control, 1, HoursInput, ConfirmButton, RollOverflowBehaviorStop);
if(scene_state->selected_control > Vibro) {
scene_state->y_offset = 128;
} else if(scene_state->selected_control > MinutesInput) {
scene_state->y_offset = 64;
} else {
scene_state->y_offset = 0;
}
break;
case InputKeyRight:
if(scene_state->selected_control == HoursInput) {
totp_roll_value_int8_t(
&scene_state->tz_offset_hours, 1, -12, 12, RollOverflowBehaviorStop);
} else if(scene_state->selected_control == MinutesInput) {
totp_roll_value_uint8_t( totp_roll_value_uint8_t(
&scene_state->tz_offset_minutes, 15, 0, 45, RollOverflowBehaviorRoll); &scene_state->selected_control,
} else if(scene_state->selected_control == Sound) { -1,
scene_state->notification_sound = !scene_state->notification_sound; HoursInput,
} else if(scene_state->selected_control == Vibro) { ConfirmButton,
scene_state->notification_vibro = !scene_state->notification_vibro; RollOverflowBehaviorStop);
} else if(scene_state->selected_control == BadUsb) { if(scene_state->selected_control > Vibro) {
scene_state->badusb_enabled = !scene_state->badusb_enabled; scene_state->y_offset = 128;
} } else if(scene_state->selected_control > MinutesInput) {
#ifdef TOTP_BADBT_TYPE_ENABLED scene_state->y_offset = 64;
else if(scene_state->selected_control == BadBt) { } else {
scene_state->badbt_enabled = !scene_state->badbt_enabled; scene_state->y_offset = 0;
} }
#endif break;
break; case InputKeyDown:
case InputKeyLeft: totp_roll_value_uint8_t(
if(scene_state->selected_control == HoursInput) { &scene_state->selected_control,
totp_roll_value_int8_t( 1,
&scene_state->tz_offset_hours, -1, -12, 12, RollOverflowBehaviorStop); HoursInput,
} else if(scene_state->selected_control == MinutesInput) { ConfirmButton,
totp_roll_value_uint8_t( RollOverflowBehaviorStop);
&scene_state->tz_offset_minutes, -15, 0, 45, RollOverflowBehaviorRoll); if(scene_state->selected_control > Vibro) {
} else if(scene_state->selected_control == Sound) { scene_state->y_offset = 128;
scene_state->notification_sound = !scene_state->notification_sound; } else if(scene_state->selected_control > MinutesInput) {
} else if(scene_state->selected_control == Vibro) { scene_state->y_offset = 64;
scene_state->notification_vibro = !scene_state->notification_vibro; } else {
} else if(scene_state->selected_control == BadUsb) { scene_state->y_offset = 0;
scene_state->badusb_enabled = !scene_state->badusb_enabled; }
} break;
#ifdef TOTP_BADBT_TYPE_ENABLED case InputKeyRight:
else if(scene_state->selected_control == BadBt) { if(scene_state->selected_control == HoursInput) {
scene_state->badbt_enabled = !scene_state->badbt_enabled; totp_roll_value_int8_t(
} &scene_state->tz_offset_hours, 1, -12, 12, RollOverflowBehaviorStop);
#endif } else if(scene_state->selected_control == MinutesInput) {
break; totp_roll_value_uint8_t(
case InputKeyOk: &scene_state->tz_offset_minutes, 15, 0, 45, RollOverflowBehaviorRoll);
if(scene_state->selected_control == ConfirmButton) { } else if(scene_state->selected_control == Sound) {
plugin_state->timezone_offset = (float)scene_state->tz_offset_hours + scene_state->notification_sound = !scene_state->notification_sound;
(float)scene_state->tz_offset_minutes / 60.0f; } else if(scene_state->selected_control == Vibro) {
scene_state->notification_vibro = !scene_state->notification_vibro;
plugin_state->notification_method = } else if(scene_state->selected_control == BadUsb) {
(scene_state->notification_sound ? NotificationMethodSound : scene_state->badusb_enabled = !scene_state->badusb_enabled;
NotificationMethodNone) |
(scene_state->notification_vibro ? NotificationMethodVibro :
NotificationMethodNone);
plugin_state->automation_method =
scene_state->badusb_enabled ? AutomationMethodBadUsb : AutomationMethodNone;
#ifdef TOTP_BADBT_TYPE_ENABLED
plugin_state->automation_method |= scene_state->badbt_enabled ? AutomationMethodBadBt :
AutomationMethodNone;
#endif
if(!totp_config_file_update_user_settings(plugin_state)) {
totp_dialogs_config_updating_error(plugin_state);
return false;
} }
#ifdef TOTP_BADBT_TYPE_ENABLED #ifdef TOTP_BADBT_TYPE_ENABLED
if(!scene_state->badbt_enabled && plugin_state->bt_type_code_worker_context != NULL) { else if(scene_state->selected_control == BadBt) {
totp_bt_type_code_worker_free(plugin_state->bt_type_code_worker_context); scene_state->badbt_enabled = !scene_state->badbt_enabled;
plugin_state->bt_type_code_worker_context = NULL;
} }
#endif #endif
break;
case InputKeyLeft:
if(scene_state->selected_control == HoursInput) {
totp_roll_value_int8_t(
&scene_state->tz_offset_hours, -1, -12, 12, RollOverflowBehaviorStop);
} else if(scene_state->selected_control == MinutesInput) {
totp_roll_value_uint8_t(
&scene_state->tz_offset_minutes, -15, 0, 45, RollOverflowBehaviorRoll);
} else if(scene_state->selected_control == Sound) {
scene_state->notification_sound = !scene_state->notification_sound;
} else if(scene_state->selected_control == Vibro) {
scene_state->notification_vibro = !scene_state->notification_vibro;
} else if(scene_state->selected_control == BadUsb) {
scene_state->badusb_enabled = !scene_state->badusb_enabled;
}
#ifdef TOTP_BADBT_TYPE_ENABLED
else if(scene_state->selected_control == BadBt) {
scene_state->badbt_enabled = !scene_state->badbt_enabled;
}
#endif
break;
case InputKeyOk:
break;
case InputKeyBack: {
totp_scene_director_activate_scene(plugin_state, TotpSceneTokenMenu); totp_scene_director_activate_scene(plugin_state, TotpSceneTokenMenu);
break;
} }
break; default:
case InputKeyBack: { break;
}
} else if(
event->input.type == InputTypeRelease && event->input.key == InputKeyOk &&
scene_state->selected_control == ConfirmButton) {
plugin_state->timezone_offset =
(float)scene_state->tz_offset_hours + (float)scene_state->tz_offset_minutes / 60.0f;
plugin_state->notification_method =
(scene_state->notification_sound ? NotificationMethodSound : NotificationMethodNone) |
(scene_state->notification_vibro ? NotificationMethodVibro : NotificationMethodNone);
plugin_state->automation_method = scene_state->badusb_enabled ? AutomationMethodBadUsb :
AutomationMethodNone;
#ifdef TOTP_BADBT_TYPE_ENABLED
plugin_state->automation_method |= scene_state->badbt_enabled ? AutomationMethodBadBt :
AutomationMethodNone;
#endif
if(!totp_config_file_update_user_settings(plugin_state)) {
totp_dialogs_config_updating_error(plugin_state);
return false;
}
#ifdef TOTP_BADBT_TYPE_ENABLED
if(!scene_state->badbt_enabled && plugin_state->bt_type_code_worker_context != NULL) {
totp_bt_type_code_worker_free(plugin_state->bt_type_code_worker_context);
plugin_state->bt_type_code_worker_context = NULL;
}
#endif
totp_scene_director_activate_scene(plugin_state, TotpSceneTokenMenu); totp_scene_director_activate_scene(plugin_state, TotpSceneTokenMenu);
break;
}
default:
break;
} }
return true; return true;

View File

@@ -83,38 +83,45 @@ bool totp_scene_authenticate_handle_event(
return false; return false;
} }
if(event->input.type != InputTypePress) { SceneState* scene_state = plugin_state->current_scene_state;
return true; if(event->input.type == InputTypePress) {
} switch(event->input.key) {
case InputKeyUp:
SceneState* scene_state = (SceneState*)plugin_state->current_scene_state; if(scene_state->code_length < MAX_CODE_LENGTH) {
scene_state->code_input[scene_state->code_length] = PinCodeArrowUp;
switch(event->input.key) { scene_state->code_length++;
case InputKeyUp: }
if(scene_state->code_length < MAX_CODE_LENGTH) { break;
scene_state->code_input[scene_state->code_length] = PinCodeArrowUp; case InputKeyDown:
scene_state->code_length++; if(scene_state->code_length < MAX_CODE_LENGTH) {
scene_state->code_input[scene_state->code_length] = PinCodeArrowDown;
scene_state->code_length++;
}
break;
case InputKeyRight:
if(scene_state->code_length < MAX_CODE_LENGTH) {
scene_state->code_input[scene_state->code_length] = PinCodeArrowRight;
scene_state->code_length++;
}
break;
case InputKeyLeft:
if(scene_state->code_length < MAX_CODE_LENGTH) {
scene_state->code_input[scene_state->code_length] = PinCodeArrowLeft;
scene_state->code_length++;
}
break;
case InputKeyOk:
break;
case InputKeyBack:
if(scene_state->code_length > 0) {
scene_state->code_input[scene_state->code_length - 1] = 0;
scene_state->code_length--;
}
break;
default:
break;
} }
break; } else if(event->input.type == InputTypeRelease && event->input.key == InputKeyOk) {
case InputKeyDown:
if(scene_state->code_length < MAX_CODE_LENGTH) {
scene_state->code_input[scene_state->code_length] = PinCodeArrowDown;
scene_state->code_length++;
}
break;
case InputKeyRight:
if(scene_state->code_length < MAX_CODE_LENGTH) {
scene_state->code_input[scene_state->code_length] = PinCodeArrowRight;
scene_state->code_length++;
}
break;
case InputKeyLeft:
if(scene_state->code_length < MAX_CODE_LENGTH) {
scene_state->code_input[scene_state->code_length] = PinCodeArrowLeft;
scene_state->code_length++;
}
break;
case InputKeyOk: {
CryptoSeedIVResult seed_result = totp_crypto_seed_iv( CryptoSeedIVResult seed_result = totp_crypto_seed_iv(
plugin_state, &scene_state->code_input[0], scene_state->code_length); plugin_state, &scene_state->code_input[0], scene_state->code_length);
@@ -145,16 +152,6 @@ bool totp_scene_authenticate_handle_event(
dialog_message_show(plugin_state->dialogs_app, message); dialog_message_show(plugin_state->dialogs_app, message);
dialog_message_free(message); dialog_message_free(message);
} }
break;
}
case InputKeyBack:
if(scene_state->code_length > 0) {
scene_state->code_input[scene_state->code_length - 1] = 0;
scene_state->code_length--;
}
break;
default:
break;
} }
return true; return true;

View File

@@ -16,7 +16,7 @@
#ifdef TOTP_BADBT_TYPE_ENABLED #ifdef TOTP_BADBT_TYPE_ENABLED
#include "../../../workers/bt_type_code/bt_type_code.h" #include "../../../workers/bt_type_code/bt_type_code.h"
#endif #endif
#include "../../fonts/mode-nine/mode_nine.h" #include "../../fonts/active_font.h"
#define PROGRESS_BAR_MARGIN (3) #define PROGRESS_BAR_MARGIN (3)
#define PROGRESS_BAR_HEIGHT (4) #define PROGRESS_BAR_HEIGHT (4)
@@ -142,19 +142,19 @@ static void draw_totp_code(Canvas* const canvas, const PluginState* const plugin
totp_config_get_token_iterator_context(plugin_state); totp_config_get_token_iterator_context(plugin_state);
uint8_t code_length = totp_token_info_iterator_get_current_token(iterator_context)->digits; uint8_t code_length = totp_token_info_iterator_get_current_token(iterator_context)->digits;
uint8_t offset_x = scene_state->ui_precalculated_dimensions.code_offset_x; uint8_t offset_x = scene_state->ui_precalculated_dimensions.code_offset_x;
uint8_t char_width = modeNine_15ptFontInfo.charInfo[0].width; uint8_t char_width = TOTP_CODE_FONT_INFO.charInfo[0].width;
uint8_t offset_x_inc = scene_state->ui_precalculated_dimensions.code_offset_x_inc; uint8_t offset_x_inc = scene_state->ui_precalculated_dimensions.code_offset_x_inc;
for(uint8_t i = 0; i < code_length; i++) { for(uint8_t i = 0; i < code_length; i++) {
char ch = scene_state->last_code[i]; char ch = scene_state->last_code[i];
if(ch >= modeNine_15ptFontInfo.startChar && ch <= modeNine_15ptFontInfo.endChar) { if(ch >= TOTP_CODE_FONT_INFO.startChar && ch <= TOTP_CODE_FONT_INFO.endChar) {
uint8_t char_index = ch - modeNine_15ptFontInfo.startChar; uint8_t char_index = ch - TOTP_CODE_FONT_INFO.startChar;
canvas_draw_xbm( canvas_draw_xbm(
canvas, canvas,
offset_x, offset_x,
scene_state->ui_precalculated_dimensions.code_offset_y, scene_state->ui_precalculated_dimensions.code_offset_y,
char_width, char_width,
modeNine_15ptFontInfo.height, TOTP_CODE_FONT_INFO.height,
&modeNine_15ptFontInfo.data[modeNine_15ptFontInfo.charInfo[char_index].offset]); &TOTP_CODE_FONT_INFO.data[TOTP_CODE_FONT_INFO.charInfo[char_index].offset]);
} }
offset_x += offset_x_inc; offset_x += offset_x_inc;
@@ -172,15 +172,15 @@ static void on_new_token_code_generated(bool time_left, void* context) {
SceneState* scene_state = plugin_state->current_scene_state; SceneState* scene_state = plugin_state->current_scene_state;
const TokenInfo* current_token = totp_token_info_iterator_get_current_token(iterator_context); const TokenInfo* current_token = totp_token_info_iterator_get_current_token(iterator_context);
uint8_t char_width = modeNine_15ptFontInfo.charInfo[0].width; uint8_t char_width = TOTP_CODE_FONT_INFO.charInfo[0].width;
scene_state->ui_precalculated_dimensions.code_total_length = scene_state->ui_precalculated_dimensions.code_total_length =
current_token->digits * (char_width + modeNine_15ptFontInfo.spacePixels); current_token->digits * (char_width + TOTP_CODE_FONT_INFO.spacePixels);
scene_state->ui_precalculated_dimensions.code_offset_x = scene_state->ui_precalculated_dimensions.code_offset_x =
(SCREEN_WIDTH - scene_state->ui_precalculated_dimensions.code_total_length) >> 1; (SCREEN_WIDTH - scene_state->ui_precalculated_dimensions.code_total_length) >> 1;
scene_state->ui_precalculated_dimensions.code_offset_x_inc = scene_state->ui_precalculated_dimensions.code_offset_x_inc =
char_width + modeNine_15ptFontInfo.spacePixels; char_width + TOTP_CODE_FONT_INFO.spacePixels;
scene_state->ui_precalculated_dimensions.code_offset_y = scene_state->ui_precalculated_dimensions.code_offset_y =
SCREEN_HEIGHT_CENTER - (modeNine_15ptFontInfo.height >> 1); SCREEN_HEIGHT_CENTER - (TOTP_CODE_FONT_INFO.height >> 1);
if(time_left) { if(time_left) {
notification_message( notification_message(
@@ -381,54 +381,51 @@ bool totp_scene_generate_token_handle_event(
return true; return true;
} }
#endif #endif
} } else if(event->input.type == InputTypePress || event->input.type == InputTypeRepeat) {
switch(event->input.key) {
case InputKeyUp:
break;
case InputKeyDown:
break;
case InputKeyRight: {
const TokenInfoIteratorContext* iterator_context =
totp_config_get_token_iterator_context(plugin_state);
size_t current_token_index =
totp_token_info_iterator_get_current_token_index(iterator_context);
totp_roll_value_size_t(
&current_token_index,
1,
0,
totp_token_info_iterator_get_total_count(iterator_context) - 1,
RollOverflowBehaviorRoll);
if(event->input.type != InputTypePress && event->input.type != InputTypeRepeat) { update_totp_params(plugin_state, current_token_index);
return true; break;
} }
case InputKeyLeft: {
const TokenInfoIteratorContext* iterator_context =
totp_config_get_token_iterator_context(plugin_state);
size_t current_token_index =
totp_token_info_iterator_get_current_token_index(iterator_context);
totp_roll_value_size_t(
&current_token_index,
-1,
0,
totp_token_info_iterator_get_total_count(iterator_context) - 1,
RollOverflowBehaviorRoll);
switch(event->input.key) { update_totp_params(plugin_state, current_token_index);
case InputKeyUp: break;
break; }
case InputKeyDown: case InputKeyOk:
break; break;
case InputKeyRight: { case InputKeyBack:
const TokenInfoIteratorContext* iterator_context = break;
totp_config_get_token_iterator_context(plugin_state); default:
size_t current_token_index = break;
totp_token_info_iterator_get_current_token_index(iterator_context); }
totp_roll_value_size_t( } else if(event->input.type == InputTypeRelease && event->input.key == InputKeyOk) {
&current_token_index,
1,
0,
totp_token_info_iterator_get_total_count(iterator_context) - 1,
RollOverflowBehaviorRoll);
update_totp_params(plugin_state, current_token_index);
break;
}
case InputKeyLeft: {
const TokenInfoIteratorContext* iterator_context =
totp_config_get_token_iterator_context(plugin_state);
size_t current_token_index =
totp_token_info_iterator_get_current_token_index(iterator_context);
totp_roll_value_size_t(
&current_token_index,
-1,
0,
totp_token_info_iterator_get_total_count(iterator_context) - 1,
RollOverflowBehaviorRoll);
update_totp_params(plugin_state, current_token_index);
break;
}
case InputKeyOk:
totp_scene_director_activate_scene(plugin_state, TotpSceneTokenMenu); totp_scene_director_activate_scene(plugin_state, TotpSceneTokenMenu);
break;
case InputKeyBack:
break;
default:
break;
} }
return true; return true;

View File

@@ -82,38 +82,52 @@ bool totp_scene_token_menu_handle_event(const PluginEvent* const event, PluginSt
} }
SceneState* scene_state = (SceneState*)plugin_state->current_scene_state; SceneState* scene_state = (SceneState*)plugin_state->current_scene_state;
if(event->input.type != InputTypePress) { if(event->input.type == InputTypePress) {
return true; switch(event->input.key) {
} case InputKeyUp: {
const TokenInfoIteratorContext* iterator_context =
switch(event->input.key) { totp_config_get_token_iterator_context(plugin_state);
case InputKeyUp: { totp_roll_value_uint8_t(
const TokenInfoIteratorContext* iterator_context = &scene_state->selected_control,
totp_config_get_token_iterator_context(plugin_state); -1,
totp_roll_value_uint8_t( AddNewToken,
&scene_state->selected_control, -1, AddNewToken, AppSettings, RollOverflowBehaviorRoll); AppSettings,
if(scene_state->selected_control == DeleteToken && RollOverflowBehaviorRoll);
totp_token_info_iterator_get_total_count(iterator_context) == 0) { if(scene_state->selected_control == DeleteToken &&
scene_state->selected_control--; totp_token_info_iterator_get_total_count(iterator_context) == 0) {
scene_state->selected_control--;
}
break;
} }
break; case InputKeyDown: {
} const TokenInfoIteratorContext* iterator_context =
case InputKeyDown: { totp_config_get_token_iterator_context(plugin_state);
const TokenInfoIteratorContext* iterator_context = totp_roll_value_uint8_t(
totp_config_get_token_iterator_context(plugin_state); &scene_state->selected_control,
totp_roll_value_uint8_t( 1,
&scene_state->selected_control, 1, AddNewToken, AppSettings, RollOverflowBehaviorRoll); AddNewToken,
if(scene_state->selected_control == DeleteToken && AppSettings,
totp_token_info_iterator_get_total_count(iterator_context) == 0) { RollOverflowBehaviorRoll);
scene_state->selected_control++; if(scene_state->selected_control == DeleteToken &&
totp_token_info_iterator_get_total_count(iterator_context) == 0) {
scene_state->selected_control++;
}
break;
} }
break; case InputKeyRight:
} break;
case InputKeyRight: case InputKeyLeft:
break; break;
case InputKeyLeft: case InputKeyOk:
break; break;
case InputKeyOk: case InputKeyBack: {
totp_scene_director_activate_scene(plugin_state, TotpSceneGenerateToken);
break;
}
default:
break;
}
} else if(event->input.type == InputTypeRelease && event->input.key == InputKeyOk) {
switch(scene_state->selected_control) { switch(scene_state->selected_control) {
case AddNewToken: { case AddNewToken: {
totp_scene_director_activate_scene(plugin_state, TotpSceneAddNewToken); totp_scene_director_activate_scene(plugin_state, TotpSceneAddNewToken);
@@ -153,13 +167,6 @@ bool totp_scene_token_menu_handle_event(const PluginEvent* const event, PluginSt
default: default:
break; break;
} }
break;
case InputKeyBack: {
totp_scene_director_activate_scene(plugin_state, TotpSceneGenerateToken);
break;
}
default:
break;
} }
return true; return true;

View File

@@ -25,18 +25,21 @@ static const char* STEAM_ALGO_ALPHABET = "23456789BCDFGHJKMNPQRTVWXY";
static void static void
int_token_to_str(uint64_t i_token_code, char* str, TokenDigitsCount len, TokenHashAlgo algo) { int_token_to_str(uint64_t i_token_code, char* str, TokenDigitsCount len, TokenHashAlgo algo) {
str[len] = '\0'; char* last_char = str + len;
*last_char = '\0';
if(i_token_code == OTP_ERROR) { if(i_token_code == OTP_ERROR) {
memset(&str[0], '-', len); memset(str, '-', len);
} else { } else {
if(algo == STEAM) { if(algo == STEAM) {
for(uint8_t i = 0; i < len; i++) { char* s = str;
str[i] = STEAM_ALGO_ALPHABET[i_token_code % 26]; for(uint8_t i = 0; i < len; i++, s++) {
*s = STEAM_ALGO_ALPHABET[i_token_code % 26];
i_token_code = i_token_code / 26; i_token_code = i_token_code / 26;
} }
} else { } else {
for(int8_t i = len - 1; i >= 0; i--) { char* s = --last_char;
str[i] = CONVERT_DIGIT_TO_CHAR(i_token_code % 10); for(int8_t i = len - 1; i >= 0; i--, s--) {
*s = CONVERT_DIGIT_TO_CHAR(i_token_code % 10);
i_token_code = i_token_code / 10; i_token_code = i_token_code / 10;
} }
} }

View File

@@ -47,11 +47,12 @@ void totp_type_code_worker_execute_automation(
TokenAutomationFeature features) { TokenAutomationFeature features) {
furi_delay_ms(500); furi_delay_ms(500);
uint8_t i = 0; uint8_t i = 0;
char cb_char;
while(i < code_buffer_size && code_buffer[i] != 0) { while(i < code_buffer_size && (cb_char = code_buffer[i]) != 0) {
uint8_t char_index = CONVERT_CHAR_TO_DIGIT(code_buffer[i]); uint8_t char_index = CONVERT_CHAR_TO_DIGIT(cb_char);
if(char_index > 9) { if(char_index > 9) {
char_index = code_buffer[i] - 0x41 + 10; char_index = cb_char - 0x41 + 10;
} }
if(char_index > 35) break; if(char_index > 35) break;