mirror of https://github.com/arendst/Tasmota.git
optional delete file gui
This commit is contained in:
parent
d6e71f48e7
commit
de8a5b0f69
|
@ -440,9 +440,15 @@ const char UFS_FORM_FILE_UPGb[] PROGMEM =
|
|||
const char UFS_FORM_SDC_DIRd[] PROGMEM =
|
||||
"<pre><a href='%s' file='%s'>%s</a></pre>";
|
||||
const char UFS_FORM_SDC_DIRb[] PROGMEM =
|
||||
"<pre><a href='%s' file='%s'>%s</a> %s %8d</pre>";
|
||||
"<pre><a href='%s' file='%s'>%s</a> %s %8d %s</pre>";
|
||||
const char UFS_FORM_SDC_HREF[] PROGMEM =
|
||||
"http://%s/ufsd?download=%s/%s";
|
||||
#ifdef GUI_TRASH_FILE
|
||||
const char UFS_FORM_SDC_HREFdel[] PROGMEM =
|
||||
//"<a href=http://%s/ufsd?delete=%s/%s>🗑</a>";
|
||||
"<a href=http://%s/ufsd?delete=%s/%s>🔥</a>"; // 🔥
|
||||
#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();
|
||||
|
|
Loading…
Reference in New Issue