MX пре 2 година
родитељ
комит
12ace98f27

+ 1 - 1
application.fam

@@ -15,7 +15,7 @@ App(
     ],
     stack_size=2 * 1024,
     order=20,
-    fap_version="4.03",
+    fap_version="4.10",
     fap_author="Alexander Kopachov (@akopachov)",
     fap_description="Software-based TOTP authenticator for Flipper Zero device",
     fap_weburl="https://github.com/akopachov/flipper-zero_authenticator",

+ 3 - 0
cli/cli.c

@@ -15,6 +15,7 @@
 #include "commands/reset/reset.h"
 #include "commands/automation/automation.h"
 #include "commands/details/details.h"
+#include "commands/version/version.h"
 
 struct TotpCliContext {
     PluginState* plugin_state;
@@ -74,6 +75,8 @@ static void totp_cli_handler(Cli* cli, FuriString* args, void* context) {
         furi_string_cmp_str(cmd, TOTP_CLI_COMMAND_DETAILS) == 0 ||
         furi_string_cmp_str(cmd, TOTP_CLI_COMMAND_DETAILS_ALT) == 0) {
         totp_cli_command_details_handle(plugin_state, args, cli);
+    } else if(furi_string_cmp_str(cmd, TOTP_CLI_COMMAND_VERSION) == 0) {
+        totp_cli_command_version_handle();
     } else {
         totp_cli_print_unknown_command(cmd);
     }

+ 7 - 0
cli/commands/automation/automation.c

@@ -12,6 +12,7 @@
 #endif
 #define TOTP_CLI_COMMAND_AUTOMATION_LAYOUT_QWERTY "QWERTY"
 #define TOTP_CLI_COMMAND_AUTOMATION_LAYOUT_AZERTY "AZERTY"
+#define TOTP_CLI_COMMAND_AUTOMATION_LAYOUT_QWERTZ "QWERTZ"
 #define TOTP_CLI_COMMAND_AUTOMATION_ARG_KB_LAYOUT_PREFIX "-k"
 #define TOTP_CLI_COMMAND_AUTOMATION_ARG_KB_LAYOUT "layout"
 
@@ -44,6 +45,7 @@ void totp_cli_command_automation_docopt_options() {
         DOCOPT_ARGUMENT(
             TOTP_CLI_COMMAND_AUTOMATION_ARG_KB_LAYOUT)) "    Automation keyboard layout. Must be one of: " TOTP_CLI_COMMAND_AUTOMATION_LAYOUT_QWERTY
                                                         ", " TOTP_CLI_COMMAND_AUTOMATION_LAYOUT_AZERTY
+                                                        ", " TOTP_CLI_COMMAND_AUTOMATION_LAYOUT_QWERTZ
                                                         "\r\n");
 }
 #endif
@@ -83,6 +85,9 @@ static void print_kb_layout(AutomationKeyboardLayout layout, const char* color)
     case AutomationKeyboardLayoutAZERTY:
         layoutToPrint = TOTP_CLI_COMMAND_AUTOMATION_LAYOUT_AZERTY;
         break;
+    case AutomationKeyboardLayoutQWERTZ:
+        layoutToPrint = TOTP_CLI_COMMAND_AUTOMATION_LAYOUT_QWERTZ;
+        break;
     default:
         furi_crash("Unknown automation keyboard layout");
         break;
@@ -98,6 +103,8 @@ static bool
         *out = AutomationKeyboardLayoutQWERTY;
     } else if(furi_string_cmpi_str(str, TOTP_CLI_COMMAND_AUTOMATION_LAYOUT_AZERTY) == 0) {
         *out = AutomationKeyboardLayoutAZERTY;
+    } else if(furi_string_cmpi_str(str, TOTP_CLI_COMMAND_AUTOMATION_LAYOUT_QWERTZ) == 0) {
+        *out = AutomationKeyboardLayoutQWERTZ;
     } else {
         result = false;
     }

+ 3 - 0
cli/commands/help/help.c

@@ -11,6 +11,7 @@
 #include "../reset/reset.h"
 #include "../automation/automation.h"
 #include "../details/details.h"
+#include "../version/version.h"
 
 #ifdef TOTP_CLI_RICH_HELP_ENABLED
 void totp_cli_command_help_docopt_commands() {
@@ -29,6 +30,7 @@ void totp_cli_command_help_handle() {
 #ifdef TOTP_CLI_RICH_HELP_ENABLED
     TOTP_CLI_PRINTF("Usage:\r\n");
     totp_cli_command_help_docopt_usage();
+    totp_cli_command_version_docopt_usage();
     totp_cli_command_list_docopt_usage();
     totp_cli_command_details_docopt_usage();
     totp_cli_command_add_docopt_usage();
@@ -43,6 +45,7 @@ void totp_cli_command_help_handle() {
     cli_nl();
     TOTP_CLI_PRINTF("Commands:\r\n");
     totp_cli_command_help_docopt_commands();
+    totp_cli_command_version_docopt_commands();
     totp_cli_command_list_docopt_commands();
     totp_cli_command_details_docopt_commands();
     totp_cli_command_add_docopt_commands();

+ 20 - 0
cli/commands/version/version.c

@@ -0,0 +1,20 @@
+#include "version.h"
+#include "../../cli_helpers.h"
+#include "../../../version.h"
+
+#ifdef TOTP_CLI_RICH_HELP_ENABLED
+void totp_cli_command_version_docopt_commands() {
+    TOTP_CLI_PRINTF("  " TOTP_CLI_COMMAND_VERSION "          Get application version\r\n");
+}
+void totp_cli_command_version_docopt_usage() {
+    TOTP_CLI_PRINTF("  " TOTP_CLI_COMMAND_NAME " " TOTP_CLI_COMMAND_VERSION "\r\n");
+}
+#endif
+
+void totp_cli_command_version_handle() {
+    TOTP_CLI_PRINTF(
+        "%" PRIu8 ".%" PRIu8 ".%" PRIu8 "\r\n",
+        TOTP_APP_VERSION_MAJOR,
+        TOTP_APP_VERSION_MINOR,
+        TOTP_APP_VERSION_PATCH);
+}

+ 11 - 0
cli/commands/version/version.h

@@ -0,0 +1,11 @@
+#pragma once
+
+#include "../../../config/app/config.h"
+
+#define TOTP_CLI_COMMAND_VERSION "version"
+
+void totp_cli_command_version_handle();
+#ifdef TOTP_CLI_RICH_HELP_ENABLED
+void totp_cli_command_version_docopt_commands();
+void totp_cli_command_version_docopt_usage();
+#endif

+ 2 - 1
types/automation_kb_layout.h

@@ -4,5 +4,6 @@ typedef uint8_t AutomationKeyboardLayout;
 
 enum AutomationKeyboardLayouts {
     AutomationKeyboardLayoutQWERTY = 0,
-    AutomationKeyboardLayoutAZERTY = 1
+    AutomationKeyboardLayoutAZERTY = 1,
+    AutomationKeyboardLayoutQWERTZ = 2
 };

+ 2 - 2
ui/scenes/app_settings/totp_app_settings.c

@@ -20,7 +20,7 @@
 #else
 #define AUTOMATION_LIST_MAX_INDEX (1)
 #endif
-#define BAD_KB_LAYOUT_LIST_MAX_INDEX (1)
+#define BAD_KB_LAYOUT_LIST_MAX_INDEX (2)
 #define FONT_TEST_STR_LENGTH (7)
 
 static const char* YES_NO_LIST[] = {"NO", "YES"};
@@ -33,7 +33,7 @@ static const char* AUTOMATION_LIST[] = {
     "BT and USB"
 #endif
 };
-static const char* BAD_KB_LAYOUT_LIST[] = {"QWERTY", "AZERTY"};
+static const char* BAD_KB_LAYOUT_LIST[] = {"QWERTY", "AZERTY", "QWERTZ"};
 static const char* FONT_TEST_STR = "0123BCD";
 
 typedef enum {

+ 2 - 2
version.h

@@ -1,5 +1,5 @@
 #pragma once
 
 #define TOTP_APP_VERSION_MAJOR (4)
-#define TOTP_APP_VERSION_MINOR (0)
-#define TOTP_APP_VERSION_PATCH (3)
+#define TOTP_APP_VERSION_MINOR (1)
+#define TOTP_APP_VERSION_PATCH (0)

+ 13 - 0
workers/type_code_common.c

@@ -25,6 +25,16 @@ static const uint8_t hid_azerty_keys_map[HID_KEYS_MAP_LENGTH] = {
     HID_KEYBOARD_U, HID_KEYBOARD_V, HID_KEYBOARD_Z,         HID_KEYBOARD_X, HID_KEYBOARD_Y,
     HID_KEYBOARD_W};
 
+static const uint8_t hid_qwertz_keys_map[HID_KEYS_MAP_LENGTH] = {
+    HID_KEYBOARD_0, HID_KEYBOARD_1, HID_KEYBOARD_2, HID_KEYBOARD_3, HID_KEYBOARD_4,
+    HID_KEYBOARD_5, HID_KEYBOARD_6, HID_KEYBOARD_7, HID_KEYBOARD_8, HID_KEYBOARD_9,
+    HID_KEYBOARD_A, HID_KEYBOARD_B, HID_KEYBOARD_C, HID_KEYBOARD_D, HID_KEYBOARD_E,
+    HID_KEYBOARD_F, HID_KEYBOARD_G, HID_KEYBOARD_H, HID_KEYBOARD_I, HID_KEYBOARD_J,
+    HID_KEYBOARD_K, HID_KEYBOARD_L, HID_KEYBOARD_M, HID_KEYBOARD_N, HID_KEYBOARD_O,
+    HID_KEYBOARD_P, HID_KEYBOARD_Q, HID_KEYBOARD_R, HID_KEYBOARD_S, HID_KEYBOARD_T,
+    HID_KEYBOARD_U, HID_KEYBOARD_V, HID_KEYBOARD_W, HID_KEYBOARD_X, HID_KEYBOARD_Z,
+    HID_KEYBOARD_Y};
+
 static uint32_t get_keystroke_delay(TokenAutomationFeature features) {
     if(features & TokenAutomationFeatureTypeSlower) {
         return 100;
@@ -70,6 +80,9 @@ void totp_type_code_worker_execute_automation(
     case AutomationKeyboardLayoutAZERTY:
         keyboard_layout_dict = &hid_azerty_keys_map[0];
         break;
+    case AutomationKeyboardLayoutQWERTZ:
+        keyboard_layout_dict = &hid_qwertz_keys_map[0];
+        break;
 
     default:
         return;