Pārlūkot izejas kodu

WebCrawler: Same tweaks as FlipperHTTP suite

Willy-JL 1 gadu atpakaļ
vecāks
revīzija
a6d4e69be3

+ 5 - 9
web_crawler/app.c

@@ -1,4 +1,3 @@
-#include <uart_text_input.h>
 #include <web_crawler_e.h>
 #include <flipper_http.h>
 #include <web_crawler_storage.h>
@@ -10,19 +9,16 @@
  * @param      p  Input parameter - unused
  * @return     0 to indicate success, -1 on failure
  */
-int32_t web_crawler_app(void *p)
-{
+int32_t web_crawler_app(void* p) {
     UNUSED(p);
 
-    WebCrawlerApp *app = web_crawler_app_alloc();
-    if (!app)
-    {
+    WebCrawlerApp* app = web_crawler_app_alloc();
+    if(!app) {
         FURI_LOG_E(TAG, "Failed to allocate WebCrawlerApp");
         return -1;
     }
 
-    if (!flipper_http_ping())
-    {
+    if(!flipper_http_ping()) {
         FURI_LOG_E(TAG, "Failed to ping the device");
         return -1;
     }
@@ -34,4 +30,4 @@ int32_t web_crawler_app(void *p)
     web_crawler_app_free(app);
 
     return 0;
-}
+}

+ 2 - 2
web_crawler/application.fam

@@ -5,10 +5,10 @@ App(
     entry_point="web_crawler_app",
     stack_size=4 * 1024,
     fap_icon="app.png",
-    fap_category="GPIO",
+    fap_category="GPIO/FlipperHTTP",
     fap_icon_assets="assets",
     fap_description="Use Wi-Fi to access the internet and scrape data from the web.",
     fap_author="JBlanked",
     fap_weburl="https://github.com/jblanked/WebCrawler-FlipperZero",
-    fap_version = "0.7",
+    fap_version="0.7",
 )

BIN
web_crawler/assets/KeyBackspaceSelected_16x9.png


BIN
web_crawler/assets/KeyBackspace_16x9.png


BIN
web_crawler/assets/KeySaveSelected_24x11.png


BIN
web_crawler/assets/KeySave_24x11.png


+ 146 - 205
web_crawler/easy_flipper.h

@@ -17,7 +17,6 @@
 #include <gui/modules/dialog_ex.h>
 #include <gui/modules/popup.h>
 #include <gui/modules/loading.h>
-#include <uart_text_input.h>
 
 #define EASY_TAG "EasyFlipper"
 
@@ -26,11 +25,9 @@
  * @param context The context - unused
  * @return next view id (VIEW_NONE to exit the app)
  */
-uint32_t easy_flipper_callback_exit_app(void *context)
-{
+uint32_t easy_flipper_callback_exit_app(void* context) {
     // Exit the application
-    if (!context)
-    {
+    if(!context) {
         FURI_LOG_E(EASY_TAG, "Context is NULL");
         return VIEW_NONE;
     }
@@ -44,16 +41,13 @@ uint32_t easy_flipper_callback_exit_app(void *context)
  * @param buffer_size The size of the buffer
  * @return true if successful, false otherwise
  */
-bool easy_flipper_set_buffer(char **buffer, uint32_t buffer_size)
-{
-    if (!buffer)
-    {
+bool easy_flipper_set_buffer(char** buffer, uint32_t buffer_size) {
+    if(!buffer) {
         FURI_LOG_E(EASY_TAG, "Invalid arguments provided to set_buffer");
         return false;
     }
-    *buffer = (char *)malloc(buffer_size);
-    if (!*buffer)
-    {
+    *buffer = (char*)malloc(buffer_size);
+    if(!*buffer) {
         FURI_LOG_E(EASY_TAG, "Failed to allocate buffer");
         return false;
     }
@@ -72,39 +66,32 @@ bool easy_flipper_set_buffer(char **buffer, uint32_t buffer_size)
  * @return true if successful, false otherwise
  */
 bool easy_flipper_set_view(
-    View **view,
+    View** view,
     int32_t view_id,
-    void draw_callback(Canvas *, void *),
-    bool input_callback(InputEvent *, void *),
-    uint32_t (*previous_callback)(void *),
-    ViewDispatcher **view_dispatcher,
-    void *context)
-{
-    if (!view || !view_dispatcher)
-    {
+    void draw_callback(Canvas*, void*),
+    bool input_callback(InputEvent*, void*),
+    uint32_t (*previous_callback)(void*),
+    ViewDispatcher** view_dispatcher,
+    void* context) {
+    if(!view || !view_dispatcher) {
         FURI_LOG_E(EASY_TAG, "Invalid arguments provided to set_view");
         return false;
     }
     *view = view_alloc();
-    if (!*view)
-    {
+    if(!*view) {
         FURI_LOG_E(EASY_TAG, "Failed to allocate View");
         return false;
     }
-    if (draw_callback)
-    {
+    if(draw_callback) {
         view_set_draw_callback(*view, draw_callback);
     }
-    if (input_callback)
-    {
+    if(input_callback) {
         view_set_input_callback(*view, input_callback);
     }
-    if (context)
-    {
+    if(context) {
         view_set_context(*view, context);
     }
-    if (previous_callback)
-    {
+    if(previous_callback) {
         view_set_previous_callback(*view, previous_callback);
     }
     view_dispatcher_add_view(*view_dispatcher, view_id, *view);
@@ -118,22 +105,18 @@ bool easy_flipper_set_view(
  * @param context The context to pass to the event callback
  * @return true if successful, false otherwise
  */
-bool easy_flipper_set_view_dispatcher(ViewDispatcher **view_dispatcher, Gui *gui, void *context)
-{
-    if (!view_dispatcher)
-    {
+bool easy_flipper_set_view_dispatcher(ViewDispatcher** view_dispatcher, Gui* gui, void* context) {
+    if(!view_dispatcher) {
         FURI_LOG_E(EASY_TAG, "Invalid arguments provided to set_view_dispatcher");
         return false;
     }
     *view_dispatcher = view_dispatcher_alloc();
-    if (!*view_dispatcher)
-    {
+    if(!*view_dispatcher) {
         FURI_LOG_E(EASY_TAG, "Failed to allocate ViewDispatcher");
         return false;
     }
     view_dispatcher_attach_to_gui(*view_dispatcher, gui, ViewDispatcherTypeFullscreen);
-    if (context)
-    {
+    if(context) {
         view_dispatcher_set_event_callback_context(*view_dispatcher, context);
     }
     return true;
@@ -150,29 +133,24 @@ bool easy_flipper_set_view_dispatcher(ViewDispatcher **view_dispatcher, Gui *gui
  * @return true if successful, false otherwise
  */
 bool easy_flipper_set_submenu(
-    Submenu **submenu,
+    Submenu** submenu,
     int32_t view_id,
-    char *title,
-    uint32_t(previous_callback)(void *),
-    ViewDispatcher **view_dispatcher)
-{
-    if (!submenu)
-    {
+    char* title,
+    uint32_t(previous_callback)(void*),
+    ViewDispatcher** view_dispatcher) {
+    if(!submenu) {
         FURI_LOG_E(EASY_TAG, "Invalid arguments provided to set_submenu");
         return false;
     }
     *submenu = submenu_alloc();
-    if (!*submenu)
-    {
+    if(!*submenu) {
         FURI_LOG_E(EASY_TAG, "Failed to allocate Submenu");
         return false;
     }
-    if (title)
-    {
+    if(title) {
         submenu_set_header(*submenu, title);
     }
-    if (previous_callback)
-    {
+    if(previous_callback) {
         view_set_previous_callback(submenu_get_view(*submenu), previous_callback);
     }
     view_dispatcher_add_view(*view_dispatcher, view_id, submenu_get_view(*submenu));
@@ -189,24 +167,20 @@ bool easy_flipper_set_submenu(
  * @return true if successful, false otherwise
  */
 bool easy_flipper_set_menu(
-    Menu **menu,
+    Menu** menu,
     int32_t view_id,
-    uint32_t(previous_callback)(void *),
-    ViewDispatcher **view_dispatcher)
-{
-    if (!menu)
-    {
+    uint32_t(previous_callback)(void*),
+    ViewDispatcher** view_dispatcher) {
+    if(!menu) {
         FURI_LOG_E(EASY_TAG, "Invalid arguments provided to set_menu");
         return false;
     }
     *menu = menu_alloc();
-    if (!*menu)
-    {
+    if(!*menu) {
         FURI_LOG_E(EASY_TAG, "Failed to allocate Menu");
         return false;
     }
-    if (previous_callback)
-    {
+    if(previous_callback) {
         view_set_previous_callback(menu_get_view(*menu), previous_callback);
     }
     view_dispatcher_add_view(*view_dispatcher, view_id, menu_get_view(*menu));
@@ -223,29 +197,24 @@ bool easy_flipper_set_menu(
  * @return true if successful, false otherwise
  */
 bool easy_flipper_set_widget(
-    Widget **widget,
+    Widget** widget,
     int32_t view_id,
-    char *text,
-    uint32_t(previous_callback)(void *),
-    ViewDispatcher **view_dispatcher)
-{
-    if (!widget)
-    {
+    char* text,
+    uint32_t(previous_callback)(void*),
+    ViewDispatcher** view_dispatcher) {
+    if(!widget) {
         FURI_LOG_E(EASY_TAG, "Invalid arguments provided to set_widget");
         return false;
     }
     *widget = widget_alloc();
-    if (!*widget)
-    {
+    if(!*widget) {
         FURI_LOG_E(EASY_TAG, "Failed to allocate Widget");
         return false;
     }
-    if (text)
-    {
+    if(text) {
         widget_add_text_scroll_element(*widget, 0, 0, 128, 64, text);
     }
-    if (previous_callback)
-    {
+    if(previous_callback) {
         view_set_previous_callback(widget_get_view(*widget), previous_callback);
     }
     view_dispatcher_add_view(*view_dispatcher, view_id, widget_get_view(*widget));
@@ -264,33 +233,30 @@ bool easy_flipper_set_widget(
  * @return true if successful, false otherwise
  */
 bool easy_flipper_set_variable_item_list(
-    VariableItemList **variable_item_list,
+    VariableItemList** variable_item_list,
     int32_t view_id,
-    void (*enter_callback)(void *, uint32_t),
-    uint32_t(previous_callback)(void *),
-    ViewDispatcher **view_dispatcher,
-    void *context)
-{
-    if (!variable_item_list)
-    {
+    void (*enter_callback)(void*, uint32_t),
+    uint32_t(previous_callback)(void*),
+    ViewDispatcher** view_dispatcher,
+    void* context) {
+    if(!variable_item_list) {
         FURI_LOG_E(EASY_TAG, "Invalid arguments provided to set_variable_item_list");
         return false;
     }
     *variable_item_list = variable_item_list_alloc();
-    if (!*variable_item_list)
-    {
+    if(!*variable_item_list) {
         FURI_LOG_E(EASY_TAG, "Failed to allocate VariableItemList");
         return false;
     }
-    if (enter_callback)
-    {
+    if(enter_callback) {
         variable_item_list_set_enter_callback(*variable_item_list, enter_callback, context);
     }
-    if (previous_callback)
-    {
-        view_set_previous_callback(variable_item_list_get_view(*variable_item_list), previous_callback);
+    if(previous_callback) {
+        view_set_previous_callback(
+            variable_item_list_get_view(*variable_item_list), previous_callback);
     }
-    view_dispatcher_add_view(*view_dispatcher, view_id, variable_item_list_get_view(*variable_item_list));
+    view_dispatcher_add_view(
+        *view_dispatcher, view_id, variable_item_list_get_view(*variable_item_list));
     return true;
 }
 
@@ -303,86 +269,87 @@ bool easy_flipper_set_variable_item_list(
  * @return true if successful, false otherwise
  */
 bool easy_flipper_set_text_input(
-    TextInput **text_input,
+    TextInput** text_input,
     int32_t view_id,
-    char *header_text,
-    char *text_input_temp_buffer,
+    char* header_text,
+    char* text_input_temp_buffer,
     uint32_t text_input_buffer_size,
-    void (*result_callback)(void *),
-    uint32_t(previous_callback)(void *),
-    ViewDispatcher **view_dispatcher,
-    void *context)
-{
-    if (!text_input)
-    {
+    void (*result_callback)(void*),
+    uint32_t(previous_callback)(void*),
+    ViewDispatcher** view_dispatcher,
+    void* context) {
+    if(!text_input) {
         FURI_LOG_E(EASY_TAG, "Invalid arguments provided to set_text_input");
         return false;
     }
     *text_input = text_input_alloc();
-    if (!*text_input)
-    {
+    if(!*text_input) {
         FURI_LOG_E(EASY_TAG, "Failed to allocate TextInput");
         return false;
     }
-    if (previous_callback)
-    {
+    if(previous_callback) {
         view_set_previous_callback(text_input_get_view(*text_input), previous_callback);
     }
-    if (header_text)
-    {
+    if(header_text) {
         text_input_set_header_text(*text_input, header_text);
     }
-    if (text_input_temp_buffer && text_input_buffer_size && result_callback)
-    {
-        text_input_set_result_callback(*text_input, result_callback, context, text_input_temp_buffer, text_input_buffer_size, false);
+    if(text_input_temp_buffer && text_input_buffer_size && result_callback) {
+        text_input_set_result_callback(
+            *text_input,
+            result_callback,
+            context,
+            text_input_temp_buffer,
+            text_input_buffer_size,
+            false);
     }
     view_dispatcher_add_view(*view_dispatcher, view_id, text_input_get_view(*text_input));
     return true;
 }
 
 /**
- * @brief Initialize a UART_TextInput object
- * @param uart_text_input The UART_TextInput object to initialize
+ * @brief Initialize a TextInput object with extra symbols
+ * @param uart_text_input The TextInput object to initialize
  * @param view_id The ID/Index of the view
  * @param previous_callback The previous callback function (can be set to NULL)
  * @param view_dispatcher The ViewDispatcher object
  * @return true if successful, false otherwise
  */
 bool easy_flipper_set_uart_text_input(
-    UART_TextInput **uart_text_input,
+    TextInput** uart_text_input,
     int32_t view_id,
-    char *header_text,
-    char *uart_text_input_temp_buffer,
+    char* header_text,
+    char* uart_text_input_temp_buffer,
     uint32_t uart_text_input_buffer_size,
-    void (*result_callback)(void *),
-    uint32_t(previous_callback)(void *),
-    ViewDispatcher **view_dispatcher,
-    void *context)
-{
-    if (!uart_text_input)
-    {
+    void (*result_callback)(void*),
+    uint32_t(previous_callback)(void*),
+    ViewDispatcher** view_dispatcher,
+    void* context) {
+    if(!uart_text_input) {
         FURI_LOG_E(EASY_TAG, "Invalid arguments provided to set_uart_text_input");
         return false;
     }
-    *uart_text_input = uart_text_input_alloc();
-    if (!*uart_text_input)
-    {
+    *uart_text_input = text_input_alloc();
+    if(!*uart_text_input) {
         FURI_LOG_E(EASY_TAG, "Failed to allocate UART_TextInput");
         return false;
     }
-    if (previous_callback)
-    {
-        view_set_previous_callback(uart_text_input_get_view(*uart_text_input), previous_callback);
+    if(previous_callback) {
+        view_set_previous_callback(text_input_get_view(*uart_text_input), previous_callback);
     }
-    if (header_text)
-    {
-        uart_text_input_set_header_text(*uart_text_input, header_text);
+    if(header_text) {
+        text_input_set_header_text(*uart_text_input, header_text);
     }
-    if (uart_text_input_temp_buffer && uart_text_input_buffer_size && result_callback)
-    {
-        uart_text_input_set_result_callback(*uart_text_input, result_callback, context, uart_text_input_temp_buffer, uart_text_input_buffer_size, false);
+    if(uart_text_input_temp_buffer && uart_text_input_buffer_size && result_callback) {
+        text_input_set_result_callback(
+            *uart_text_input,
+            result_callback,
+            context,
+            uart_text_input_temp_buffer,
+            uart_text_input_buffer_size,
+            false);
     }
-    view_dispatcher_add_view(*view_dispatcher, view_id, uart_text_input_get_view(*uart_text_input));
+    text_input_show_illegal_symbols(*uart_text_input, true);
+    view_dispatcher_add_view(*view_dispatcher, view_id, text_input_get_view(*uart_text_input));
     return true;
 }
 
@@ -406,63 +373,52 @@ bool easy_flipper_set_uart_text_input(
  * @return true if successful, false otherwise
  */
 bool easy_flipper_set_dialog_ex(
-    DialogEx **dialog_ex,
+    DialogEx** dialog_ex,
     int32_t view_id,
-    char *header,
+    char* header,
     uint16_t header_x,
     uint16_t header_y,
-    char *text,
+    char* text,
     uint16_t text_x,
     uint16_t text_y,
-    char *left_button_text,
-    char *right_button_text,
-    char *center_button_text,
-    void (*result_callback)(DialogExResult, void *),
-    uint32_t(previous_callback)(void *),
-    ViewDispatcher **view_dispatcher,
-    void *context)
-{
-    if (!dialog_ex)
-    {
+    char* left_button_text,
+    char* right_button_text,
+    char* center_button_text,
+    void (*result_callback)(DialogExResult, void*),
+    uint32_t(previous_callback)(void*),
+    ViewDispatcher** view_dispatcher,
+    void* context) {
+    if(!dialog_ex) {
         FURI_LOG_E(EASY_TAG, "Invalid arguments provided to set_dialog_ex");
         return false;
     }
     *dialog_ex = dialog_ex_alloc();
-    if (!*dialog_ex)
-    {
+    if(!*dialog_ex) {
         FURI_LOG_E(EASY_TAG, "Failed to allocate DialogEx");
         return false;
     }
-    if (header)
-    {
+    if(header) {
         dialog_ex_set_header(*dialog_ex, header, header_x, header_y, AlignLeft, AlignTop);
     }
-    if (text)
-    {
+    if(text) {
         dialog_ex_set_text(*dialog_ex, text, text_x, text_y, AlignLeft, AlignTop);
     }
-    if (left_button_text)
-    {
+    if(left_button_text) {
         dialog_ex_set_left_button_text(*dialog_ex, left_button_text);
     }
-    if (right_button_text)
-    {
+    if(right_button_text) {
         dialog_ex_set_right_button_text(*dialog_ex, right_button_text);
     }
-    if (center_button_text)
-    {
+    if(center_button_text) {
         dialog_ex_set_center_button_text(*dialog_ex, center_button_text);
     }
-    if (result_callback)
-    {
+    if(result_callback) {
         dialog_ex_set_result_callback(*dialog_ex, result_callback);
     }
-    if (previous_callback)
-    {
+    if(previous_callback) {
         view_set_previous_callback(dialog_ex_get_view(*dialog_ex), previous_callback);
     }
-    if (context)
-    {
+    if(context) {
         dialog_ex_set_context(*dialog_ex, context);
     }
     view_dispatcher_add_view(*view_dispatcher, view_id, dialog_ex_get_view(*dialog_ex));
@@ -486,48 +442,40 @@ bool easy_flipper_set_dialog_ex(
  * @return true if successful, false otherwise
  */
 bool easy_flipper_set_popup(
-    Popup **popup,
+    Popup** popup,
     int32_t view_id,
-    char *header,
+    char* header,
     uint16_t header_x,
     uint16_t header_y,
-    char *text,
+    char* text,
     uint16_t text_x,
     uint16_t text_y,
-    void (*result_callback)(void *),
-    uint32_t(previous_callback)(void *),
-    ViewDispatcher **view_dispatcher,
-    void *context)
-{
-    if (!popup)
-    {
+    void (*result_callback)(void*),
+    uint32_t(previous_callback)(void*),
+    ViewDispatcher** view_dispatcher,
+    void* context) {
+    if(!popup) {
         FURI_LOG_E(EASY_TAG, "Invalid arguments provided to set_popup");
         return false;
     }
     *popup = popup_alloc();
-    if (!*popup)
-    {
+    if(!*popup) {
         FURI_LOG_E(EASY_TAG, "Failed to allocate Popup");
         return false;
     }
-    if (header)
-    {
+    if(header) {
         popup_set_header(*popup, header, header_x, header_y, AlignLeft, AlignTop);
     }
-    if (text)
-    {
+    if(text) {
         popup_set_text(*popup, text, text_x, text_y, AlignLeft, AlignTop);
     }
-    if (result_callback)
-    {
+    if(result_callback) {
         popup_set_callback(*popup, result_callback);
     }
-    if (previous_callback)
-    {
+    if(previous_callback) {
         view_set_previous_callback(popup_get_view(*popup), previous_callback);
     }
-    if (context)
-    {
+    if(context) {
         popup_set_context(*popup, context);
     }
     view_dispatcher_add_view(*view_dispatcher, view_id, popup_get_view(*popup));
@@ -543,24 +491,20 @@ bool easy_flipper_set_popup(
  * @return true if successful, false otherwise
  */
 bool easy_flipper_set_loading(
-    Loading **loading,
+    Loading** loading,
     int32_t view_id,
-    uint32_t(previous_callback)(void *),
-    ViewDispatcher **view_dispatcher)
-{
-    if (!loading)
-    {
+    uint32_t(previous_callback)(void*),
+    ViewDispatcher** view_dispatcher) {
+    if(!loading) {
         FURI_LOG_E(EASY_TAG, "Invalid arguments provided to set_loading");
         return false;
     }
     *loading = loading_alloc();
-    if (!*loading)
-    {
+    if(!*loading) {
         FURI_LOG_E(EASY_TAG, "Failed to allocate Loading");
         return false;
     }
-    if (previous_callback)
-    {
+    if(previous_callback) {
         view_set_previous_callback(loading_get_view(*loading), previous_callback);
     }
     view_dispatcher_add_view(*view_dispatcher, view_id, loading_get_view(*loading));
@@ -573,16 +517,13 @@ bool easy_flipper_set_loading(
  * @param buffer The buffer to copy the string to
  * @return true if successful, false otherwise
  */
-bool easy_flipper_set_char_to_furi_string(FuriString **furi_string, char *buffer)
-{
-    if (!furi_string)
-    {
+bool easy_flipper_set_char_to_furi_string(FuriString** furi_string, char* buffer) {
+    if(!furi_string) {
         FURI_LOG_E(EASY_TAG, "Invalid arguments provided to set_buffer_to_furi_string");
         return false;
     }
     *furi_string = furi_string_alloc();
-    if (!furi_string)
-    {
+    if(!furi_string) {
         FURI_LOG_E(EASY_TAG, "Failed to allocate FuriString");
         return false;
     }
@@ -590,4 +531,4 @@ bool easy_flipper_set_char_to_furi_string(FuriString **furi_string, char *buffer
     return true;
 }
 
-#endif // EASY_FLIPPER_H
+#endif // EASY_FLIPPER_H

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 190 - 302
web_crawler/flipper_http.h


+ 0 - 803
web_crawler/uart_text_input.h

@@ -1,803 +0,0 @@
-// from https://github.com/xMasterX/all-the-plugins/blob/dev/base_pack/uart_terminal/uart_text_input.c
-// all credits to xMasterX for the code
-#ifndef UART_TEXT_INPUT_H
-#define UART_TEXT_INPUT_H
-
-#include <gui/elements.h>
-#include "web_crawler_icons.h"
-#include <furi.h>
-#include <furi.h>
-#include <furi_hal.h>
-#include <gui/gui.h>
-#include <gui/view.h>
-#include <core/common_defines.h>
-
-/** Text input anonymous structure */
-typedef struct UART_TextInput UART_TextInput;
-typedef void (*UART_TextInputCallback)(void *context);
-typedef bool (*UART_TextInputValidatorCallback)(const char *text, FuriString *error, void *context);
-
-UART_TextInputValidatorCallback
-uart_text_input_get_validator_callback(UART_TextInput *uart_text_input);
-
-void uart_text_input_reset(UART_TextInput *uart_text_input);
-
-struct UART_TextInput
-{
-    View *view;
-    FuriTimer *timer;
-};
-
-typedef struct
-{
-    const char text;
-    const uint8_t x;
-    const uint8_t y;
-} UART_TextInputKey;
-
-typedef struct
-{
-    const char *header;
-    char *text_buffer;
-    size_t text_buffer_size;
-    bool clear_default_text;
-
-    UART_TextInputCallback callback;
-    void *callback_context;
-
-    uint8_t selected_row;
-    uint8_t selected_column;
-
-    UART_TextInputValidatorCallback validator_callback;
-    void *validator_callback_context;
-    FuriString *validator_text;
-    bool valadator_message_visible;
-} UART_TextInputModel;
-
-static const uint8_t keyboard_origin_x = 1;
-static const uint8_t keyboard_origin_y = 29;
-static const uint8_t keyboard_row_count = 4;
-
-#define mode_AT "Send AT command to UART"
-
-#define ENTER_KEY '\r'
-#define BACKSPACE_KEY '\b'
-
-static const UART_TextInputKey keyboard_keys_row_1[] = {
-    {'{', 1, 0},
-    {'(', 9, 0},
-    {'[', 17, 0},
-    {'|', 25, 0},
-    {'@', 33, 0},
-    {'&', 41, 0},
-    {'#', 49, 0},
-    {';', 57, 0},
-    {'^', 65, 0},
-    {'*', 73, 0},
-    {'`', 81, 0},
-    {'"', 89, 0},
-    {'~', 97, 0},
-    {'\'', 105, 0},
-    {'.', 113, 0},
-    {'/', 120, 0},
-};
-
-static const UART_TextInputKey keyboard_keys_row_2[] = {
-    {'q', 1, 10},
-    {'w', 9, 10},
-    {'e', 17, 10},
-    {'r', 25, 10},
-    {'t', 33, 10},
-    {'y', 41, 10},
-    {'u', 49, 10},
-    {'i', 57, 10},
-    {'o', 65, 10},
-    {'p', 73, 10},
-    {'0', 81, 10},
-    {'1', 89, 10},
-    {'2', 97, 10},
-    {'3', 105, 10},
-    {'=', 113, 10},
-    {'-', 120, 10},
-};
-
-static const UART_TextInputKey keyboard_keys_row_3[] = {
-    {'a', 1, 21},
-    {'s', 9, 21},
-    {'d', 18, 21},
-    {'f', 25, 21},
-    {'g', 33, 21},
-    {'h', 41, 21},
-    {'j', 49, 21},
-    {'k', 57, 21},
-    {'l', 65, 21},
-    {BACKSPACE_KEY, 72, 13},
-    {'4', 89, 21},
-    {'5', 97, 21},
-    {'6', 105, 21},
-    {'$', 113, 21},
-    {'%', 120, 21},
-
-};
-
-static const UART_TextInputKey keyboard_keys_row_4[] = {
-    {'z', 1, 33},
-    {'x', 9, 33},
-    {'c', 18, 33},
-    {'v', 25, 33},
-    {'b', 33, 33},
-    {'n', 41, 33},
-    {'m', 49, 33},
-    {'_', 57, 33},
-    {ENTER_KEY, 64, 24},
-    {'7', 89, 33},
-    {'8', 97, 33},
-    {'9', 105, 33},
-    {'!', 113, 33},
-    {'+', 120, 33},
-};
-
-static uint8_t get_row_size(uint8_t row_index)
-{
-    uint8_t row_size = 0;
-
-    switch (row_index + 1)
-    {
-    case 1:
-        row_size = sizeof(keyboard_keys_row_1) / sizeof(UART_TextInputKey);
-        break;
-    case 2:
-        row_size = sizeof(keyboard_keys_row_2) / sizeof(UART_TextInputKey);
-        break;
-    case 3:
-        row_size = sizeof(keyboard_keys_row_3) / sizeof(UART_TextInputKey);
-        break;
-    case 4:
-        row_size = sizeof(keyboard_keys_row_4) / sizeof(UART_TextInputKey);
-        break;
-    }
-
-    return row_size;
-}
-
-static const UART_TextInputKey *get_row(uint8_t row_index)
-{
-    const UART_TextInputKey *row = NULL;
-
-    switch (row_index + 1)
-    {
-    case 1:
-        row = keyboard_keys_row_1;
-        break;
-    case 2:
-        row = keyboard_keys_row_2;
-        break;
-    case 3:
-        row = keyboard_keys_row_3;
-        break;
-    case 4:
-        row = keyboard_keys_row_4;
-        break;
-    }
-
-    return row;
-}
-
-static char get_selected_char(UART_TextInputModel *model)
-{
-    return get_row(model->selected_row)[model->selected_column].text;
-}
-
-static bool char_is_lowercase(char letter)
-{
-    return (letter >= 0x61 && letter <= 0x7A);
-}
-
-static bool char_is_uppercase(char letter)
-{
-    return (letter >= 0x41 && letter <= 0x5A);
-}
-
-static char char_to_lowercase(const char letter)
-{
-    switch (letter)
-    {
-    case ' ':
-        return 0x5f;
-        break;
-    case ')':
-        return 0x28;
-        break;
-    case '}':
-        return 0x7b;
-        break;
-    case ']':
-        return 0x5b;
-        break;
-    case '\\':
-        return 0x2f;
-        break;
-    case ':':
-        return 0x3b;
-        break;
-    case ',':
-        return 0x2e;
-        break;
-    case '?':
-        return 0x21;
-        break;
-    case '>':
-        return 0x3c;
-        break;
-    }
-    if (char_is_uppercase(letter))
-    {
-        return (letter + 0x20);
-    }
-    else
-    {
-        return letter;
-    }
-}
-
-static char char_to_uppercase(const char letter)
-{
-    switch (letter)
-    {
-    case '_':
-        return 0x20;
-        break;
-    case '(':
-        return 0x29;
-        break;
-    case '{':
-        return 0x7d;
-        break;
-    case '[':
-        return 0x5d;
-        break;
-    case '/':
-        return 0x5c;
-        break;
-    case ';':
-        return 0x3a;
-        break;
-    case '.':
-        return 0x2c;
-        break;
-    case '!':
-        return 0x3f;
-        break;
-    case '<':
-        return 0x3e;
-        break;
-    }
-    if (char_is_lowercase(letter))
-    {
-        return (letter - 0x20);
-    }
-    else
-    {
-        return letter;
-    }
-}
-
-static void uart_text_input_backspace_cb(UART_TextInputModel *model)
-{
-    uint8_t text_length = model->clear_default_text ? 1 : strlen(model->text_buffer);
-    if (text_length > 0)
-    {
-        model->text_buffer[text_length - 1] = 0;
-    }
-}
-
-static void uart_text_input_view_draw_callback(Canvas *canvas, void *_model)
-{
-    UART_TextInputModel *model = _model;
-    // uint8_t text_length = model->text_buffer ? strlen(model->text_buffer) : 0;
-    uint8_t needed_string_width = canvas_width(canvas) - 8;
-    uint8_t start_pos = 4;
-
-    const char *text = model->text_buffer;
-
-    canvas_clear(canvas);
-    canvas_set_color(canvas, ColorBlack);
-
-    canvas_draw_str(canvas, 2, 7, model->header);
-    elements_slightly_rounded_frame(canvas, 1, 8, 126, 12);
-
-    if (canvas_string_width(canvas, text) > needed_string_width)
-    {
-        canvas_draw_str(canvas, start_pos, 17, "...");
-        start_pos += 6;
-        needed_string_width -= 8;
-    }
-
-    while (text != 0 && canvas_string_width(canvas, text) > needed_string_width)
-    {
-        text++;
-    }
-
-    if (model->clear_default_text)
-    {
-        elements_slightly_rounded_box(
-            canvas, start_pos - 1, 14, canvas_string_width(canvas, text) + 2, 10);
-        canvas_set_color(canvas, ColorWhite);
-    }
-    else
-    {
-        canvas_draw_str(canvas, start_pos + canvas_string_width(canvas, text) + 1, 18, "|");
-        canvas_draw_str(canvas, start_pos + canvas_string_width(canvas, text) + 2, 18, "|");
-    }
-    canvas_draw_str(canvas, start_pos, 17, text);
-
-    canvas_set_font(canvas, FontKeyboard);
-
-    for (uint8_t row = 0; row <= keyboard_row_count; row++)
-    {
-        const uint8_t column_count = get_row_size(row);
-        const UART_TextInputKey *keys = get_row(row);
-
-        for (size_t column = 0; column < column_count; column++)
-        {
-            if (keys[column].text == ENTER_KEY)
-            {
-                canvas_set_color(canvas, ColorBlack);
-                if (model->selected_row == row && model->selected_column == column)
-                {
-                    canvas_draw_icon(
-                        canvas,
-                        keyboard_origin_x + keys[column].x,
-                        keyboard_origin_y + keys[column].y,
-                        &I_KeySaveSelected_24x11);
-                }
-                else
-                {
-                    canvas_draw_icon(
-                        canvas,
-                        keyboard_origin_x + keys[column].x,
-                        keyboard_origin_y + keys[column].y,
-                        &I_KeySave_24x11);
-                }
-            }
-            else if (keys[column].text == BACKSPACE_KEY)
-            {
-                canvas_set_color(canvas, ColorBlack);
-                if (model->selected_row == row && model->selected_column == column)
-                {
-                    canvas_draw_icon(
-                        canvas,
-                        keyboard_origin_x + keys[column].x,
-                        keyboard_origin_y + keys[column].y,
-                        &I_KeyBackspaceSelected_16x9);
-                }
-                else
-                {
-                    canvas_draw_icon(
-                        canvas,
-                        keyboard_origin_x + keys[column].x,
-                        keyboard_origin_y + keys[column].y,
-                        &I_KeyBackspace_16x9);
-                }
-            }
-            else
-            {
-                if (model->selected_row == row && model->selected_column == column)
-                {
-                    canvas_set_color(canvas, ColorBlack);
-                    canvas_draw_box(
-                        canvas,
-                        keyboard_origin_x + keys[column].x - 1,
-                        keyboard_origin_y + keys[column].y - 8,
-                        7,
-                        10);
-                    canvas_set_color(canvas, ColorWhite);
-                }
-                else
-                {
-                    canvas_set_color(canvas, ColorBlack);
-                }
-                if (0 == strcmp(model->header, mode_AT))
-                {
-                    canvas_draw_glyph(
-                        canvas,
-                        keyboard_origin_x + keys[column].x,
-                        keyboard_origin_y + keys[column].y,
-                        char_to_uppercase(keys[column].text));
-                }
-                else
-                {
-                    canvas_draw_glyph(
-                        canvas,
-                        keyboard_origin_x + keys[column].x,
-                        keyboard_origin_y + keys[column].y,
-                        keys[column].text);
-                }
-            }
-        }
-    }
-    if (model->valadator_message_visible)
-    {
-        canvas_set_font(canvas, FontSecondary);
-        canvas_set_color(canvas, ColorWhite);
-        canvas_draw_box(canvas, 8, 10, 110, 48);
-        canvas_set_color(canvas, ColorBlack);
-        canvas_draw_icon(canvas, 10, 14, &I_WarningDolphin_45x42);
-        canvas_draw_rframe(canvas, 8, 8, 112, 50, 3);
-        canvas_draw_rframe(canvas, 9, 9, 110, 48, 2);
-        elements_multiline_text(canvas, 62, 20, furi_string_get_cstr(model->validator_text));
-        canvas_set_font(canvas, FontKeyboard);
-    }
-}
-
-static void
-uart_text_input_handle_up(UART_TextInput *uart_text_input, UART_TextInputModel *model)
-{
-    UNUSED(uart_text_input);
-    if (model->selected_row > 0)
-    {
-        model->selected_row--;
-        if (model->selected_column > get_row_size(model->selected_row) - 6)
-        {
-            model->selected_column = model->selected_column + 1;
-        }
-    }
-}
-
-static void
-uart_text_input_handle_down(UART_TextInput *uart_text_input, UART_TextInputModel *model)
-{
-    UNUSED(uart_text_input);
-    if (model->selected_row < keyboard_row_count - 1)
-    {
-        model->selected_row++;
-        if (model->selected_column > get_row_size(model->selected_row) - 4)
-        {
-            model->selected_column = model->selected_column - 1;
-        }
-    }
-}
-
-static void
-uart_text_input_handle_left(UART_TextInput *uart_text_input, UART_TextInputModel *model)
-{
-    UNUSED(uart_text_input);
-    if (model->selected_column > 0)
-    {
-        model->selected_column--;
-    }
-    else
-    {
-        model->selected_column = get_row_size(model->selected_row) - 1;
-    }
-}
-
-static void
-uart_text_input_handle_right(UART_TextInput *uart_text_input, UART_TextInputModel *model)
-{
-    UNUSED(uart_text_input);
-    if (model->selected_column < get_row_size(model->selected_row) - 1)
-    {
-        model->selected_column++;
-    }
-    else
-    {
-        model->selected_column = 0;
-    }
-}
-
-static void uart_text_input_handle_ok(
-    UART_TextInput *uart_text_input,
-    UART_TextInputModel *model,
-    bool shift)
-{
-    char selected = get_selected_char(model);
-    uint8_t text_length = strlen(model->text_buffer);
-
-    if (0 == strcmp(model->header, mode_AT))
-    {
-        selected = char_to_uppercase(selected);
-    }
-
-    if (shift)
-    {
-        if (0 == strcmp(model->header, mode_AT))
-        {
-            selected = char_to_lowercase(selected);
-        }
-        else
-        {
-            selected = char_to_uppercase(selected);
-        }
-    }
-
-    if (selected == ENTER_KEY)
-    {
-        if (model->validator_callback &&
-            (!model->validator_callback(
-                model->text_buffer, model->validator_text, model->validator_callback_context)))
-        {
-            model->valadator_message_visible = true;
-            furi_timer_start(uart_text_input->timer, furi_kernel_get_tick_frequency() * 4);
-        }
-        else if (model->callback != 0 && text_length > 0)
-        {
-            model->callback(model->callback_context);
-        }
-    }
-    else if (selected == BACKSPACE_KEY)
-    {
-        uart_text_input_backspace_cb(model);
-    }
-    else
-    {
-        if (model->clear_default_text)
-        {
-            text_length = 0;
-        }
-        if (text_length < (model->text_buffer_size - 1))
-        {
-            model->text_buffer[text_length] = selected;
-            model->text_buffer[text_length + 1] = 0;
-        }
-    }
-    model->clear_default_text = false;
-}
-
-static bool uart_text_input_view_input_callback(InputEvent *event, void *context)
-{
-    UART_TextInput *uart_text_input = context;
-    furi_assert(uart_text_input);
-
-    bool consumed = false;
-
-    // Acquire model
-    UART_TextInputModel *model = view_get_model(uart_text_input->view);
-
-    if ((!(event->type == InputTypePress) && !(event->type == InputTypeRelease)) &&
-        model->valadator_message_visible)
-    {
-        model->valadator_message_visible = false;
-        consumed = true;
-    }
-    else if (event->type == InputTypeShort)
-    {
-        consumed = true;
-        switch (event->key)
-        {
-        case InputKeyUp:
-            uart_text_input_handle_up(uart_text_input, model);
-            break;
-        case InputKeyDown:
-            uart_text_input_handle_down(uart_text_input, model);
-            break;
-        case InputKeyLeft:
-            uart_text_input_handle_left(uart_text_input, model);
-            break;
-        case InputKeyRight:
-            uart_text_input_handle_right(uart_text_input, model);
-            break;
-        case InputKeyOk:
-            uart_text_input_handle_ok(uart_text_input, model, false);
-            break;
-        default:
-            consumed = false;
-            break;
-        }
-    }
-    else if (event->type == InputTypeLong)
-    {
-        consumed = true;
-        switch (event->key)
-        {
-        case InputKeyUp:
-            uart_text_input_handle_up(uart_text_input, model);
-            break;
-        case InputKeyDown:
-            uart_text_input_handle_down(uart_text_input, model);
-            break;
-        case InputKeyLeft:
-            uart_text_input_handle_left(uart_text_input, model);
-            break;
-        case InputKeyRight:
-            uart_text_input_handle_right(uart_text_input, model);
-            break;
-        case InputKeyOk:
-            uart_text_input_handle_ok(uart_text_input, model, true);
-            break;
-        case InputKeyBack:
-            uart_text_input_backspace_cb(model);
-            break;
-        default:
-            consumed = false;
-            break;
-        }
-    }
-    else if (event->type == InputTypeRepeat)
-    {
-        consumed = true;
-        switch (event->key)
-        {
-        case InputKeyUp:
-            uart_text_input_handle_up(uart_text_input, model);
-            break;
-        case InputKeyDown:
-            uart_text_input_handle_down(uart_text_input, model);
-            break;
-        case InputKeyLeft:
-            uart_text_input_handle_left(uart_text_input, model);
-            break;
-        case InputKeyRight:
-            uart_text_input_handle_right(uart_text_input, model);
-            break;
-        case InputKeyBack:
-            uart_text_input_backspace_cb(model);
-            break;
-        default:
-            consumed = false;
-            break;
-        }
-    }
-
-    // Commit model
-    view_commit_model(uart_text_input->view, consumed);
-
-    return consumed;
-}
-
-void uart_text_input_timer_callback(void *context)
-{
-    furi_assert(context);
-    UART_TextInput *uart_text_input = context;
-
-    with_view_model(
-        uart_text_input->view,
-        UART_TextInputModel * model,
-        { model->valadator_message_visible = false; },
-        true);
-}
-
-UART_TextInput *uart_text_input_alloc()
-{
-    UART_TextInput *uart_text_input = malloc(sizeof(UART_TextInput));
-    uart_text_input->view = view_alloc();
-    view_set_context(uart_text_input->view, uart_text_input);
-    view_allocate_model(uart_text_input->view, ViewModelTypeLocking, sizeof(UART_TextInputModel));
-    view_set_draw_callback(uart_text_input->view, uart_text_input_view_draw_callback);
-    view_set_input_callback(uart_text_input->view, uart_text_input_view_input_callback);
-
-    uart_text_input->timer =
-        furi_timer_alloc(uart_text_input_timer_callback, FuriTimerTypeOnce, uart_text_input);
-
-    with_view_model(
-        uart_text_input->view,
-        UART_TextInputModel * model,
-        { model->validator_text = furi_string_alloc(); },
-        false);
-
-    uart_text_input_reset(uart_text_input);
-
-    return uart_text_input;
-}
-
-void uart_text_input_free(UART_TextInput *uart_text_input)
-{
-    furi_assert(uart_text_input);
-    with_view_model(
-        uart_text_input->view,
-        UART_TextInputModel * model,
-        { furi_string_free(model->validator_text); },
-        false);
-
-    // Send stop command
-    furi_timer_stop(uart_text_input->timer);
-    // Release allocated memory
-    furi_timer_free(uart_text_input->timer);
-
-    view_free(uart_text_input->view);
-
-    free(uart_text_input);
-}
-
-void uart_text_input_reset(UART_TextInput *uart_text_input)
-{
-    furi_assert(uart_text_input);
-    with_view_model(
-        uart_text_input->view,
-        UART_TextInputModel * model,
-        {
-            model->text_buffer_size = 0;
-            model->header = "";
-            model->selected_row = 0;
-            model->selected_column = 0;
-            model->clear_default_text = false;
-            model->text_buffer = NULL;
-            model->text_buffer_size = 0;
-            model->callback = NULL;
-            model->callback_context = NULL;
-            model->validator_callback = NULL;
-            model->validator_callback_context = NULL;
-            furi_string_reset(model->validator_text);
-            model->valadator_message_visible = false;
-        },
-        true);
-}
-
-View *uart_text_input_get_view(UART_TextInput *uart_text_input)
-{
-    furi_assert(uart_text_input);
-    return uart_text_input->view;
-}
-
-void uart_text_input_set_result_callback(
-    UART_TextInput *uart_text_input,
-    UART_TextInputCallback callback,
-    void *callback_context,
-    char *text_buffer,
-    size_t text_buffer_size,
-    bool clear_default_text)
-{
-    with_view_model(
-        uart_text_input->view,
-        UART_TextInputModel * model,
-        {
-            model->callback = callback;
-            model->callback_context = callback_context;
-            model->text_buffer = text_buffer;
-            model->text_buffer_size = text_buffer_size;
-            model->clear_default_text = clear_default_text;
-            if (text_buffer && text_buffer[0] != '\0')
-            {
-                // Set focus on Save
-                model->selected_row = 2;
-                model->selected_column = 8;
-            }
-        },
-        true);
-}
-
-void uart_text_input_set_validator(
-    UART_TextInput *uart_text_input,
-    UART_TextInputValidatorCallback callback,
-    void *callback_context)
-{
-    with_view_model(
-        uart_text_input->view,
-        UART_TextInputModel * model,
-        {
-            model->validator_callback = callback;
-            model->validator_callback_context = callback_context;
-        },
-        true);
-}
-
-UART_TextInputValidatorCallback
-uart_text_input_get_validator_callback(UART_TextInput *uart_text_input)
-{
-    UART_TextInputValidatorCallback validator_callback = NULL;
-    with_view_model(
-        uart_text_input->view,
-        UART_TextInputModel * model,
-        { validator_callback = model->validator_callback; },
-        false);
-    return validator_callback;
-}
-
-void *uart_text_input_get_validator_callback_context(UART_TextInput *uart_text_input)
-{
-    void *validator_callback_context = NULL;
-    with_view_model(
-        uart_text_input->view,
-        UART_TextInputModel * model,
-        { validator_callback_context = model->validator_callback_context; },
-        false);
-    return validator_callback_context;
-}
-
-void uart_text_input_set_header_text(UART_TextInput *uart_text_input, const char *text)
-{
-    with_view_model(
-        uart_text_input->view, UART_TextInputModel * model, { model->header = text; }, true);
-}
-
-#endif // UART_TEXT_INPUT_H

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 249 - 279
web_crawler/web_crawler_callback.h


+ 76 - 79
web_crawler/web_crawler_e.h

@@ -6,109 +6,106 @@
 #include <storage/storage.h>
 
 #define TAG "WebCrawler"
-static char *http_method_names[] = {"GET", "POST", "PUT", "DELETE", "DOWNLOAD"};
+static char* http_method_names[] = {"GET", "POST", "PUT", "DELETE", "DOWNLOAD"};
 
 // Define the submenu items for our WebCrawler application
-typedef enum
-{
-    WebCrawlerSubmenuIndexRun,     // click to go to Run the GET request
-    WebCrawlerSubmenuIndexAbout,   // click to go to About screen
-    WebCrawlerSubmenuIndexConfig,  // click to go to Config submenu (Wifi, File)
+typedef enum {
+    WebCrawlerSubmenuIndexRun, // click to go to Run the GET request
+    WebCrawlerSubmenuIndexAbout, // click to go to About screen
+    WebCrawlerSubmenuIndexConfig, // click to go to Config submenu (Wifi, File)
     WebCrawlerSubmenuIndexRequest, // click to go to Request submenu (Set URL, HTTP Method, Headers)
-    WebCrawlerSubmenuIndexWifi,    // click to go to Wifi submenu (SSID, Password)
-    WebCrawlerSubmenuIndexFile,    // click to go to file submenu (Read, File Type, Rename, Delete)
+    WebCrawlerSubmenuIndexWifi, // click to go to Wifi submenu (SSID, Password)
+    WebCrawlerSubmenuIndexFile, // click to go to file submenu (Read, File Type, Rename, Delete)
 } WebCrawlerSubmenuIndex;
 
-typedef enum
-{
-    WebCrawlerViewRun,                     // Run the GET request
-    WebCrawlerViewAbout,                   // About screen
-    WebCrawlerViewSubmenuConfig,           // Submenu Config view for App (Wifi, File)
+typedef enum {
+    WebCrawlerViewRun, // Run the GET request
+    WebCrawlerViewAbout, // About screen
+    WebCrawlerViewSubmenuConfig, // Submenu Config view for App (Wifi, File)
     WebCrawlerViewVariableItemListRequest, // Submenu for URL (Set URL, HTTP Method, Headers)
-    WebCrawlerViewVariableItemListWifi,    // Wifi Configuration screen (Submenu for SSID, Password)
-    WebCrawlerViewVariableItemListFile,    // Submenu for File (Read, File Type, Rename, Delete)
-    WebCrawlerViewMain,                    // Main view for App
-    WebCrawlerViewSubmenuMain,             // Submenu Main view for App (Run, About, Config)
-    WebCrawlerViewTextInput,               // Text input for Path
-    WebCrawlerViewTextInputSSID,           // Text input for SSID
-    WebCrawlerViewTextInputPassword,       // Text input for Password
-    WebCrawlerViewFileRead,                // File Read
-    WebCrawlerViewTextInputFileType,       // Text input for File Type
-    WebCrawlerViewTextInputFileRename,     // Text input for File Rename
-    WebCrawlerViewTextInputHeaders,        // Text input for Headers
-    WebCrawlerViewTextInputPayload,        // Text input for Payload
-    WebCrawlerViewFileDelete,              // File Delete
+    WebCrawlerViewVariableItemListWifi, // Wifi Configuration screen (Submenu for SSID, Password)
+    WebCrawlerViewVariableItemListFile, // Submenu for File (Read, File Type, Rename, Delete)
+    WebCrawlerViewMain, // Main view for App
+    WebCrawlerViewSubmenuMain, // Submenu Main view for App (Run, About, Config)
+    WebCrawlerViewTextInput, // Text input for Path
+    WebCrawlerViewTextInputSSID, // Text input for SSID
+    WebCrawlerViewTextInputPassword, // Text input for Password
+    WebCrawlerViewFileRead, // File Read
+    WebCrawlerViewTextInputFileType, // Text input for File Type
+    WebCrawlerViewTextInputFileRename, // Text input for File Rename
+    WebCrawlerViewTextInputHeaders, // Text input for Headers
+    WebCrawlerViewTextInputPayload, // Text input for Payload
+    WebCrawlerViewFileDelete, // File Delete
 } WebCrawlerViewIndex;
 
 // Define the application structure
-typedef struct
-{
-    ViewDispatcher *view_dispatcher;
-    View *view_main;
-    View *view_run;
-    Submenu *submenu_main;
-    Submenu *submenu_config;
-    Widget *widget_about;
-
-    UART_TextInput *text_input_path;
-    UART_TextInput *text_input_ssid;
-    UART_TextInput *text_input_password;
-    UART_TextInput *text_input_file_type;
-    UART_TextInput *text_input_file_rename;
+typedef struct {
+    ViewDispatcher* view_dispatcher;
+    View* view_main;
+    View* view_run;
+    Submenu* submenu_main;
+    Submenu* submenu_config;
+    Widget* widget_about;
+
+    TextInput* text_input_path;
+    TextInput* text_input_ssid;
+    TextInput* text_input_password;
+    TextInput* text_input_file_type;
+    TextInput* text_input_file_rename;
     //
-    UART_TextInput *text_input_headers;
-    UART_TextInput *text_input_payload;
-
-    Widget *widget_file_read;
-    Widget *widget_file_delete;
-
-    VariableItemList *variable_item_list_wifi;
-    VariableItemList *variable_item_list_file;
-    VariableItemList *variable_item_list_request;
-
-    VariableItem *path_item;
-    VariableItem *ssid_item;
-    VariableItem *password_item;
-    VariableItem *file_type_item;
-    VariableItem *file_rename_item;
-    VariableItem *file_read_item;
-    VariableItem *file_delete_item;
+    TextInput* text_input_headers;
+    TextInput* text_input_payload;
+
+    Widget* widget_file_read;
+    Widget* widget_file_delete;
+
+    VariableItemList* variable_item_list_wifi;
+    VariableItemList* variable_item_list_file;
+    VariableItemList* variable_item_list_request;
+
+    VariableItem* path_item;
+    VariableItem* ssid_item;
+    VariableItem* password_item;
+    VariableItem* file_type_item;
+    VariableItem* file_rename_item;
+    VariableItem* file_read_item;
+    VariableItem* file_delete_item;
     //
-    VariableItem *http_method_item;
-    VariableItem *headers_item;
-    VariableItem *payload_item;
-
-    char *path;
-    char *ssid;
-    char *password;
-    char *file_type;
-    char *file_rename;
-    char *http_method;
-    char *headers;
-    char *payload;
-
-    char *temp_buffer_path;
+    VariableItem* http_method_item;
+    VariableItem* headers_item;
+    VariableItem* payload_item;
+
+    char* path;
+    char* ssid;
+    char* password;
+    char* file_type;
+    char* file_rename;
+    char* http_method;
+    char* headers;
+    char* payload;
+
+    char* temp_buffer_path;
     uint32_t temp_buffer_size_path;
 
-    char *temp_buffer_ssid;
+    char* temp_buffer_ssid;
     uint32_t temp_buffer_size_ssid;
 
-    char *temp_buffer_password;
+    char* temp_buffer_password;
     uint32_t temp_buffer_size_password;
 
-    char *temp_buffer_file_type;
+    char* temp_buffer_file_type;
     uint32_t temp_buffer_size_file_type;
 
-    char *temp_buffer_file_rename;
+    char* temp_buffer_file_rename;
     uint32_t temp_buffer_size_file_rename;
 
-    char *temp_buffer_http_method;
+    char* temp_buffer_http_method;
     uint32_t temp_buffer_size_http_method;
 
-    char *temp_buffer_headers;
+    char* temp_buffer_headers;
     uint32_t temp_buffer_size_headers;
 
-    char *temp_buffer_payload;
+    char* temp_buffer_payload;
     uint32_t temp_buffer_size_payload;
 } WebCrawlerApp;
-#endif // WEB_CRAWLER_E
+#endif // WEB_CRAWLER_E

+ 62 - 124
web_crawler/web_crawler_free.h

@@ -1,113 +1,93 @@
 // web_crawler_free.h
 
-static void free_buffers(WebCrawlerApp *app)
-{
-    if (!app)
-    {
+static void free_buffers(WebCrawlerApp* app) {
+    if(!app) {
         FURI_LOG_E(TAG, "Invalid app context");
         return;
     }
-    if (app->path)
-    {
+    if(app->path) {
         free(app->path);
         app->path = NULL;
     }
 
-    if (app->temp_buffer_path)
-    {
+    if(app->temp_buffer_path) {
         free(app->temp_buffer_path);
         app->temp_buffer_path = NULL;
     }
 
-    if (app->ssid)
-    {
+    if(app->ssid) {
         free(app->ssid);
         app->ssid = NULL;
     }
 
-    if (app->temp_buffer_ssid)
-    {
+    if(app->temp_buffer_ssid) {
         free(app->temp_buffer_ssid);
         app->temp_buffer_ssid = NULL;
     }
 
-    if (app->password)
-    {
+    if(app->password) {
         free(app->password);
         app->password = NULL;
     }
 
-    if (app->temp_buffer_password)
-    {
+    if(app->temp_buffer_password) {
         free(app->temp_buffer_password);
         app->temp_buffer_password = NULL;
     }
 
-    if (app->file_type)
-    {
+    if(app->file_type) {
         free(app->file_type);
         app->file_type = NULL;
     }
 
-    if (app->temp_buffer_file_type)
-    {
+    if(app->temp_buffer_file_type) {
         free(app->temp_buffer_file_type);
         app->temp_buffer_file_type = NULL;
     }
 
-    if (app->file_rename)
-    {
+    if(app->file_rename) {
         free(app->file_rename);
         app->file_rename = NULL;
     }
 
-    if (app->temp_buffer_file_rename)
-    {
+    if(app->temp_buffer_file_rename) {
         free(app->temp_buffer_file_rename);
         app->temp_buffer_file_rename = NULL;
     }
 
-    if (app->temp_buffer_http_method)
-    {
+    if(app->temp_buffer_http_method) {
         free(app->temp_buffer_http_method);
         app->temp_buffer_http_method = NULL;
     }
 
-    if (app->temp_buffer_headers)
-    {
+    if(app->temp_buffer_headers) {
         free(app->temp_buffer_headers);
         app->temp_buffer_headers = NULL;
     }
 
-    if (app->temp_buffer_payload)
-    {
+    if(app->temp_buffer_payload) {
         free(app->temp_buffer_payload);
         app->temp_buffer_payload = NULL;
     }
 
-    if (app->http_method)
-    {
+    if(app->http_method) {
         free(app->http_method);
         app->http_method = NULL;
     }
 
-    if (app->headers)
-    {
+    if(app->headers) {
         free(app->headers);
         app->headers = NULL;
     }
 
-    if (app->payload)
-    {
+    if(app->payload) {
         free(app->payload);
         app->payload = NULL;
     }
 }
 
-static void free_resources(WebCrawlerApp *app)
-{
-    if (!app)
-    {
+static void free_resources(WebCrawlerApp* app) {
+    if(!app) {
         FURI_LOG_E(TAG, "Invalid app context");
         return;
     }
@@ -115,52 +95,32 @@ static void free_resources(WebCrawlerApp *app)
     free_buffers(app);
 }
 
-static void free_all(WebCrawlerApp *app, char *reason)
-{
-    if (!app)
-    {
+static void free_all(WebCrawlerApp* app, char* reason) {
+    if(!app) {
         FURI_LOG_E(TAG, "Invalid app context");
         return;
     }
-    if (reason)
-    {
+    if(reason) {
         FURI_LOG_I(TAG, reason);
     }
 
-    if (app->view_main)
-        view_free(app->view_main);
-    if (app->submenu_main)
-        submenu_free(app->submenu_main);
-    if (app->submenu_config)
-        submenu_free(app->submenu_config);
-    if (app->variable_item_list_wifi)
-        variable_item_list_free(app->variable_item_list_wifi);
-    if (app->variable_item_list_file)
-        variable_item_list_free(app->variable_item_list_file);
-    if (app->variable_item_list_request)
-        variable_item_list_free(app->variable_item_list_request);
-    if (app->view_dispatcher)
-        view_dispatcher_free(app->view_dispatcher);
-    if (app->widget_about)
-        widget_free(app->widget_about);
-    if (app->widget_file_read)
-        widget_free(app->widget_file_read);
-    if (app->widget_file_delete)
-        widget_free(app->widget_file_delete);
-    if (app->text_input_path)
-        uart_text_input_free(app->text_input_path);
-    if (app->text_input_ssid)
-        uart_text_input_free(app->text_input_ssid);
-    if (app->text_input_password)
-        uart_text_input_free(app->text_input_password);
-    if (app->text_input_file_type)
-        uart_text_input_free(app->text_input_file_type);
-    if (app->text_input_file_rename)
-        uart_text_input_free(app->text_input_file_rename);
-    if (app->text_input_headers)
-        uart_text_input_free(app->text_input_headers);
-    if (app->text_input_payload)
-        uart_text_input_free(app->text_input_payload);
+    if(app->view_main) view_free(app->view_main);
+    if(app->submenu_main) submenu_free(app->submenu_main);
+    if(app->submenu_config) submenu_free(app->submenu_config);
+    if(app->variable_item_list_wifi) variable_item_list_free(app->variable_item_list_wifi);
+    if(app->variable_item_list_file) variable_item_list_free(app->variable_item_list_file);
+    if(app->variable_item_list_request) variable_item_list_free(app->variable_item_list_request);
+    if(app->view_dispatcher) view_dispatcher_free(app->view_dispatcher);
+    if(app->widget_about) widget_free(app->widget_about);
+    if(app->widget_file_read) widget_free(app->widget_file_read);
+    if(app->widget_file_delete) widget_free(app->widget_file_delete);
+    if(app->text_input_path) text_input_free(app->text_input_path);
+    if(app->text_input_ssid) text_input_free(app->text_input_ssid);
+    if(app->text_input_password) text_input_free(app->text_input_password);
+    if(app->text_input_file_type) text_input_free(app->text_input_file_type);
+    if(app->text_input_file_rename) text_input_free(app->text_input_file_rename);
+    if(app->text_input_headers) text_input_free(app->text_input_headers);
+    if(app->text_input_payload) text_input_free(app->text_input_payload);
 
     furi_record_close(RECORD_GUI);
     free_resources(app);
@@ -169,28 +129,23 @@ static void free_all(WebCrawlerApp *app, char *reason)
  * @brief      Function to free the resources used by WebCrawlerApp.
  * @param      app  The WebCrawlerApp object to free.
  */
-static void web_crawler_app_free(WebCrawlerApp *app)
-{
-    if (!app)
-    {
+static void web_crawler_app_free(WebCrawlerApp* app) {
+    if(!app) {
         FURI_LOG_E(TAG, "Invalid app context");
         return;
     }
 
-    if (!app->view_dispatcher)
-    {
+    if(!app->view_dispatcher) {
         FURI_LOG_E(TAG, "Invalid view dispatcher");
         return;
     }
 
     // Remove and free Main view
-    if (app->view_main)
-    {
+    if(app->view_main) {
         view_dispatcher_remove_view(app->view_dispatcher, WebCrawlerViewMain);
         view_free(app->view_main);
     }
-    if (app->view_run)
-    {
+    if(app->view_run) {
         view_dispatcher_remove_view(app->view_dispatcher, WebCrawlerViewRun);
         view_free(app->view_run);
     }
@@ -198,29 +153,24 @@ static void web_crawler_app_free(WebCrawlerApp *app)
     flipper_http_deinit();
 
     // Remove and free Submenu
-    if (app->submenu_main)
-    {
+    if(app->submenu_main) {
         view_dispatcher_remove_view(app->view_dispatcher, WebCrawlerViewSubmenuMain);
         submenu_free(app->submenu_main);
     }
-    if (app->submenu_config)
-    {
+    if(app->submenu_config) {
         view_dispatcher_remove_view(app->view_dispatcher, WebCrawlerViewSubmenuConfig);
         submenu_free(app->submenu_config);
     }
     // Remove and free Variable Item Lists
-    if (app->variable_item_list_wifi)
-    {
+    if(app->variable_item_list_wifi) {
         view_dispatcher_remove_view(app->view_dispatcher, WebCrawlerViewVariableItemListWifi);
         variable_item_list_free(app->variable_item_list_wifi);
     }
-    if (app->variable_item_list_file)
-    {
+    if(app->variable_item_list_file) {
         view_dispatcher_remove_view(app->view_dispatcher, WebCrawlerViewVariableItemListFile);
         variable_item_list_free(app->variable_item_list_file);
     }
-    if (app->variable_item_list_request)
-    {
+    if(app->variable_item_list_request) {
         view_dispatcher_remove_view(app->view_dispatcher, WebCrawlerViewVariableItemListRequest);
         variable_item_list_free(app->variable_item_list_request);
     }
@@ -233,45 +183,33 @@ static void web_crawler_app_free(WebCrawlerApp *app)
     view_dispatcher_remove_view(app->view_dispatcher, WebCrawlerViewTextInputFileRename);
     view_dispatcher_remove_view(app->view_dispatcher, WebCrawlerViewTextInputHeaders);
     view_dispatcher_remove_view(app->view_dispatcher, WebCrawlerViewTextInputPayload);
-    if (app->text_input_path)
-        uart_text_input_free(app->text_input_path);
-    if (app->text_input_ssid)
-        uart_text_input_free(app->text_input_ssid);
-    if (app->text_input_password)
-        uart_text_input_free(app->text_input_password);
-    if (app->text_input_file_type)
-        uart_text_input_free(app->text_input_file_type);
-    if (app->text_input_file_rename)
-        uart_text_input_free(app->text_input_file_rename);
-    if (app->text_input_headers)
-        uart_text_input_free(app->text_input_headers);
-    if (app->text_input_payload)
-        uart_text_input_free(app->text_input_payload);
+    if(app->text_input_path) text_input_free(app->text_input_path);
+    if(app->text_input_ssid) text_input_free(app->text_input_ssid);
+    if(app->text_input_password) text_input_free(app->text_input_password);
+    if(app->text_input_file_type) text_input_free(app->text_input_file_type);
+    if(app->text_input_file_rename) text_input_free(app->text_input_file_rename);
+    if(app->text_input_headers) text_input_free(app->text_input_headers);
+    if(app->text_input_payload) text_input_free(app->text_input_payload);
 
     // Remove and free Widgets
-    if (app->widget_about)
-    {
+    if(app->widget_about) {
         view_dispatcher_remove_view(app->view_dispatcher, WebCrawlerViewAbout);
         widget_free(app->widget_about);
     }
-    if (app->widget_file_read)
-    {
+    if(app->widget_file_read) {
         view_dispatcher_remove_view(app->view_dispatcher, WebCrawlerViewFileRead);
         widget_free(app->widget_file_read);
     }
-    if (app->widget_file_delete)
-    {
+    if(app->widget_file_delete) {
         view_dispatcher_remove_view(app->view_dispatcher, WebCrawlerViewFileDelete);
         widget_free(app->widget_file_delete);
     }
 
     // Free the ViewDispatcher and close GUI
-    if (app->view_dispatcher)
-        view_dispatcher_free(app->view_dispatcher);
+    if(app->view_dispatcher) view_dispatcher_free(app->view_dispatcher);
 
     // Free the application structure
-    if (app)
-    {
+    if(app) {
         free(app);
     }
 }

+ 274 - 177
web_crawler/web_crawler_i.h

@@ -5,24 +5,21 @@
  * @brief      Function to allocate resources for the WebCrawlerApp.
  * @return     Pointer to the initialized WebCrawlerApp, or NULL on failure.
  */
-WebCrawlerApp *web_crawler_app_alloc()
-{
+WebCrawlerApp* web_crawler_app_alloc() {
     // Initialize the entire structure to zero to prevent undefined behavior
-    WebCrawlerApp *app = (WebCrawlerApp *)malloc(sizeof(WebCrawlerApp));
+    WebCrawlerApp* app = (WebCrawlerApp*)malloc(sizeof(WebCrawlerApp));
 
     // Open GUI
-    Gui *gui = furi_record_open(RECORD_GUI);
+    Gui* gui = furi_record_open(RECORD_GUI);
 
     // Initialize UART with the correct callback
-    if (!flipper_http_init(flipper_http_rx_callback, app))
-    {
+    if(!flipper_http_init(flipper_http_rx_callback, app)) {
         FURI_LOG_E(TAG, "Failed to initialize UART");
         return NULL;
     }
 
     // Allocate ViewDispatcher
-    if (!easy_flipper_set_view_dispatcher(&app->view_dispatcher, gui, app))
-    {
+    if(!easy_flipper_set_view_dispatcher(&app->view_dispatcher, gui, app)) {
         return NULL;
     }
 
@@ -35,280 +32,378 @@ WebCrawlerApp *web_crawler_app_alloc()
     app->temp_buffer_size_http_method = 16;
     app->temp_buffer_size_headers = 256;
     app->temp_buffer_size_payload = 256;
-    if (!easy_flipper_set_buffer(&app->temp_buffer_path, app->temp_buffer_size_path))
-    {
+    if(!easy_flipper_set_buffer(&app->temp_buffer_path, app->temp_buffer_size_path)) {
         return NULL;
     }
-    if (!easy_flipper_set_buffer(&app->path, app->temp_buffer_size_path))
-    {
+    if(!easy_flipper_set_buffer(&app->path, app->temp_buffer_size_path)) {
         return NULL;
     }
-    if (!easy_flipper_set_buffer(&app->temp_buffer_ssid, app->temp_buffer_size_ssid))
-    {
+    if(!easy_flipper_set_buffer(&app->temp_buffer_ssid, app->temp_buffer_size_ssid)) {
         return NULL;
     }
-    if (!easy_flipper_set_buffer(&app->ssid, app->temp_buffer_size_ssid))
-    {
+    if(!easy_flipper_set_buffer(&app->ssid, app->temp_buffer_size_ssid)) {
         return NULL;
     }
-    if (!easy_flipper_set_buffer(&app->temp_buffer_password, app->temp_buffer_size_password))
-    {
+    if(!easy_flipper_set_buffer(&app->temp_buffer_password, app->temp_buffer_size_password)) {
         return NULL;
     }
-    if (!easy_flipper_set_buffer(&app->password, app->temp_buffer_size_password))
-    {
+    if(!easy_flipper_set_buffer(&app->password, app->temp_buffer_size_password)) {
         return NULL;
     }
-    if (!easy_flipper_set_buffer(&app->temp_buffer_file_type, app->temp_buffer_size_file_type))
-    {
+    if(!easy_flipper_set_buffer(&app->temp_buffer_file_type, app->temp_buffer_size_file_type)) {
         return NULL;
     }
-    if (!easy_flipper_set_buffer(&app->file_type, app->temp_buffer_size_file_type))
-    {
+    if(!easy_flipper_set_buffer(&app->file_type, app->temp_buffer_size_file_type)) {
         return NULL;
     }
-    if (!easy_flipper_set_buffer(&app->temp_buffer_file_rename, app->temp_buffer_size_file_rename))
-    {
+    if(!easy_flipper_set_buffer(&app->temp_buffer_file_rename, app->temp_buffer_size_file_rename)) {
         return NULL;
     }
-    if (!easy_flipper_set_buffer(&app->file_rename, app->temp_buffer_size_file_rename))
-    {
+    if(!easy_flipper_set_buffer(&app->file_rename, app->temp_buffer_size_file_rename)) {
         return NULL;
     }
-    if (!easy_flipper_set_buffer(&app->temp_buffer_http_method, app->temp_buffer_size_http_method))
-    {
+    if(!easy_flipper_set_buffer(&app->temp_buffer_http_method, app->temp_buffer_size_http_method)) {
         return NULL;
     }
-    if (!easy_flipper_set_buffer(&app->http_method, app->temp_buffer_size_http_method))
-    {
+    if(!easy_flipper_set_buffer(&app->http_method, app->temp_buffer_size_http_method)) {
         return NULL;
     }
-    if (!easy_flipper_set_buffer(&app->temp_buffer_headers, app->temp_buffer_size_headers))
-    {
+    if(!easy_flipper_set_buffer(&app->temp_buffer_headers, app->temp_buffer_size_headers)) {
         return NULL;
     }
-    if (!easy_flipper_set_buffer(&app->headers, app->temp_buffer_size_headers))
-    {
+    if(!easy_flipper_set_buffer(&app->headers, app->temp_buffer_size_headers)) {
         return NULL;
     }
-    if (!easy_flipper_set_buffer(&app->temp_buffer_payload, app->temp_buffer_size_payload))
-    {
+    if(!easy_flipper_set_buffer(&app->temp_buffer_payload, app->temp_buffer_size_payload)) {
         return NULL;
     }
-    if (!easy_flipper_set_buffer(&app->payload, app->temp_buffer_size_payload))
-    {
+    if(!easy_flipper_set_buffer(&app->payload, app->temp_buffer_size_payload)) {
         return NULL;
     }
 
     // Allocate TextInput views
-    if (!easy_flipper_set_uart_text_input(&app->text_input_path, WebCrawlerViewTextInput, "Enter URL", app->temp_buffer_path, app->temp_buffer_size_path, NULL, web_crawler_back_to_request_callback, &app->view_dispatcher, app))
-    {
-        return NULL;
-    }
-    if (!easy_flipper_set_uart_text_input(&app->text_input_ssid, WebCrawlerViewTextInputSSID, "Enter SSID", app->temp_buffer_ssid, app->temp_buffer_size_ssid, NULL, web_crawler_back_to_wifi_callback, &app->view_dispatcher, app))
-    {
-        return NULL;
-    }
-    if (!easy_flipper_set_uart_text_input(&app->text_input_password, WebCrawlerViewTextInputPassword, "Enter Password", app->temp_buffer_password, app->temp_buffer_size_password, NULL, web_crawler_back_to_wifi_callback, &app->view_dispatcher, app))
-    {
-        return NULL;
-    }
-    if (!easy_flipper_set_uart_text_input(&app->text_input_file_type, WebCrawlerViewTextInputFileType, "Enter File Type", app->temp_buffer_file_type, app->temp_buffer_size_file_type, NULL, web_crawler_back_to_file_callback, &app->view_dispatcher, app))
-    {
-        return NULL;
-    }
-    if (!easy_flipper_set_uart_text_input(&app->text_input_file_rename, WebCrawlerViewTextInputFileRename, "Enter File Rename", app->temp_buffer_file_rename, app->temp_buffer_size_file_rename, NULL, web_crawler_back_to_file_callback, &app->view_dispatcher, app))
-    {
-        return NULL;
-    }
-    if (!easy_flipper_set_uart_text_input(&app->text_input_headers, WebCrawlerViewTextInputHeaders, "Enter Headers", app->temp_buffer_headers, app->temp_buffer_size_headers, NULL, web_crawler_back_to_request_callback, &app->view_dispatcher, app))
-    {
-        return NULL;
-    }
-    if (!easy_flipper_set_uart_text_input(&app->text_input_payload, WebCrawlerViewTextInputPayload, "Enter Payload", app->temp_buffer_payload, app->temp_buffer_size_payload, NULL, web_crawler_back_to_request_callback, &app->view_dispatcher, app))
-    {
+    if(!easy_flipper_set_uart_text_input(
+           &app->text_input_path,
+           WebCrawlerViewTextInput,
+           "Enter URL",
+           app->temp_buffer_path,
+           app->temp_buffer_size_path,
+           NULL,
+           web_crawler_back_to_request_callback,
+           &app->view_dispatcher,
+           app)) {
+        return NULL;
+    }
+    if(!easy_flipper_set_uart_text_input(
+           &app->text_input_ssid,
+           WebCrawlerViewTextInputSSID,
+           "Enter SSID",
+           app->temp_buffer_ssid,
+           app->temp_buffer_size_ssid,
+           NULL,
+           web_crawler_back_to_wifi_callback,
+           &app->view_dispatcher,
+           app)) {
+        return NULL;
+    }
+    if(!easy_flipper_set_uart_text_input(
+           &app->text_input_password,
+           WebCrawlerViewTextInputPassword,
+           "Enter Password",
+           app->temp_buffer_password,
+           app->temp_buffer_size_password,
+           NULL,
+           web_crawler_back_to_wifi_callback,
+           &app->view_dispatcher,
+           app)) {
+        return NULL;
+    }
+    if(!easy_flipper_set_uart_text_input(
+           &app->text_input_file_type,
+           WebCrawlerViewTextInputFileType,
+           "Enter File Type",
+           app->temp_buffer_file_type,
+           app->temp_buffer_size_file_type,
+           NULL,
+           web_crawler_back_to_file_callback,
+           &app->view_dispatcher,
+           app)) {
+        return NULL;
+    }
+    if(!easy_flipper_set_uart_text_input(
+           &app->text_input_file_rename,
+           WebCrawlerViewTextInputFileRename,
+           "Enter File Rename",
+           app->temp_buffer_file_rename,
+           app->temp_buffer_size_file_rename,
+           NULL,
+           web_crawler_back_to_file_callback,
+           &app->view_dispatcher,
+           app)) {
+        return NULL;
+    }
+    if(!easy_flipper_set_uart_text_input(
+           &app->text_input_headers,
+           WebCrawlerViewTextInputHeaders,
+           "Enter Headers",
+           app->temp_buffer_headers,
+           app->temp_buffer_size_headers,
+           NULL,
+           web_crawler_back_to_request_callback,
+           &app->view_dispatcher,
+           app)) {
+        return NULL;
+    }
+    if(!easy_flipper_set_uart_text_input(
+           &app->text_input_payload,
+           WebCrawlerViewTextInputPayload,
+           "Enter Payload",
+           app->temp_buffer_payload,
+           app->temp_buffer_size_payload,
+           NULL,
+           web_crawler_back_to_request_callback,
+           &app->view_dispatcher,
+           app)) {
         return NULL;
     }
 
     // Allocate VariableItemList views
-    if (!easy_flipper_set_variable_item_list(&app->variable_item_list_wifi, WebCrawlerViewVariableItemListWifi, web_crawler_wifi_enter_callback, web_crawler_back_to_configure_callback, &app->view_dispatcher, app))
-    {
+    if(!easy_flipper_set_variable_item_list(
+           &app->variable_item_list_wifi,
+           WebCrawlerViewVariableItemListWifi,
+           web_crawler_wifi_enter_callback,
+           web_crawler_back_to_configure_callback,
+           &app->view_dispatcher,
+           app)) {
         return NULL;
     }
-    if (!easy_flipper_set_variable_item_list(&app->variable_item_list_file, WebCrawlerViewVariableItemListFile, web_crawler_file_enter_callback, web_crawler_back_to_configure_callback, &app->view_dispatcher, app))
-    {
+    if(!easy_flipper_set_variable_item_list(
+           &app->variable_item_list_file,
+           WebCrawlerViewVariableItemListFile,
+           web_crawler_file_enter_callback,
+           web_crawler_back_to_configure_callback,
+           &app->view_dispatcher,
+           app)) {
         return NULL;
     }
-    if (!easy_flipper_set_variable_item_list(&app->variable_item_list_request, WebCrawlerViewVariableItemListRequest, web_crawler_request_enter_callback, web_crawler_back_to_configure_callback, &app->view_dispatcher, app))
-    {
+    if(!easy_flipper_set_variable_item_list(
+           &app->variable_item_list_request,
+           WebCrawlerViewVariableItemListRequest,
+           web_crawler_request_enter_callback,
+           web_crawler_back_to_configure_callback,
+           &app->view_dispatcher,
+           app)) {
         return NULL;
     }
 
     // set variable items
-    app->path_item = variable_item_list_add(app->variable_item_list_request, "Path", 0, NULL, NULL);
-    app->http_method_item = variable_item_list_add(app->variable_item_list_request, "HTTP Method", 5, web_crawler_http_method_change, app);
-    app->headers_item = variable_item_list_add(app->variable_item_list_request, "Headers", 0, NULL, NULL);
-    app->payload_item = variable_item_list_add(app->variable_item_list_request, "Payload", 0, NULL, NULL);
+    app->path_item =
+        variable_item_list_add(app->variable_item_list_request, "Path", 0, NULL, NULL);
+    app->http_method_item = variable_item_list_add(
+        app->variable_item_list_request, "HTTP Method", 5, web_crawler_http_method_change, app);
+    app->headers_item =
+        variable_item_list_add(app->variable_item_list_request, "Headers", 0, NULL, NULL);
+    app->payload_item =
+        variable_item_list_add(app->variable_item_list_request, "Payload", 0, NULL, NULL);
     //
-    app->ssid_item = variable_item_list_add(app->variable_item_list_wifi, "SSID", 0, NULL, NULL);         // index 0
-    app->password_item = variable_item_list_add(app->variable_item_list_wifi, "Password", 0, NULL, NULL); // index 1
+    app->ssid_item =
+        variable_item_list_add(app->variable_item_list_wifi, "SSID", 0, NULL, NULL); // index 0
+    app->password_item =
+        variable_item_list_add(app->variable_item_list_wifi, "Password", 0, NULL, NULL); // index 1
     //
-    app->file_read_item = variable_item_list_add(app->variable_item_list_file, "Read File", 0, NULL, NULL);     // index 0
-    app->file_type_item = variable_item_list_add(app->variable_item_list_file, "Set File Type", 0, NULL, NULL); // index 1
-    app->file_rename_item = variable_item_list_add(app->variable_item_list_file, "Rename File", 0, NULL, NULL); // index 2
-    app->file_delete_item = variable_item_list_add(app->variable_item_list_file, "Delete File", 0, NULL, NULL); // index 3
+    app->file_read_item = variable_item_list_add(
+        app->variable_item_list_file, "Read File", 0, NULL, NULL); // index 0
+    app->file_type_item = variable_item_list_add(
+        app->variable_item_list_file, "Set File Type", 0, NULL, NULL); // index 1
+    app->file_rename_item = variable_item_list_add(
+        app->variable_item_list_file, "Rename File", 0, NULL, NULL); // index 2
+    app->file_delete_item = variable_item_list_add(
+        app->variable_item_list_file, "Delete File", 0, NULL, NULL); // index 3
 
-    if (!app->ssid_item || !app->password_item || !app->file_type_item || !app->file_rename_item || !app->path_item || !app->file_read_item || !app->file_delete_item || !app->http_method_item || !app->headers_item || !app->payload_item)
-    {
+    if(!app->ssid_item || !app->password_item || !app->file_type_item || !app->file_rename_item ||
+       !app->path_item || !app->file_read_item || !app->file_delete_item ||
+       !app->http_method_item || !app->headers_item || !app->payload_item) {
         free_all(app, "Failed to add items to VariableItemList");
         return NULL;
     }
 
-    variable_item_set_current_value_text(app->path_item, "");        // Initialize
+    variable_item_set_current_value_text(app->path_item, ""); // Initialize
     variable_item_set_current_value_text(app->http_method_item, ""); // Initialize
-    variable_item_set_current_value_text(app->headers_item, "");     // Initialize
-    variable_item_set_current_value_text(app->payload_item, "");     // Initialize
-    variable_item_set_current_value_text(app->ssid_item, "");        // Initialize
-    variable_item_set_current_value_text(app->password_item, "");    // Initialize
-    variable_item_set_current_value_text(app->file_type_item, "");   // Initialize
+    variable_item_set_current_value_text(app->headers_item, ""); // Initialize
+    variable_item_set_current_value_text(app->payload_item, ""); // Initialize
+    variable_item_set_current_value_text(app->ssid_item, ""); // Initialize
+    variable_item_set_current_value_text(app->password_item, ""); // Initialize
+    variable_item_set_current_value_text(app->file_type_item, ""); // Initialize
     variable_item_set_current_value_text(app->file_rename_item, ""); // Initialize
-    variable_item_set_current_value_text(app->file_read_item, "");   // Initialize
+    variable_item_set_current_value_text(app->file_read_item, ""); // Initialize
     variable_item_set_current_value_text(app->file_delete_item, ""); // Initialize
 
     // Allocate Submenu views
-    if (!easy_flipper_set_submenu(&app->submenu_main, WebCrawlerViewSubmenuMain, "Web Crawler v0.7", web_crawler_exit_app_callback, &app->view_dispatcher))
-    {
+    if(!easy_flipper_set_submenu(
+           &app->submenu_main,
+           WebCrawlerViewSubmenuMain,
+           "Web Crawler v0.7",
+           web_crawler_exit_app_callback,
+           &app->view_dispatcher)) {
         return NULL;
     }
-    if (!easy_flipper_set_submenu(&app->submenu_config, WebCrawlerViewSubmenuConfig, "Settings", web_crawler_back_to_main_callback, &app->view_dispatcher))
-    {
+    if(!easy_flipper_set_submenu(
+           &app->submenu_config,
+           WebCrawlerViewSubmenuConfig,
+           "Settings",
+           web_crawler_back_to_main_callback,
+           &app->view_dispatcher)) {
         return NULL;
     }
 
     // Add Submenu items
-    submenu_add_item(app->submenu_main, "Run", WebCrawlerSubmenuIndexRun, web_crawler_submenu_callback, app);
-    submenu_add_item(app->submenu_main, "About", WebCrawlerSubmenuIndexAbout, web_crawler_submenu_callback, app);
-    submenu_add_item(app->submenu_main, "Settings", WebCrawlerSubmenuIndexConfig, web_crawler_submenu_callback, app);
+    submenu_add_item(
+        app->submenu_main, "Run", WebCrawlerSubmenuIndexRun, web_crawler_submenu_callback, app);
+    submenu_add_item(
+        app->submenu_main, "About", WebCrawlerSubmenuIndexAbout, web_crawler_submenu_callback, app);
+    submenu_add_item(
+        app->submenu_main,
+        "Settings",
+        WebCrawlerSubmenuIndexConfig,
+        web_crawler_submenu_callback,
+        app);
 
-    submenu_add_item(app->submenu_config, "WiFi", WebCrawlerSubmenuIndexWifi, web_crawler_submenu_callback, app);
-    submenu_add_item(app->submenu_config, "File", WebCrawlerSubmenuIndexFile, web_crawler_submenu_callback, app);
-    submenu_add_item(app->submenu_config, "Request", WebCrawlerSubmenuIndexRequest, web_crawler_submenu_callback, app);
+    submenu_add_item(
+        app->submenu_config, "WiFi", WebCrawlerSubmenuIndexWifi, web_crawler_submenu_callback, app);
+    submenu_add_item(
+        app->submenu_config, "File", WebCrawlerSubmenuIndexFile, web_crawler_submenu_callback, app);
+    submenu_add_item(
+        app->submenu_config,
+        "Request",
+        WebCrawlerSubmenuIndexRequest,
+        web_crawler_submenu_callback,
+        app);
 
     // Allocate views
-    if (!easy_flipper_set_view(&app->view_main, WebCrawlerViewMain, NULL, NULL, web_crawler_exit_app_callback, &app->view_dispatcher, app))
-    {
-        return NULL;
-    }
-    if (!easy_flipper_set_view(&app->view_run, WebCrawlerViewRun, web_crawler_view_draw_callback, NULL, web_crawler_back_to_main_callback, &app->view_dispatcher, app))
-    {
+    if(!easy_flipper_set_view(
+           &app->view_main,
+           WebCrawlerViewMain,
+           NULL,
+           NULL,
+           web_crawler_exit_app_callback,
+           &app->view_dispatcher,
+           app)) {
+        return NULL;
+    }
+    if(!easy_flipper_set_view(
+           &app->view_run,
+           WebCrawlerViewRun,
+           web_crawler_view_draw_callback,
+           NULL,
+           web_crawler_back_to_main_callback,
+           &app->view_dispatcher,
+           app)) {
         return NULL;
     }
 
     //-- WIDGET ABOUT VIEW --
-    if (!easy_flipper_set_widget(&app->widget_about, WebCrawlerViewAbout, "Web Crawler App\n---\nThis is a web crawler app for Flipper Zero.\n---\nVisit github.com/jblanked for more details.\n---\nPress BACK to return.", web_crawler_back_to_main_callback, &app->view_dispatcher))
-    {
+    if(!easy_flipper_set_widget(
+           &app->widget_about,
+           WebCrawlerViewAbout,
+           "Web Crawler App\n---\nThis is a web crawler app for Flipper Zero.\n---\nVisit github.com/jblanked for more details.\n---\nPress BACK to return.",
+           web_crawler_back_to_main_callback,
+           &app->view_dispatcher)) {
         return NULL;
     }
-    if (!easy_flipper_set_widget(&app->widget_file_read, WebCrawlerViewFileRead, "Data will be displayed here.", web_crawler_back_to_file_callback, &app->view_dispatcher))
-    {
+    if(!easy_flipper_set_widget(
+           &app->widget_file_read,
+           WebCrawlerViewFileRead,
+           "Data will be displayed here.",
+           web_crawler_back_to_file_callback,
+           &app->view_dispatcher)) {
         return NULL;
     }
-    if (!easy_flipper_set_widget(&app->widget_file_delete, WebCrawlerViewFileDelete, "File deleted.", web_crawler_back_to_file_callback, &app->view_dispatcher))
-    {
+    if(!easy_flipper_set_widget(
+           &app->widget_file_delete,
+           WebCrawlerViewFileDelete,
+           "File deleted.",
+           web_crawler_back_to_file_callback,
+           &app->view_dispatcher)) {
         return NULL;
     }
 
     // Load Settings and Update Views
-    if (!load_settings(
-            app->path,
-            app->temp_buffer_size_path,
-            app->ssid,
-            app->temp_buffer_size_ssid,
-            app->password,
-            app->temp_buffer_size_password,
-            app->file_rename,
-            app->temp_buffer_size_file_rename,
-            app->file_type,
-            app->temp_buffer_size_file_type,
-            app->http_method,
-            app->temp_buffer_size_http_method,
-            app->headers,
-            app->temp_buffer_size_headers,
-            app->payload,
-            app->temp_buffer_size_payload,
-            app))
-    {
+    if(!load_settings(
+           app->path,
+           app->temp_buffer_size_path,
+           app->ssid,
+           app->temp_buffer_size_ssid,
+           app->password,
+           app->temp_buffer_size_password,
+           app->file_rename,
+           app->temp_buffer_size_file_rename,
+           app->file_type,
+           app->temp_buffer_size_file_type,
+           app->http_method,
+           app->temp_buffer_size_http_method,
+           app->headers,
+           app->temp_buffer_size_headers,
+           app->payload,
+           app->temp_buffer_size_payload,
+           app)) {
         FURI_LOG_E(TAG, "Failed to load settings");
-    }
-    else
-    {
+    } else {
         // Update the configuration items based on loaded settings
-        if (app->path_item)
-        {
+        if(app->path_item) {
             variable_item_set_current_value_text(app->path_item, app->path);
-        }
-        else
-        {
-            variable_item_set_current_value_text(app->path_item, "https://httpbin.org/get"); // Initialize
+        } else {
+            variable_item_set_current_value_text(
+                app->path_item, "https://httpbin.org/get"); // Initialize
         }
 
-        if (app->ssid_item)
-        {
+        if(app->ssid_item) {
             variable_item_set_current_value_text(app->ssid_item, app->ssid);
-        }
-        else
-        {
+        } else {
             variable_item_set_current_value_text(app->ssid_item, ""); // Initialize
         }
 
-        if (app->file_type_item)
-        {
+        if(app->file_type_item) {
             variable_item_set_current_value_text(app->file_type_item, app->file_type);
-        }
-        else
-        {
+        } else {
             variable_item_set_current_value_text(app->file_type_item, ".txt"); // Initialize
         }
 
-        if (app->file_rename_item)
-        {
+        if(app->file_rename_item) {
             variable_item_set_current_value_text(app->file_rename_item, app->file_rename);
-        }
-        else
-        {
-            variable_item_set_current_value_text(app->file_rename_item, "received_data"); // Initialize
+        } else {
+            variable_item_set_current_value_text(
+                app->file_rename_item, "received_data"); // Initialize
         }
 
-        if (app->http_method_item)
-        {
+        if(app->http_method_item) {
             variable_item_set_current_value_text(app->http_method_item, app->http_method);
-        }
-        else
-        {
+        } else {
             variable_item_set_current_value_text(app->http_method_item, "GET"); // Initialize
         }
 
-        if (app->headers_item)
-        {
+        if(app->headers_item) {
             variable_item_set_current_value_text(app->headers_item, app->headers);
-        }
-        else
-        {
-            variable_item_set_current_value_text(app->headers_item, "{\n\t\"Content-Type\": \"application/json\"\n}"); // Initialize
+        } else {
+            variable_item_set_current_value_text(
+                app->headers_item, "{\n\t\"Content-Type\": \"application/json\"\n}"); // Initialize
         }
 
-        if (app->payload_item)
-        {
+        if(app->payload_item) {
             variable_item_set_current_value_text(app->payload_item, app->payload);
-        }
-        else
-        {
-            variable_item_set_current_value_text(app->payload_item, "{\n\t\"key\": \"value\"\n}"); // Initialize
+        } else {
+            variable_item_set_current_value_text(
+                app->payload_item, "{\n\t\"key\": \"value\"\n}"); // Initialize
         }
 
         // set the file path for fhttp.file_path
         char file_path[128];
-        snprintf(file_path, sizeof(file_path), "%s%s%s", RECEIVED_DATA_PATH, app->file_rename, app->file_type);
+        snprintf(
+            file_path,
+            sizeof(file_path),
+            "%s%s%s",
+            RECEIVED_DATA_PATH,
+            app->file_rename,
+            app->file_type);
         snprintf(fhttp.file_path, sizeof(fhttp.file_path), "%s", file_path);
 
         // update temp buffers
@@ -318,9 +413,11 @@ WebCrawlerApp *web_crawler_app_alloc()
         app->temp_buffer_ssid[app->temp_buffer_size_ssid - 1] = '\0';
         strncpy(app->temp_buffer_file_type, app->file_type, app->temp_buffer_size_file_type - 1);
         app->temp_buffer_file_type[app->temp_buffer_size_file_type - 1] = '\0';
-        strncpy(app->temp_buffer_file_rename, app->file_rename, app->temp_buffer_size_file_rename - 1);
+        strncpy(
+            app->temp_buffer_file_rename, app->file_rename, app->temp_buffer_size_file_rename - 1);
         app->temp_buffer_file_rename[app->temp_buffer_size_file_rename - 1] = '\0';
-        strncpy(app->temp_buffer_http_method, app->http_method, app->temp_buffer_size_http_method - 1);
+        strncpy(
+            app->temp_buffer_http_method, app->http_method, app->temp_buffer_size_http_method - 1);
         app->temp_buffer_http_method[app->temp_buffer_size_http_method - 1] = '\0';
         strncpy(app->temp_buffer_headers, app->headers, app->temp_buffer_size_headers - 1);
         app->temp_buffer_headers[app->temp_buffer_size_headers - 1] = '\0';

+ 105 - 130
web_crawler/web_crawler_storage.h

@@ -5,111 +5,105 @@
 #include <storage/storage.h>
 
 #define SETTINGS_PATH STORAGE_EXT_PATH_PREFIX "/apps_data/" http_tag "/settings.bin"
-#define RECEIVED_DATA_PATH STORAGE_EXT_PATH_PREFIX "/apps_data/" http_tag "/" // add the file name to the end (e.g. "received_data.txt")
+#define RECEIVED_DATA_PATH                         \
+    STORAGE_EXT_PATH_PREFIX "/apps_data/" http_tag \
+                            "/" // add the file name to the end (e.g. "received_data.txt")
 
 // will need to make a duplicate of the file
 // one to save data, and the other for users to manipulate
 
 #define MAX_RECEIVED_DATA_SIZE 1024
-#define SHOW_MAX_FILE_SIZE 2048
+#define SHOW_MAX_FILE_SIZE     2048
 
 // Define the truncation notice
 #define TRUNCATION_NOTICE "\n\n[Data truncated due to size limits]"
 
 // Function to save settings: path, SSID, and password
 static void save_settings(
-    const char *path,
-    const char *ssid,
-    const char *password,
-    const char *file_rename,
-    const char *file_type,
-    const char *http_method,
-    const char *headers,
-    const char *payload)
-{
+    const char* path,
+    const char* ssid,
+    const char* password,
+    const char* file_rename,
+    const char* file_type,
+    const char* http_method,
+    const char* headers,
+    const char* payload) {
     // Create the directory for saving settings
     char directory_path[256];
-    snprintf(directory_path, sizeof(directory_path), STORAGE_EXT_PATH_PREFIX "/apps_data/web_crawler_app");
+    snprintf(
+        directory_path,
+        sizeof(directory_path),
+        STORAGE_EXT_PATH_PREFIX "/apps_data/web_crawler_app");
 
     // Create the directory
-    Storage *storage = furi_record_open(RECORD_STORAGE);
+    Storage* storage = furi_record_open(RECORD_STORAGE);
     storage_common_mkdir(storage, directory_path);
 
     // Open the settings file
-    File *file = storage_file_alloc(storage);
-    if (!storage_file_open(file, SETTINGS_PATH, FSAM_WRITE, FSOM_CREATE_ALWAYS))
-    {
+    File* file = storage_file_alloc(storage);
+    if(!storage_file_open(file, SETTINGS_PATH, FSAM_WRITE, FSOM_CREATE_ALWAYS)) {
         FURI_LOG_E(TAG, "Failed to open settings file for writing: %s", SETTINGS_PATH);
         storage_file_free(file);
         furi_record_close(RECORD_STORAGE);
         return;
     }
 
-    if (file_type == NULL || strlen(file_type) == 0)
-    {
+    if(file_type == NULL || strlen(file_type) == 0) {
         file_type = ".txt";
     }
 
     // Save the SSID length and data
     size_t ssid_length = strlen(ssid) + 1; // Include null terminator
-    if (storage_file_write(file, &ssid_length, sizeof(size_t)) != sizeof(size_t) ||
-        storage_file_write(file, ssid, ssid_length) != ssid_length)
-    {
+    if(storage_file_write(file, &ssid_length, sizeof(size_t)) != sizeof(size_t) ||
+       storage_file_write(file, ssid, ssid_length) != ssid_length) {
         FURI_LOG_E(TAG, "Failed to write SSID");
     }
 
     // Save the password length and data
     size_t password_length = strlen(password) + 1; // Include null terminator
-    if (storage_file_write(file, &password_length, sizeof(size_t)) != sizeof(size_t) ||
-        storage_file_write(file, password, password_length) != password_length)
-    {
+    if(storage_file_write(file, &password_length, sizeof(size_t)) != sizeof(size_t) ||
+       storage_file_write(file, password, password_length) != password_length) {
         FURI_LOG_E(TAG, "Failed to write password");
     }
 
     // Save the path length and data
     size_t path_length = strlen(path) + 1; // Include null terminator
-    if (storage_file_write(file, &path_length, sizeof(size_t)) != sizeof(size_t) ||
-        storage_file_write(file, path, path_length) != path_length)
-    {
+    if(storage_file_write(file, &path_length, sizeof(size_t)) != sizeof(size_t) ||
+       storage_file_write(file, path, path_length) != path_length) {
         FURI_LOG_E(TAG, "Failed to write path");
     }
     // Save the file rename length and data
     size_t file_rename_length = strlen(file_rename) + 1; // Include null terminator
-    if (storage_file_write(file, &file_rename_length, sizeof(size_t)) != sizeof(size_t) ||
-        storage_file_write(file, file_rename, file_rename_length) != file_rename_length)
-    {
+    if(storage_file_write(file, &file_rename_length, sizeof(size_t)) != sizeof(size_t) ||
+       storage_file_write(file, file_rename, file_rename_length) != file_rename_length) {
         FURI_LOG_E(TAG, "Failed to write file rename");
     }
 
     // Save the file type length and data
     size_t file_type_length = strlen(file_type) + 1; // Include null terminator
-    if (storage_file_write(file, &file_type_length, sizeof(size_t)) != sizeof(size_t) ||
-        storage_file_write(file, file_type, file_type_length) != file_type_length)
-    {
+    if(storage_file_write(file, &file_type_length, sizeof(size_t)) != sizeof(size_t) ||
+       storage_file_write(file, file_type, file_type_length) != file_type_length) {
         FURI_LOG_E(TAG, "Failed to write file type");
     }
 
     // Save the http method length and data
     size_t http_method_length = strlen(http_method) + 1; // Include null terminator
-    if (storage_file_write(file, &http_method_length, sizeof(size_t)) != sizeof(size_t) ||
-        storage_file_write(file, http_method, http_method_length) != http_method_length)
-    {
+    if(storage_file_write(file, &http_method_length, sizeof(size_t)) != sizeof(size_t) ||
+       storage_file_write(file, http_method, http_method_length) != http_method_length) {
         FURI_LOG_E(TAG, "Failed to write http method");
     }
 
     // Save the headers length and data
     size_t headers_length = strlen(headers) + 1; // Include null terminator
-    if (storage_file_write(file, &headers_length, sizeof(size_t)) != sizeof(size_t) ||
-        storage_file_write(file, headers, headers_length) != headers_length)
-    {
+    if(storage_file_write(file, &headers_length, sizeof(size_t)) != sizeof(size_t) ||
+       storage_file_write(file, headers, headers_length) != headers_length) {
         FURI_LOG_E(TAG, "Failed to write headers");
     }
 
     // Save the payload length and data
     size_t payload_length = strlen(payload) + 1; // Include null terminator
-    if (storage_file_write(file, &payload_length, sizeof(size_t)) != sizeof(size_t) ||
-        storage_file_write(file, payload, payload_length) != payload_length)
-    {
+    if(storage_file_write(file, &payload_length, sizeof(size_t)) != sizeof(size_t) ||
+       storage_file_write(file, payload, payload_length) != payload_length) {
         FURI_LOG_E(TAG, "Failed to write payload");
     }
 
@@ -120,34 +114,31 @@ static void save_settings(
 
 // Function to load settings (the variables must be opened in the order they were saved)
 static bool load_settings(
-    char *path,
+    char* path,
     size_t path_size,
-    char *ssid,
+    char* ssid,
     size_t ssid_size,
-    char *password,
+    char* password,
     size_t password_size,
-    char *file_rename,
+    char* file_rename,
     size_t file_rename_size,
-    char *file_type,
+    char* file_type,
     size_t file_type_size,
-    char *http_method,
+    char* http_method,
     size_t http_method_size,
-    char *headers,
+    char* headers,
     size_t headers_size,
-    char *payload,
+    char* payload,
     size_t payload_size,
-    WebCrawlerApp *app)
-{
-    if (!app)
-    {
+    WebCrawlerApp* app) {
+    if(!app) {
         FURI_LOG_E(TAG, "WebCrawlerApp is NULL");
         return false;
     }
-    Storage *storage = furi_record_open(RECORD_STORAGE);
-    File *file = storage_file_alloc(storage);
+    Storage* storage = furi_record_open(RECORD_STORAGE);
+    File* file = storage_file_alloc(storage);
 
-    if (!storage_file_open(file, SETTINGS_PATH, FSAM_READ, FSOM_OPEN_EXISTING))
-    {
+    if(!storage_file_open(file, SETTINGS_PATH, FSAM_READ, FSOM_OPEN_EXISTING)) {
         FURI_LOG_E(TAG, "Failed to open settings file for reading: %s", SETTINGS_PATH);
         storage_file_free(file);
         furi_record_close(RECORD_STORAGE);
@@ -156,9 +147,8 @@ static bool load_settings(
 
     // Load the SSID
     size_t ssid_length;
-    if (storage_file_read(file, &ssid_length, sizeof(size_t)) != sizeof(size_t) || ssid_length > ssid_size ||
-        storage_file_read(file, ssid, ssid_length) != ssid_length)
-    {
+    if(storage_file_read(file, &ssid_length, sizeof(size_t)) != sizeof(size_t) ||
+       ssid_length > ssid_size || storage_file_read(file, ssid, ssid_length) != ssid_length) {
         FURI_LOG_E(TAG, "Failed to read SSID");
         storage_file_close(file);
         storage_file_free(file);
@@ -169,9 +159,9 @@ static bool load_settings(
 
     // Load the password
     size_t password_length;
-    if (storage_file_read(file, &password_length, sizeof(size_t)) != sizeof(size_t) || password_length > password_size ||
-        storage_file_read(file, password, password_length) != password_length)
-    {
+    if(storage_file_read(file, &password_length, sizeof(size_t)) != sizeof(size_t) ||
+       password_length > password_size ||
+       storage_file_read(file, password, password_length) != password_length) {
         FURI_LOG_E(TAG, "Failed to read password");
         storage_file_close(file);
         storage_file_free(file);
@@ -182,9 +172,8 @@ static bool load_settings(
 
     // Load the path
     size_t path_length;
-    if (storage_file_read(file, &path_length, sizeof(size_t)) != sizeof(size_t) || path_length > path_size ||
-        storage_file_read(file, path, path_length) != path_length)
-    {
+    if(storage_file_read(file, &path_length, sizeof(size_t)) != sizeof(size_t) ||
+       path_length > path_size || storage_file_read(file, path, path_length) != path_length) {
         FURI_LOG_E(TAG, "Failed to read path");
         storage_file_close(file);
         storage_file_free(file);
@@ -195,9 +184,9 @@ static bool load_settings(
 
     // Load the file rename
     size_t file_rename_length;
-    if (storage_file_read(file, &file_rename_length, sizeof(size_t)) != sizeof(size_t) || file_rename_length > file_rename_size ||
-        storage_file_read(file, file_rename, file_rename_length) != file_rename_length)
-    {
+    if(storage_file_read(file, &file_rename_length, sizeof(size_t)) != sizeof(size_t) ||
+       file_rename_length > file_rename_size ||
+       storage_file_read(file, file_rename, file_rename_length) != file_rename_length) {
         FURI_LOG_E(TAG, "Failed to read file rename");
         storage_file_close(file);
         storage_file_free(file);
@@ -208,9 +197,9 @@ static bool load_settings(
 
     // Load the file type
     size_t file_type_length;
-    if (storage_file_read(file, &file_type_length, sizeof(size_t)) != sizeof(size_t) || file_type_length > file_type_size ||
-        storage_file_read(file, file_type, file_type_length) != file_type_length)
-    {
+    if(storage_file_read(file, &file_type_length, sizeof(size_t)) != sizeof(size_t) ||
+       file_type_length > file_type_size ||
+       storage_file_read(file, file_type, file_type_length) != file_type_length) {
         FURI_LOG_E(TAG, "Failed to read file type");
         storage_file_close(file);
         storage_file_free(file);
@@ -221,9 +210,9 @@ static bool load_settings(
 
     // Load the http method
     size_t http_method_length;
-    if (storage_file_read(file, &http_method_length, sizeof(size_t)) != sizeof(size_t) || http_method_length > http_method_size ||
-        storage_file_read(file, http_method, http_method_length) != http_method_length)
-    {
+    if(storage_file_read(file, &http_method_length, sizeof(size_t)) != sizeof(size_t) ||
+       http_method_length > http_method_size ||
+       storage_file_read(file, http_method, http_method_length) != http_method_length) {
         FURI_LOG_E(TAG, "Failed to read http method");
         storage_file_close(file);
         storage_file_free(file);
@@ -233,9 +222,9 @@ static bool load_settings(
 
     // Load the headers
     size_t headers_length;
-    if (storage_file_read(file, &headers_length, sizeof(size_t)) != sizeof(size_t) || headers_length > headers_size ||
-        storage_file_read(file, headers, headers_length) != headers_length)
-    {
+    if(storage_file_read(file, &headers_length, sizeof(size_t)) != sizeof(size_t) ||
+       headers_length > headers_size ||
+       storage_file_read(file, headers, headers_length) != headers_length) {
         FURI_LOG_E(TAG, "Failed to read headers");
         storage_file_close(file);
         storage_file_free(file);
@@ -245,9 +234,9 @@ static bool load_settings(
 
     // Load the payload
     size_t payload_length;
-    if (storage_file_read(file, &payload_length, sizeof(size_t)) != sizeof(size_t) || payload_length > payload_size ||
-        storage_file_read(file, payload, payload_length) != payload_length)
-    {
+    if(storage_file_read(file, &payload_length, sizeof(size_t)) != sizeof(size_t) ||
+       payload_length > payload_size ||
+       storage_file_read(file, payload, payload_length) != payload_length) {
         FURI_LOG_E(TAG, "Failed to read payload");
         storage_file_close(file);
         storage_file_free(file);
@@ -271,53 +260,46 @@ static bool load_settings(
     return true;
 }
 
-static bool delete_received_data(WebCrawlerApp *app)
-{
-    if (app == NULL)
-    {
+static bool delete_received_data(WebCrawlerApp* app) {
+    if(app == NULL) {
         FURI_LOG_E(TAG, "WebCrawlerApp is NULL");
         return false;
     }
     // Open the storage record
-    Storage *storage = furi_record_open(RECORD_STORAGE);
-    if (!storage)
-    {
+    Storage* storage = furi_record_open(RECORD_STORAGE);
+    if(!storage) {
         FURI_LOG_E(TAG, "Failed to open storage record");
         return false;
     }
 
-    if (!storage_simply_remove_recursive(storage, RECEIVED_DATA_PATH "received_data.txt"))
-    {
+    if(!storage_simply_remove_recursive(storage, RECEIVED_DATA_PATH "received_data.txt")) {
         FURI_LOG_E(TAG, "Failed to delete main file");
         furi_record_close(RECORD_STORAGE);
         return false;
     }
 
     // Allocate memory for new_path
-    char *new_path = malloc(256);
-    if (new_path == NULL)
-    {
+    char* new_path = malloc(256);
+    if(new_path == NULL) {
         FURI_LOG_E(TAG, "Memory allocation failed for paths");
         free(new_path);
         return false;
     }
 
-    if (app->file_type == NULL || strlen(app->file_type) == 0)
-    {
+    if(app->file_type == NULL || strlen(app->file_type) == 0) {
         app->file_type = ".txt";
     }
 
     // Format the new_path
-    int ret_new = snprintf(new_path, 256, "%s%s%s", RECEIVED_DATA_PATH, app->file_rename, app->file_type);
-    if (ret_new < 0 || (size_t)ret_new >= 256)
-    {
+    int ret_new =
+        snprintf(new_path, 256, "%s%s%s", RECEIVED_DATA_PATH, app->file_rename, app->file_type);
+    if(ret_new < 0 || (size_t)ret_new >= 256) {
         FURI_LOG_E(TAG, "Failed to create new_path");
         free(new_path);
         return false;
     }
 
-    if (!storage_simply_remove_recursive(storage, new_path))
-    {
+    if(!storage_simply_remove_recursive(storage, new_path)) {
         FURI_LOG_E(TAG, "Failed to delete duplicate file");
         furi_record_close(RECORD_STORAGE);
         return false;
@@ -328,39 +310,37 @@ static bool delete_received_data(WebCrawlerApp *app)
     return true;
 }
 
-static bool rename_received_data(const char *old_name, const char *new_name, const char *file_type, const char *old_file_type)
-{
+static bool rename_received_data(
+    const char* old_name,
+    const char* new_name,
+    const char* file_type,
+    const char* old_file_type) {
     // Open the storage record
-    Storage *storage = furi_record_open(RECORD_STORAGE);
-    if (!storage)
-    {
+    Storage* storage = furi_record_open(RECORD_STORAGE);
+    if(!storage) {
         FURI_LOG_E(TAG, "Failed to open storage record");
         return false;
     }
     // Allocate memory for old_path and new_path
-    char *new_path = malloc(256);
-    char *old_path = malloc(256);
-    if (new_path == NULL || old_path == NULL)
-    {
+    char* new_path = malloc(256);
+    char* old_path = malloc(256);
+    if(new_path == NULL || old_path == NULL) {
         FURI_LOG_E(TAG, "Memory allocation failed for paths");
         free(old_path);
         free(new_path);
         return false;
     }
 
-    if (file_type == NULL || strlen(file_type) == 0)
-    {
+    if(file_type == NULL || strlen(file_type) == 0) {
         file_type = ".txt";
     }
-    if (old_file_type == NULL || strlen(old_file_type) == 0)
-    {
+    if(old_file_type == NULL || strlen(old_file_type) == 0) {
         old_file_type = ".txt";
     }
 
     // Format the old_path
     int ret_old = snprintf(old_path, 256, "%s%s%s", RECEIVED_DATA_PATH, old_name, old_file_type);
-    if (ret_old < 0 || (size_t)ret_old >= 256)
-    {
+    if(ret_old < 0 || (size_t)ret_old >= 256) {
         FURI_LOG_E(TAG, "Failed to create old_path");
         free(old_path);
         free(new_path);
@@ -369,8 +349,7 @@ static bool rename_received_data(const char *old_name, const char *new_name, con
 
     // Format the new_path
     int ret_new = snprintf(new_path, 256, "%s%s%s", RECEIVED_DATA_PATH, new_name, file_type);
-    if (ret_new < 0 || (size_t)ret_new >= 256)
-    {
+    if(ret_new < 0 || (size_t)ret_new >= 256) {
         FURI_LOG_E(TAG, "Failed to create new_path");
         free(old_path);
         free(new_path);
@@ -378,30 +357,26 @@ static bool rename_received_data(const char *old_name, const char *new_name, con
     }
 
     // Check if the file exists
-    if (!storage_file_exists(storage, old_path))
-    {
-        if (!storage_file_exists(storage, RECEIVED_DATA_PATH "received_data.txt"))
-        {
+    if(!storage_file_exists(storage, old_path)) {
+        if(!storage_file_exists(storage, RECEIVED_DATA_PATH "received_data.txt")) {
             FURI_LOG_E(TAG, "No saved file exists");
             free(old_path);
             free(new_path);
             furi_record_close(RECORD_STORAGE);
             return false;
-        }
-        else
-        {
-            bool renamed = storage_common_copy(storage, RECEIVED_DATA_PATH "received_data.txt", new_path) == FSE_OK;
+        } else {
+            bool renamed =
+                storage_common_copy(storage, RECEIVED_DATA_PATH "received_data.txt", new_path) ==
+                FSE_OK;
 
             furi_record_close(RECORD_STORAGE);
             return renamed;
         }
-    }
-    else
-    {
+    } else {
         bool renamed = storage_common_rename(storage, old_path, new_path) == FSE_OK;
         storage_simply_remove_recursive(storage, old_path);
         furi_record_close(RECORD_STORAGE);
         return renamed;
     }
 }
-#endif // WEB_CRAWLER_STORAGE_H
+#endif // WEB_CRAWLER_STORAGE_H

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels