From de8a5b0f690b4d147f3c3ad7dc9c35875183a03f Mon Sep 17 00:00:00 2001 From: gemu2015 Date: Sat, 9 Jan 2021 16:33:23 +0100 Subject: [PATCH] optional delete file gui --- tasmota/xdrv_50_filesystem.ino | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/tasmota/xdrv_50_filesystem.ino b/tasmota/xdrv_50_filesystem.ino index 4deb956c4..e2943cce4 100644 --- a/tasmota/xdrv_50_filesystem.ino +++ b/tasmota/xdrv_50_filesystem.ino @@ -440,9 +440,15 @@ const char UFS_FORM_FILE_UPGb[] PROGMEM = const char UFS_FORM_SDC_DIRd[] PROGMEM = "
%s
"; const char UFS_FORM_SDC_DIRb[] PROGMEM = - "
%s %s %8d
"; + "
%s %s %8d %s
"; const char UFS_FORM_SDC_HREF[] PROGMEM = "http://%s/ufsd?download=%s/%s"; +#ifdef GUI_TRASH_FILE +const char UFS_FORM_SDC_HREFdel[] PROGMEM = + //"🗑"; + "🔥"; // 🔥 +#endif // GUI_TRASH_FILE + void UfsDirectory(void) { uint8_t depth = 0; @@ -471,6 +477,12 @@ void UfsDirectory(void) { } } + if (Webserver->hasArg("delete")) { + String stmp = Webserver->arg("delete"); + char *cp = (char*)stmp.c_str(); + dfsp->remove(cp); + } + WSContentStart_P(PSTR(D_MANAGE_FILE_SYSTEM)); WSContentSendStyle(); WSContentSend_P(UFS_FORM_FILE_UPLOAD); @@ -561,8 +573,15 @@ void UfsListDir(char *path, uint8_t depth) { UfsListDir(path, depth + 4); path[plen] = 0; } else { +#ifdef GUI_TRASH_FILE + char delpath[128]; + snprintf_P(delpath, sizeof(delpath), UFS_FORM_SDC_HREFdel, WiFi.localIP().toString().c_str(), pp, ep); +#else + char delpath[2]; + delpath[0]=0; +#endif // GUI_TRASH_FILE snprintf_P(npath, sizeof(npath), UFS_FORM_SDC_HREF, WiFi.localIP().toString().c_str(), pp, ep); - WSContentSend_P(UFS_FORM_SDC_DIRb, npath, ep, name, tstr.c_str(), entry.size()); + WSContentSend_P(UFS_FORM_SDC_DIRb, npath, ep, name, tstr.c_str(), entry.size(), delpath); } } entry.close();