Przeglądaj źródła

Merge totp from https://github.com/akopachov/flipper-zero_authenticator

Willy-JL 1 rok temu
rodzic
commit
b643a4aad2
3 zmienionych plików z 24 dodań i 12 usunięć
  1. 1 1
      totp/application.fam
  2. 21 9
      totp/cli/plugins/export/export.c
  3. 2 2
      totp/version.h

+ 1 - 1
totp/application.fam

@@ -7,7 +7,7 @@ App(
     requires=["gui", "cli", "dialogs", "storage", "input", "notification", "bt"],
     stack_size=2 * 1024,
     order=20,
-    fap_version="5.151",
+    fap_version="5.160",
     fap_author="Alexander Kopachov (@akopachov)",
     fap_description="Software-based TOTP/HOTP authenticator for Flipper Zero device",
     fap_weburl="https://github.com/akopachov/flipper-zero_authenticator",

+ 21 - 9
totp/cli/plugins/export/export.c

@@ -1,4 +1,6 @@
 #include <lib/toolbox/args.h>
+#include <dialogs/dialogs.h>
+#include "../../../ui/constants.h"
 #include <flipper_application/flipper_application.h>
 #include "../../../lib/polyfills/memset_s.h"
 #include "../../../services/config/config.h"
@@ -57,19 +59,29 @@ static void handle(PluginState* plugin_state, FuriString* args, Cli* cli) {
     TOTP_CLI_PRINTF_WARNING("WARNING!\r\n");
     TOTP_CLI_PRINTF_WARNING(
         "ALL THE INFORMATION (INCL. UNENCRYPTED SECRET) ABOUT ALL THE TOKENS WILL BE EXPORTED AND PRINTED TO THE CONSOLE.\r\n");
-    TOTP_CLI_PRINTF_WARNING("Confirm? [y/n]\r\n");
-    fflush(stdout);
-    char user_pick;
-    do {
-        user_pick = tolower(cli_getc(cli));
-    } while(user_pick != 'y' && user_pick != 'n' && user_pick != CliSymbolAsciiCR &&
-            user_pick != CliSymbolAsciiETX && user_pick != CliSymbolAsciiEsc);
-
-    if(user_pick != 'y' && user_pick != CliSymbolAsciiCR) {
+    TOTP_CLI_PRINTF_WARNING("Confirm this action on your Flipper\r\n");
+
+    DialogMessage* message = dialog_message_alloc();
+    dialog_message_set_buttons(message, "No", NULL, "Yes");
+    dialog_message_set_text(
+        message,
+        "Would you like to\nEXPORT TOKENS AND\nUNENCRYPTED SECRETS?",
+        SCREEN_WIDTH_CENTER,
+        SCREEN_HEIGHT_CENTER - 8,
+        AlignCenter,
+        AlignCenter);
+    DialogMessageButton dialog_result = dialog_message_show(plugin_state->dialogs_app, message);
+    dialog_message_free(message);
+
+    if(dialog_result != DialogMessageButtonRight) {
         TOTP_CLI_PRINTF_INFO("User has not confirmed\r\n");
         return;
     }
 
+    if(!totp_cli_ensure_authenticated(plugin_state, cli)) {
+        return;
+    }
+
     TokenInfoIteratorContext* iterator_context =
         totp_config_get_token_iterator_context(plugin_state);
     size_t total_count = totp_token_info_iterator_get_total_count(iterator_context);

+ 2 - 2
totp/version.h

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