|
@@ -6,32 +6,17 @@ static Storage *evil_portal_open_storage() {
|
|
|
|
|
|
|
|
static void evil_portal_close_storage() { furi_record_close(RECORD_STORAGE); }
|
|
static void evil_portal_close_storage() { furi_record_close(RECORD_STORAGE); }
|
|
|
|
|
|
|
|
-bool evil_portal_read_index_html(void *context) {
|
|
|
|
|
- FuriString *file_path = furi_string_alloc();
|
|
|
|
|
-
|
|
|
|
|
- DialogsFileBrowserOptions browser_options;
|
|
|
|
|
- dialog_file_browser_set_basic_options(&browser_options,
|
|
|
|
|
- EVIL_PORTAL_INDEX_EXTENSION,
|
|
|
|
|
- NULL); // TODO configure icon
|
|
|
|
|
- browser_options.base_path = EVIL_PORTAL_BASE_FOLDER;
|
|
|
|
|
|
|
+void evil_portal_read_index_html(void *context) {
|
|
|
|
|
|
|
|
Evil_PortalApp *app = context;
|
|
Evil_PortalApp *app = context;
|
|
|
- bool res = dialog_file_browser_show(app->dialogs, file_path, file_path,
|
|
|
|
|
- &browser_options);
|
|
|
|
|
-
|
|
|
|
|
- if (!res) {
|
|
|
|
|
- furi_string_free(file_path);
|
|
|
|
|
- return false;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
Storage *storage = evil_portal_open_storage();
|
|
Storage *storage = evil_portal_open_storage();
|
|
|
FileInfo fi;
|
|
FileInfo fi;
|
|
|
|
|
|
|
|
- if (storage_common_stat(storage, furi_string_get_cstr(file_path), &fi) ==
|
|
|
|
|
|
|
+ if (storage_common_stat(storage, EVIL_PORTAL_INDEX_SAVE_PATH, &fi) ==
|
|
|
FSE_OK) {
|
|
FSE_OK) {
|
|
|
File *index_html = storage_file_alloc(storage);
|
|
File *index_html = storage_file_alloc(storage);
|
|
|
- if (storage_file_open(index_html, furi_string_get_cstr(file_path),
|
|
|
|
|
- FSAM_READ, FSOM_OPEN_EXISTING)) {
|
|
|
|
|
|
|
+ if (storage_file_open(index_html, EVIL_PORTAL_INDEX_SAVE_PATH, FSAM_READ,
|
|
|
|
|
+ FSOM_OPEN_EXISTING)) {
|
|
|
app->index_html = malloc((size_t)fi.size);
|
|
app->index_html = malloc((size_t)fi.size);
|
|
|
uint8_t *buf_ptr = app->index_html;
|
|
uint8_t *buf_ptr = app->index_html;
|
|
|
size_t read = 0;
|
|
size_t read = 0;
|
|
@@ -46,7 +31,6 @@ bool evil_portal_read_index_html(void *context) {
|
|
|
}
|
|
}
|
|
|
free(buf_ptr);
|
|
free(buf_ptr);
|
|
|
}
|
|
}
|
|
|
- furi_string_free(file_path);
|
|
|
|
|
storage_file_close(index_html);
|
|
storage_file_close(index_html);
|
|
|
storage_file_free(index_html);
|
|
storage_file_free(index_html);
|
|
|
} else {
|
|
} else {
|
|
@@ -59,7 +43,6 @@ bool evil_portal_read_index_html(void *context) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
evil_portal_close_storage();
|
|
evil_portal_close_storage();
|
|
|
- return true;
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void evil_portal_read_ap_name(void *context) {
|
|
void evil_portal_read_ap_name(void *context) {
|
|
@@ -127,8 +110,7 @@ void write_logs(FuriString *portal_logs) {
|
|
|
File *file = storage_file_alloc(storage);
|
|
File *file = storage_file_alloc(storage);
|
|
|
|
|
|
|
|
if (storage_file_open(file, seq_file_path, FSAM_WRITE, FSOM_CREATE_ALWAYS)) {
|
|
if (storage_file_open(file, seq_file_path, FSAM_WRITE, FSOM_CREATE_ALWAYS)) {
|
|
|
- storage_file_write(file, furi_string_get_cstr(portal_logs),
|
|
|
|
|
- furi_string_utf8_length(portal_logs));
|
|
|
|
|
|
|
+ storage_file_write(file, furi_string_get_cstr(portal_logs), furi_string_utf8_length(portal_logs));
|
|
|
}
|
|
}
|
|
|
storage_file_close(file);
|
|
storage_file_close(file);
|
|
|
storage_file_free(file);
|
|
storage_file_free(file);
|