Update TOTP

This commit is contained in:
MX 2023-05-26 13:22:06 +03:00
parent 12f9b6a89e
commit 24ad48d390
No known key found for this signature in database
GPG key ID: 7CCC66B7DBDD1C83
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) {
InputTextSceneState* text_input_state = (InputTextSceneState*)context;
if(text_input_state->callback != 0) {
if(text_input_state->callback != NULL) {
InputTextSceneCallbackResult* result = malloc(sizeof(InputTextSceneCallbackResult));
furi_check(result != NULL);
result->user_input_length =

View file

@ -36,7 +36,7 @@ typedef struct {
InputTextSceneContext* token_name_input_context;
InputTextSceneContext* token_secret_input_context;
InputTextSceneState* input_state;
uint32_t input_started_at;
bool text_input_mode;
int16_t screen_y_offset;
TokenHashAlgo algo;
uint8_t digits_count_index;
@ -56,7 +56,7 @@ static void on_token_name_user_comitted(InputTextSceneCallbackResult* result) {
free(scene_state->token_name);
scene_state->token_name = result->user_input;
scene_state->token_name_length = result->user_input_length;
scene_state->input_started_at = 0;
scene_state->text_input_mode = false;
free(result);
}
@ -65,7 +65,7 @@ static void on_token_secret_user_comitted(InputTextSceneCallbackResult* result)
free(scene_state->token_secret);
scene_state->token_secret = result->user_input;
scene_state->token_secret_length = result->user_input_length;
scene_state->input_started_at = 0;
scene_state->text_input_mode = false;
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) {
SceneState* scene_state = (SceneState*)plugin_state->current_scene_state;
if(scene_state->input_started_at > 0) {
SceneState* scene_state = plugin_state->current_scene_state;
if(scene_state->text_input_mode) {
totp_input_text_render(canvas, scene_state->input_state);
return;
}
@ -200,63 +200,81 @@ bool totp_scene_add_new_token_handle_event(PluginEvent* const event, PluginState
return true;
}
SceneState* scene_state = (SceneState*)plugin_state->current_scene_state;
if(scene_state->input_started_at > 0 &&
furi_get_tick() - scene_state->input_started_at > 300) {
SceneState* scene_state = plugin_state->current_scene_state;
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);
}
if(event->input.type == InputTypeLong && event->input.key == InputKeyBack) {
return false;
}
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) {
if(event->input.type == InputTypePress) {
switch(event->input.key) {
case InputKeyUp:
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);
&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(
&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;
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:
} else if(event->input.type == InputTypeRelease && event->input.key == InputKeyOk) {
switch(scene_state->selected_control) {
case TokenNameTextBox:
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 =
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;
case TokenSecretTextBox:
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 =
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;
case TokenAlgoSelect:
break;
@ -313,12 +333,6 @@ bool totp_scene_add_new_token_handle_event(PluginEvent* const event, PluginState
default:
break;
}
break;
case InputKeyBack:
totp_scene_director_activate_scene(plugin_state, TotpSceneGenerateToken);
break;
default:
break;
}
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) {
uint8_t index = 0;
char* s = str;
if(num < 0) {
str[index++] = '-';
*(s++) = '-';
num = -num;
}
uint8_t d1 = (num / 10) % 10;
uint8_t d2 = num % 10;
str[index++] = CONVERT_DIGIT_TO_CHAR(d1);
str[index++] = CONVERT_DIGIT_TO_CHAR(d2);
str[index++] = '\0';
*(s++) = CONVERT_DIGIT_TO_CHAR(d1);
*(s++) = CONVERT_DIGIT_TO_CHAR(d2);
*(s++) = '\0';
}
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;
if(event->input.type != InputTypePress && event->input.type != InputTypeRepeat) {
return true;
}
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) {
if(event->input.type == InputTypePress || event->input.type == InputTypeRepeat) {
switch(event->input.key) {
case InputKeyUp:
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 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:
if(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;
&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(
&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
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;
else if(scene_state->selected_control == BadBt) {
scene_state->badbt_enabled = !scene_state->badbt_enabled;
}
#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);
break;
}
break;
case InputKeyBack: {
default:
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);
break;
}
default:
break;
}
return true;

View file

@ -83,38 +83,45 @@ bool totp_scene_authenticate_handle_event(
return false;
}
if(event->input.type != InputTypePress) {
return true;
}
SceneState* scene_state = (SceneState*)plugin_state->current_scene_state;
switch(event->input.key) {
case InputKeyUp:
if(scene_state->code_length < MAX_CODE_LENGTH) {
scene_state->code_input[scene_state->code_length] = PinCodeArrowUp;
scene_state->code_length++;
SceneState* scene_state = plugin_state->current_scene_state;
if(event->input.type == InputTypePress) {
switch(event->input.key) {
case InputKeyUp:
if(scene_state->code_length < MAX_CODE_LENGTH) {
scene_state->code_input[scene_state->code_length] = PinCodeArrowUp;
scene_state->code_length++;
}
break;
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:
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;
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: {
} else if(event->input.type == InputTypeRelease && event->input.key == InputKeyOk) {
CryptoSeedIVResult seed_result = totp_crypto_seed_iv(
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_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;

View file

@ -16,7 +16,7 @@
#ifdef TOTP_BADBT_TYPE_ENABLED
#include "../../../workers/bt_type_code/bt_type_code.h"
#endif
#include "../../fonts/mode-nine/mode_nine.h"
#include "../../fonts/active_font.h"
#define PROGRESS_BAR_MARGIN (3)
#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);
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 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;
for(uint8_t i = 0; i < code_length; i++) {
char ch = scene_state->last_code[i];
if(ch >= modeNine_15ptFontInfo.startChar && ch <= modeNine_15ptFontInfo.endChar) {
uint8_t char_index = ch - modeNine_15ptFontInfo.startChar;
if(ch >= TOTP_CODE_FONT_INFO.startChar && ch <= TOTP_CODE_FONT_INFO.endChar) {
uint8_t char_index = ch - TOTP_CODE_FONT_INFO.startChar;
canvas_draw_xbm(
canvas,
offset_x,
scene_state->ui_precalculated_dimensions.code_offset_y,
char_width,
modeNine_15ptFontInfo.height,
&modeNine_15ptFontInfo.data[modeNine_15ptFontInfo.charInfo[char_index].offset]);
TOTP_CODE_FONT_INFO.height,
&TOTP_CODE_FONT_INFO.data[TOTP_CODE_FONT_INFO.charInfo[char_index].offset]);
}
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;
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 =
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 =
(SCREEN_WIDTH - scene_state->ui_precalculated_dimensions.code_total_length) >> 1;
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 =
SCREEN_HEIGHT_CENTER - (modeNine_15ptFontInfo.height >> 1);
SCREEN_HEIGHT_CENTER - (TOTP_CODE_FONT_INFO.height >> 1);
if(time_left) {
notification_message(
@ -381,54 +381,51 @@ bool totp_scene_generate_token_handle_event(
return true;
}
#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) {
return true;
}
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);
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);
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:
update_totp_params(plugin_state, current_token_index);
break;
}
case InputKeyOk:
break;
case InputKeyBack:
break;
default:
break;
}
} else if(event->input.type == InputTypeRelease && event->input.key == InputKeyOk) {
totp_scene_director_activate_scene(plugin_state, TotpSceneTokenMenu);
break;
case InputKeyBack:
break;
default:
break;
}
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;
if(event->input.type != InputTypePress) {
return true;
}
switch(event->input.key) {
case InputKeyUp: {
const TokenInfoIteratorContext* iterator_context =
totp_config_get_token_iterator_context(plugin_state);
totp_roll_value_uint8_t(
&scene_state->selected_control, -1, AddNewToken, AppSettings, RollOverflowBehaviorRoll);
if(scene_state->selected_control == DeleteToken &&
totp_token_info_iterator_get_total_count(iterator_context) == 0) {
scene_state->selected_control--;
if(event->input.type == InputTypePress) {
switch(event->input.key) {
case InputKeyUp: {
const TokenInfoIteratorContext* iterator_context =
totp_config_get_token_iterator_context(plugin_state);
totp_roll_value_uint8_t(
&scene_state->selected_control,
-1,
AddNewToken,
AppSettings,
RollOverflowBehaviorRoll);
if(scene_state->selected_control == DeleteToken &&
totp_token_info_iterator_get_total_count(iterator_context) == 0) {
scene_state->selected_control--;
}
break;
}
break;
}
case InputKeyDown: {
const TokenInfoIteratorContext* iterator_context =
totp_config_get_token_iterator_context(plugin_state);
totp_roll_value_uint8_t(
&scene_state->selected_control, 1, AddNewToken, AppSettings, RollOverflowBehaviorRoll);
if(scene_state->selected_control == DeleteToken &&
totp_token_info_iterator_get_total_count(iterator_context) == 0) {
scene_state->selected_control++;
case InputKeyDown: {
const TokenInfoIteratorContext* iterator_context =
totp_config_get_token_iterator_context(plugin_state);
totp_roll_value_uint8_t(
&scene_state->selected_control,
1,
AddNewToken,
AppSettings,
RollOverflowBehaviorRoll);
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 InputKeyLeft:
break;
case InputKeyOk:
case InputKeyRight:
break;
case InputKeyLeft:
break;
case InputKeyOk:
break;
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) {
case AddNewToken: {
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:
break;
}
break;
case InputKeyBack: {
totp_scene_director_activate_scene(plugin_state, TotpSceneGenerateToken);
break;
}
default:
break;
}
return true;

View file

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

View file

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