mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-23 10:46:31 +00:00
file system editor GUI_FILE_EDIT
This commit is contained in:
parent
c2cde43a54
commit
06a75af1af
@ -916,6 +916,9 @@
|
|||||||
#define D_MANAGE_FILE_SYSTEM "Bestuur lêerstelsel"
|
#define D_MANAGE_FILE_SYSTEM "Bestuur lêerstelsel"
|
||||||
#define D_FS_SIZE "Grootte"
|
#define D_FS_SIZE "Grootte"
|
||||||
#define D_FS_FREE "Vry"
|
#define D_FS_FREE "Vry"
|
||||||
|
#define D_NEW_FILE "newfile.txt"
|
||||||
|
#define D_CREATE_NEW_FILE "Create and edit new file"
|
||||||
|
#define D_EDIT_FILE "Edit File"
|
||||||
|
|
||||||
//xsns_67_as3935.ino
|
//xsns_67_as3935.ino
|
||||||
#define D_AS3935_GAIN "versterking:"
|
#define D_AS3935_GAIN "versterking:"
|
||||||
|
@ -915,6 +915,9 @@
|
|||||||
#define D_MANAGE_FILE_SYSTEM "Manage File system"
|
#define D_MANAGE_FILE_SYSTEM "Manage File system"
|
||||||
#define D_FS_SIZE "Size"
|
#define D_FS_SIZE "Size"
|
||||||
#define D_FS_FREE "Free"
|
#define D_FS_FREE "Free"
|
||||||
|
#define D_NEW_FILE "newfile.txt"
|
||||||
|
#define D_CREATE_NEW_FILE "Create and edit new file"
|
||||||
|
#define D_EDIT_FILE "Edit File"
|
||||||
|
|
||||||
//xsns_67_as3935.ino
|
//xsns_67_as3935.ino
|
||||||
#define D_AS3935_GAIN "усилване:"
|
#define D_AS3935_GAIN "усилване:"
|
||||||
|
@ -916,6 +916,9 @@
|
|||||||
#define D_MANAGE_FILE_SYSTEM "Manage File system"
|
#define D_MANAGE_FILE_SYSTEM "Manage File system"
|
||||||
#define D_FS_SIZE "Size"
|
#define D_FS_SIZE "Size"
|
||||||
#define D_FS_FREE "Free"
|
#define D_FS_FREE "Free"
|
||||||
|
#define D_NEW_FILE "newfile.txt"
|
||||||
|
#define D_CREATE_NEW_FILE "Create and edit new file"
|
||||||
|
#define D_EDIT_FILE "Edit File"
|
||||||
|
|
||||||
//xsns_67_as3935.ino
|
//xsns_67_as3935.ino
|
||||||
#define D_AS3935_GAIN "gain:"
|
#define D_AS3935_GAIN "gain:"
|
||||||
|
@ -916,6 +916,9 @@
|
|||||||
#define D_MANAGE_FILE_SYSTEM "Verwalte Dateisystem"
|
#define D_MANAGE_FILE_SYSTEM "Verwalte Dateisystem"
|
||||||
#define D_FS_SIZE "Größe"
|
#define D_FS_SIZE "Größe"
|
||||||
#define D_FS_FREE "Frei"
|
#define D_FS_FREE "Frei"
|
||||||
|
#define D_NEW_FILE "neue-datei.txt"
|
||||||
|
#define D_CREATE_NEW_FILE "Neue Datei erstellen und bearbeiten"
|
||||||
|
#define D_EDIT_FILE "Datei bearbeiten"
|
||||||
|
|
||||||
//xsns_67_as3935.ino
|
//xsns_67_as3935.ino
|
||||||
#define D_AS3935_GAIN "Umgebung:"
|
#define D_AS3935_GAIN "Umgebung:"
|
||||||
|
@ -916,6 +916,9 @@
|
|||||||
#define D_MANAGE_FILE_SYSTEM "Manage File system"
|
#define D_MANAGE_FILE_SYSTEM "Manage File system"
|
||||||
#define D_FS_SIZE "Size"
|
#define D_FS_SIZE "Size"
|
||||||
#define D_FS_FREE "Free"
|
#define D_FS_FREE "Free"
|
||||||
|
#define D_NEW_FILE "newfile.txt"
|
||||||
|
#define D_CREATE_NEW_FILE "Create and edit new file"
|
||||||
|
#define D_EDIT_FILE "Edit File"
|
||||||
|
|
||||||
//xsns_67_as3935.ino
|
//xsns_67_as3935.ino
|
||||||
#define D_AS3935_GAIN "gain:"
|
#define D_AS3935_GAIN "gain:"
|
||||||
|
@ -916,6 +916,9 @@
|
|||||||
#define D_MANAGE_FILE_SYSTEM "Manage File system"
|
#define D_MANAGE_FILE_SYSTEM "Manage File system"
|
||||||
#define D_FS_SIZE "Size"
|
#define D_FS_SIZE "Size"
|
||||||
#define D_FS_FREE "Free"
|
#define D_FS_FREE "Free"
|
||||||
|
#define D_NEW_FILE "newfile.txt"
|
||||||
|
#define D_CREATE_NEW_FILE "Create and edit new file"
|
||||||
|
#define D_EDIT_FILE "Edit File"
|
||||||
|
|
||||||
//xsns_67_as3935.ino
|
//xsns_67_as3935.ino
|
||||||
#define D_AS3935_GAIN "gain:"
|
#define D_AS3935_GAIN "gain:"
|
||||||
|
@ -916,6 +916,9 @@
|
|||||||
#define D_MANAGE_FILE_SYSTEM "Explorar Archivos"
|
#define D_MANAGE_FILE_SYSTEM "Explorar Archivos"
|
||||||
#define D_FS_SIZE "Tamaño"
|
#define D_FS_SIZE "Tamaño"
|
||||||
#define D_FS_FREE "Libre"
|
#define D_FS_FREE "Libre"
|
||||||
|
#define D_NEW_FILE "newfile.txt"
|
||||||
|
#define D_CREATE_NEW_FILE "Create and edit new file"
|
||||||
|
#define D_EDIT_FILE "Edit File"
|
||||||
|
|
||||||
//xsns_67_as3935.ino
|
//xsns_67_as3935.ino
|
||||||
#define D_AS3935_GAIN "Ganancia:"
|
#define D_AS3935_GAIN "Ganancia:"
|
||||||
|
@ -915,6 +915,9 @@
|
|||||||
#define D_MANAGE_FILE_SYSTEM "Gestion du Système de Fichier"
|
#define D_MANAGE_FILE_SYSTEM "Gestion du Système de Fichier"
|
||||||
#define D_FS_SIZE "Taille"
|
#define D_FS_SIZE "Taille"
|
||||||
#define D_FS_FREE "Libre"
|
#define D_FS_FREE "Libre"
|
||||||
|
#define D_NEW_FILE "nouveau-fichier.txt"
|
||||||
|
#define D_CREATE_NEW_FILE "Créer and modifier un nouveau fichier"
|
||||||
|
#define D_EDIT_FILE "Modification de fichier"
|
||||||
|
|
||||||
//xsns_67_as3935.ino
|
//xsns_67_as3935.ino
|
||||||
#define D_AS3935_GAIN "gain:"
|
#define D_AS3935_GAIN "gain:"
|
||||||
|
@ -916,6 +916,9 @@
|
|||||||
#define D_MANAGE_FILE_SYSTEM "Bestânbehearder"
|
#define D_MANAGE_FILE_SYSTEM "Bestânbehearder"
|
||||||
#define D_FS_SIZE "Grutte"
|
#define D_FS_SIZE "Grutte"
|
||||||
#define D_FS_FREE "Frij"
|
#define D_FS_FREE "Frij"
|
||||||
|
#define D_NEW_FILE "newfile.txt"
|
||||||
|
#define D_CREATE_NEW_FILE "Create and edit new file"
|
||||||
|
#define D_EDIT_FILE "Edit File"
|
||||||
|
|
||||||
//xsns_67_as3935.ino
|
//xsns_67_as3935.ino
|
||||||
#define D_AS3935_GAIN "gain:"
|
#define D_AS3935_GAIN "gain:"
|
||||||
|
@ -916,6 +916,9 @@
|
|||||||
#define D_MANAGE_FILE_SYSTEM "Manage File system"
|
#define D_MANAGE_FILE_SYSTEM "Manage File system"
|
||||||
#define D_FS_SIZE "Size"
|
#define D_FS_SIZE "Size"
|
||||||
#define D_FS_FREE "Free"
|
#define D_FS_FREE "Free"
|
||||||
|
#define D_NEW_FILE "newfile.txt"
|
||||||
|
#define D_CREATE_NEW_FILE "Create and edit new file"
|
||||||
|
#define D_EDIT_FILE "Edit File"
|
||||||
|
|
||||||
//xsns_67_as3935.ino
|
//xsns_67_as3935.ino
|
||||||
#define D_AS3935_GAIN "gain:"
|
#define D_AS3935_GAIN "gain:"
|
||||||
|
@ -916,6 +916,9 @@
|
|||||||
#define D_MANAGE_FILE_SYSTEM "Fájlrendszer kezelése"
|
#define D_MANAGE_FILE_SYSTEM "Fájlrendszer kezelése"
|
||||||
#define D_FS_SIZE "Méret"
|
#define D_FS_SIZE "Méret"
|
||||||
#define D_FS_FREE "Szabad"
|
#define D_FS_FREE "Szabad"
|
||||||
|
#define D_NEW_FILE "newfile.txt"
|
||||||
|
#define D_CREATE_NEW_FILE "Create and edit new file"
|
||||||
|
#define D_EDIT_FILE "Edit File"
|
||||||
|
|
||||||
//xsns_67_as3935.ino
|
//xsns_67_as3935.ino
|
||||||
#define D_AS3935_GAIN "nyereség:"
|
#define D_AS3935_GAIN "nyereség:"
|
||||||
|
@ -916,6 +916,9 @@
|
|||||||
#define D_MANAGE_FILE_SYSTEM "Gestione File system"
|
#define D_MANAGE_FILE_SYSTEM "Gestione File system"
|
||||||
#define D_FS_SIZE "Dimensione"
|
#define D_FS_SIZE "Dimensione"
|
||||||
#define D_FS_FREE "Liberi"
|
#define D_FS_FREE "Liberi"
|
||||||
|
#define D_NEW_FILE "newfile.txt"
|
||||||
|
#define D_CREATE_NEW_FILE "Create and edit new file"
|
||||||
|
#define D_EDIT_FILE "Edit File"
|
||||||
|
|
||||||
//xsns_67_as3935.ino
|
//xsns_67_as3935.ino
|
||||||
#define D_AS3935_GAIN "guadagno:"
|
#define D_AS3935_GAIN "guadagno:"
|
||||||
|
@ -916,6 +916,9 @@
|
|||||||
#define D_MANAGE_FILE_SYSTEM "Manage File system"
|
#define D_MANAGE_FILE_SYSTEM "Manage File system"
|
||||||
#define D_FS_SIZE "Size"
|
#define D_FS_SIZE "Size"
|
||||||
#define D_FS_FREE "Free"
|
#define D_FS_FREE "Free"
|
||||||
|
#define D_NEW_FILE "newfile.txt"
|
||||||
|
#define D_CREATE_NEW_FILE "Create and edit new file"
|
||||||
|
#define D_EDIT_FILE "Edit File"
|
||||||
|
|
||||||
//xsns_67_as3935.ino
|
//xsns_67_as3935.ino
|
||||||
#define D_AS3935_GAIN "gain:"
|
#define D_AS3935_GAIN "gain:"
|
||||||
|
@ -916,6 +916,9 @@
|
|||||||
#define D_MANAGE_FILE_SYSTEM "Bestandsbeheer"
|
#define D_MANAGE_FILE_SYSTEM "Bestandsbeheer"
|
||||||
#define D_FS_SIZE "Grootte"
|
#define D_FS_SIZE "Grootte"
|
||||||
#define D_FS_FREE "Vrij"
|
#define D_FS_FREE "Vrij"
|
||||||
|
#define D_NEW_FILE "newfile.txt"
|
||||||
|
#define D_CREATE_NEW_FILE "Create and edit new file"
|
||||||
|
#define D_EDIT_FILE "Edit File"
|
||||||
|
|
||||||
//xsns_67_as3935.ino
|
//xsns_67_as3935.ino
|
||||||
#define D_AS3935_GAIN "gain:"
|
#define D_AS3935_GAIN "gain:"
|
||||||
|
@ -916,6 +916,9 @@
|
|||||||
#define D_MANAGE_FILE_SYSTEM "Menadżer plików"
|
#define D_MANAGE_FILE_SYSTEM "Menadżer plików"
|
||||||
#define D_FS_SIZE "Rozmiar"
|
#define D_FS_SIZE "Rozmiar"
|
||||||
#define D_FS_FREE "Wolne"
|
#define D_FS_FREE "Wolne"
|
||||||
|
#define D_NEW_FILE "newfile.txt"
|
||||||
|
#define D_CREATE_NEW_FILE "Create and edit new file"
|
||||||
|
#define D_EDIT_FILE "Edit File"
|
||||||
|
|
||||||
//xsns_67_as3935.ino
|
//xsns_67_as3935.ino
|
||||||
#define D_AS3935_GAIN "wejście:"
|
#define D_AS3935_GAIN "wejście:"
|
||||||
|
@ -916,6 +916,9 @@
|
|||||||
#define D_MANAGE_FILE_SYSTEM "Manage File system"
|
#define D_MANAGE_FILE_SYSTEM "Manage File system"
|
||||||
#define D_FS_SIZE "Size"
|
#define D_FS_SIZE "Size"
|
||||||
#define D_FS_FREE "Free"
|
#define D_FS_FREE "Free"
|
||||||
|
#define D_NEW_FILE "newfile.txt"
|
||||||
|
#define D_CREATE_NEW_FILE "Create and edit new file"
|
||||||
|
#define D_EDIT_FILE "Edit File"
|
||||||
|
|
||||||
//xsns_67_as3935.ino
|
//xsns_67_as3935.ino
|
||||||
#define D_AS3935_GAIN "gain:"
|
#define D_AS3935_GAIN "gain:"
|
||||||
|
@ -916,6 +916,9 @@
|
|||||||
#define D_MANAGE_FILE_SYSTEM "Manage File system"
|
#define D_MANAGE_FILE_SYSTEM "Manage File system"
|
||||||
#define D_FS_SIZE "Size"
|
#define D_FS_SIZE "Size"
|
||||||
#define D_FS_FREE "Free"
|
#define D_FS_FREE "Free"
|
||||||
|
#define D_NEW_FILE "newfile.txt"
|
||||||
|
#define D_CREATE_NEW_FILE "Create and edit new file"
|
||||||
|
#define D_EDIT_FILE "Edit File"
|
||||||
|
|
||||||
//xsns_67_as3935.ino
|
//xsns_67_as3935.ino
|
||||||
#define D_AS3935_GAIN "gain:"
|
#define D_AS3935_GAIN "gain:"
|
||||||
|
@ -916,6 +916,9 @@
|
|||||||
#define D_MANAGE_FILE_SYSTEM "Manage File system"
|
#define D_MANAGE_FILE_SYSTEM "Manage File system"
|
||||||
#define D_FS_SIZE "Size"
|
#define D_FS_SIZE "Size"
|
||||||
#define D_FS_FREE "Free"
|
#define D_FS_FREE "Free"
|
||||||
|
#define D_NEW_FILE "newfile.txt"
|
||||||
|
#define D_CREATE_NEW_FILE "Create and edit new file"
|
||||||
|
#define D_EDIT_FILE "Edit File"
|
||||||
|
|
||||||
//xsns_67_as3935.ino
|
//xsns_67_as3935.ino
|
||||||
#define D_AS3935_GAIN "gain:"
|
#define D_AS3935_GAIN "gain:"
|
||||||
|
@ -916,6 +916,9 @@
|
|||||||
#define D_MANAGE_FILE_SYSTEM "Manage File system"
|
#define D_MANAGE_FILE_SYSTEM "Manage File system"
|
||||||
#define D_FS_SIZE "Size"
|
#define D_FS_SIZE "Size"
|
||||||
#define D_FS_FREE "Free"
|
#define D_FS_FREE "Free"
|
||||||
|
#define D_NEW_FILE "newfile.txt"
|
||||||
|
#define D_CREATE_NEW_FILE "Create and edit new file"
|
||||||
|
#define D_EDIT_FILE "Edit File"
|
||||||
|
|
||||||
//xsns_67_as3935.ino
|
//xsns_67_as3935.ino
|
||||||
#define D_AS3935_GAIN "gain:"
|
#define D_AS3935_GAIN "gain:"
|
||||||
|
@ -916,6 +916,9 @@
|
|||||||
#define D_MANAGE_FILE_SYSTEM "Manage File system"
|
#define D_MANAGE_FILE_SYSTEM "Manage File system"
|
||||||
#define D_FS_SIZE "Size"
|
#define D_FS_SIZE "Size"
|
||||||
#define D_FS_FREE "Free"
|
#define D_FS_FREE "Free"
|
||||||
|
#define D_NEW_FILE "newfile.txt"
|
||||||
|
#define D_CREATE_NEW_FILE "Create and edit new file"
|
||||||
|
#define D_EDIT_FILE "Edit File"
|
||||||
|
|
||||||
//xsns_67_as3935.ino
|
//xsns_67_as3935.ino
|
||||||
#define D_AS3935_GAIN "gain:"
|
#define D_AS3935_GAIN "gain:"
|
||||||
|
@ -916,6 +916,9 @@
|
|||||||
#define D_MANAGE_FILE_SYSTEM "Manage File system"
|
#define D_MANAGE_FILE_SYSTEM "Manage File system"
|
||||||
#define D_FS_SIZE "Size"
|
#define D_FS_SIZE "Size"
|
||||||
#define D_FS_FREE "Free"
|
#define D_FS_FREE "Free"
|
||||||
|
#define D_NEW_FILE "newfile.txt"
|
||||||
|
#define D_CREATE_NEW_FILE "Create and edit new file"
|
||||||
|
#define D_EDIT_FILE "Edit File"
|
||||||
|
|
||||||
//xsns_67_as3935.ino
|
//xsns_67_as3935.ino
|
||||||
#define D_AS3935_GAIN "gain:"
|
#define D_AS3935_GAIN "gain:"
|
||||||
|
@ -916,6 +916,9 @@
|
|||||||
#define D_MANAGE_FILE_SYSTEM "Manage File system"
|
#define D_MANAGE_FILE_SYSTEM "Manage File system"
|
||||||
#define D_FS_SIZE "Size"
|
#define D_FS_SIZE "Size"
|
||||||
#define D_FS_FREE "Free"
|
#define D_FS_FREE "Free"
|
||||||
|
#define D_NEW_FILE "newfile.txt"
|
||||||
|
#define D_CREATE_NEW_FILE "Create and edit new file"
|
||||||
|
#define D_EDIT_FILE "Edit File"
|
||||||
|
|
||||||
//xsns_67_as3935.ino
|
//xsns_67_as3935.ino
|
||||||
#define D_AS3935_GAIN "gain:"
|
#define D_AS3935_GAIN "gain:"
|
||||||
|
@ -916,6 +916,9 @@
|
|||||||
#define D_MANAGE_FILE_SYSTEM "Manage File system"
|
#define D_MANAGE_FILE_SYSTEM "Manage File system"
|
||||||
#define D_FS_SIZE "Size"
|
#define D_FS_SIZE "Size"
|
||||||
#define D_FS_FREE "Free"
|
#define D_FS_FREE "Free"
|
||||||
|
#define D_NEW_FILE "newfile.txt"
|
||||||
|
#define D_CREATE_NEW_FILE "Create and edit new file"
|
||||||
|
#define D_EDIT_FILE "Edit File"
|
||||||
|
|
||||||
//xsns_67_as3935.ino
|
//xsns_67_as3935.ino
|
||||||
#define D_AS3935_GAIN "gain:"
|
#define D_AS3935_GAIN "gain:"
|
||||||
|
@ -916,6 +916,9 @@
|
|||||||
#define D_MANAGE_FILE_SYSTEM "Manage File system"
|
#define D_MANAGE_FILE_SYSTEM "Manage File system"
|
||||||
#define D_FS_SIZE "Size"
|
#define D_FS_SIZE "Size"
|
||||||
#define D_FS_FREE "Free"
|
#define D_FS_FREE "Free"
|
||||||
|
#define D_NEW_FILE "newfile.txt"
|
||||||
|
#define D_CREATE_NEW_FILE "Create and edit new file"
|
||||||
|
#define D_EDIT_FILE "Edit File"
|
||||||
|
|
||||||
//xsns_67_as3935.ino
|
//xsns_67_as3935.ino
|
||||||
#define D_AS3935_GAIN "khuếch đại:"
|
#define D_AS3935_GAIN "khuếch đại:"
|
||||||
|
@ -916,6 +916,9 @@
|
|||||||
#define D_MANAGE_FILE_SYSTEM "Manage File system"
|
#define D_MANAGE_FILE_SYSTEM "Manage File system"
|
||||||
#define D_FS_SIZE "Size"
|
#define D_FS_SIZE "Size"
|
||||||
#define D_FS_FREE "Free"
|
#define D_FS_FREE "Free"
|
||||||
|
#define D_NEW_FILE "newfile.txt"
|
||||||
|
#define D_CREATE_NEW_FILE "Create and edit new file"
|
||||||
|
#define D_EDIT_FILE "Edit File"
|
||||||
|
|
||||||
//xsns_67_as3935.ino
|
//xsns_67_as3935.ino
|
||||||
#define D_AS3935_GAIN "gain:"
|
#define D_AS3935_GAIN "gain:"
|
||||||
|
@ -916,6 +916,9 @@
|
|||||||
#define D_MANAGE_FILE_SYSTEM "Manage File system"
|
#define D_MANAGE_FILE_SYSTEM "Manage File system"
|
||||||
#define D_FS_SIZE "Size"
|
#define D_FS_SIZE "Size"
|
||||||
#define D_FS_FREE "Free"
|
#define D_FS_FREE "Free"
|
||||||
|
#define D_NEW_FILE "newfile.txt"
|
||||||
|
#define D_CREATE_NEW_FILE "Create and edit new file"
|
||||||
|
#define D_EDIT_FILE "Edit File"
|
||||||
|
|
||||||
//xsns_67_as3935.ino
|
//xsns_67_as3935.ino
|
||||||
#define D_AS3935_GAIN "gain:"
|
#define D_AS3935_GAIN "gain:"
|
||||||
|
@ -279,7 +279,7 @@ bool TfsFileExists(const char *fname){
|
|||||||
|
|
||||||
bool yes = ffsp->exists(fname);
|
bool yes = ffsp->exists(fname);
|
||||||
if (!yes) {
|
if (!yes) {
|
||||||
AddLog(LOG_LEVEL_DEBUG, PSTR("TFS: File not found"));
|
AddLog(LOG_LEVEL_DEBUG, PSTR("TFS: File '%s' not found"), fname);
|
||||||
}
|
}
|
||||||
return yes;
|
return yes;
|
||||||
}
|
}
|
||||||
@ -320,7 +320,7 @@ bool TfsLoadFile(const char *fname, uint8_t *buf, uint32_t len) {
|
|||||||
|
|
||||||
File file = ffsp->open(fname, "r");
|
File file = ffsp->open(fname, "r");
|
||||||
if (!file) {
|
if (!file) {
|
||||||
AddLog(LOG_LEVEL_INFO, PSTR("TFS: File not found"));
|
AddLog(LOG_LEVEL_INFO, PSTR("TFS: File '%s' not found"), fname);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -564,21 +564,46 @@ const char UFS_FORM_SDC_DIRa[] PROGMEM =
|
|||||||
const char UFS_FORM_SDC_DIRc[] PROGMEM =
|
const char UFS_FORM_SDC_DIRc[] PROGMEM =
|
||||||
"</div>";
|
"</div>";
|
||||||
const char UFS_FORM_FILE_UPGb[] PROGMEM =
|
const char UFS_FORM_FILE_UPGb[] PROGMEM =
|
||||||
|
#ifdef GUI_EDIT_FILE
|
||||||
|
"<form method='get' action='ufse'><input type='hidden' file='" D_NEW_FILE "'>"
|
||||||
|
"<button type='submit'>" D_CREATE_NEW_FILE "</button></form>"
|
||||||
|
#endif
|
||||||
"</fieldset>"
|
"</fieldset>"
|
||||||
"</div>"
|
"</div>"
|
||||||
"<div id='f2' name='f2' style='display:none;text-align:center;'><b>" D_UPLOAD_STARTED " ...</b></div>";
|
"<div id='f2' name='f2' style='display:none;text-align:center;'><b>" D_UPLOAD_STARTED " ...</b></div>";
|
||||||
const char UFS_FORM_SDC_DIRd[] PROGMEM =
|
const char UFS_FORM_SDC_DIRd[] PROGMEM =
|
||||||
"<pre><a href='%s' file='%s'>%s</a></pre>";
|
"<pre><a href='%s' file='%s'>%s</a></pre>";
|
||||||
const char UFS_FORM_SDC_DIRb[] PROGMEM =
|
const char UFS_FORM_SDC_DIRb[] PROGMEM =
|
||||||
"<pre><a href='%s' file='%s'>%s</a> %s %8d %s</pre>";
|
"<pre><a href='%s' file='%s'>%s</a> %s %8d %s %s</pre>";
|
||||||
const char UFS_FORM_SDC_HREF[] PROGMEM =
|
const char UFS_FORM_SDC_HREF[] PROGMEM =
|
||||||
"http://%_I/ufsd?download=%s/%s";
|
"ufsd?download=%s/%s";
|
||||||
|
|
||||||
#ifdef GUI_TRASH_FILE
|
#ifdef GUI_TRASH_FILE
|
||||||
const char UFS_FORM_SDC_HREFdel[] PROGMEM =
|
const char UFS_FORM_SDC_HREFdel[] PROGMEM =
|
||||||
//"<a href=http://%_I/ufsd?delete=%s/%s>🗑</a>";
|
//"<a href=ufsd?delete=%s/%s>🗑</a>"; // 🗑️
|
||||||
"<a href=http://%_I/ufsd?delete=%s/%s>🔥</a>"; // 🔥
|
"<a href=ufsd?delete=%s/%s>🔥</a>"; // 🔥
|
||||||
#endif // GUI_TRASH_FILE
|
#endif // GUI_TRASH_FILE
|
||||||
|
|
||||||
|
#ifdef GUI_EDIT_FILE
|
||||||
|
|
||||||
|
#define FILE_BUFFER_SIZE 1024
|
||||||
|
|
||||||
|
const char UFS_FORM_SDC_HREFedit[] PROGMEM =
|
||||||
|
"<a href=ufse?file=%s/%s>📝</a>"; // 📝
|
||||||
|
|
||||||
|
const char HTTP_EDITOR_FORM_START[] PROGMEM =
|
||||||
|
"<fieldset><legend><b> " D_EDIT_FILE " </b></legend>"
|
||||||
|
"<form>"
|
||||||
|
"<label for='name'>" D_FILE ":</label><input type='text' id='name' name='name' value='%s'><br><hr width='98%%'>"
|
||||||
|
"<textarea id='content' name='content' rows='8' cols='80' style='font-size: 12pt'>";
|
||||||
|
|
||||||
|
const char HTTP_EDITOR_FORM_END[] PROGMEM =
|
||||||
|
"</textarea>"
|
||||||
|
"<button name='save' type='submit' formmethod='post' formenctype='multipart/form-data' formaction='/ufse' class='button bgrn'>" D_SAVE "</button>"
|
||||||
|
"</form></fieldset>";
|
||||||
|
|
||||||
|
#endif // #ifdef GUI_EDIT_FILE
|
||||||
|
|
||||||
void UfsDirectory(void) {
|
void UfsDirectory(void) {
|
||||||
if (!HttpCheckPriviledgedAccess()) { return; }
|
if (!HttpCheckPriviledgedAccess()) { return; }
|
||||||
|
|
||||||
@ -656,7 +681,7 @@ void UfsListDir(char *path, uint8_t depth) {
|
|||||||
if (dir) {
|
if (dir) {
|
||||||
dir.rewindDirectory();
|
dir.rewindDirectory();
|
||||||
if (strlen(path)>1) {
|
if (strlen(path)>1) {
|
||||||
ext_snprintf_P(npath, sizeof(npath), PSTR("http://%_I/ufsd?download=%s"), (uint32_t)WiFi.localIP(), path);
|
ext_snprintf_P(npath, sizeof(npath), PSTR("ufsd?download=%s"), path);
|
||||||
for (uint32_t cnt = strlen(npath) - 1; cnt > 0; cnt--) {
|
for (uint32_t cnt = strlen(npath) - 1; cnt > 0; cnt--) {
|
||||||
if (npath[cnt] == '/') {
|
if (npath[cnt] == '/') {
|
||||||
if (npath[cnt - 1] == '=') {
|
if (npath[cnt - 1] == '=') {
|
||||||
@ -698,7 +723,7 @@ void UfsListDir(char *path, uint8_t depth) {
|
|||||||
|
|
||||||
sprintf(cp, format, ep);
|
sprintf(cp, format, ep);
|
||||||
if (entry.isDirectory()) {
|
if (entry.isDirectory()) {
|
||||||
ext_snprintf_P(npath, sizeof(npath), UFS_FORM_SDC_HREF, (uint32_t)WiFi.localIP(), pp, ep);
|
ext_snprintf_P(npath, sizeof(npath), UFS_FORM_SDC_HREF, pp, ep);
|
||||||
WSContentSend_P(UFS_FORM_SDC_DIRd, npath, ep, name);
|
WSContentSend_P(UFS_FORM_SDC_DIRd, npath, ep, name);
|
||||||
uint8_t plen = strlen(path);
|
uint8_t plen = strlen(path);
|
||||||
if (plen > 1) {
|
if (plen > 1) {
|
||||||
@ -710,13 +735,20 @@ void UfsListDir(char *path, uint8_t depth) {
|
|||||||
} else {
|
} else {
|
||||||
#ifdef GUI_TRASH_FILE
|
#ifdef GUI_TRASH_FILE
|
||||||
char delpath[128];
|
char delpath[128];
|
||||||
ext_snprintf_P(delpath, sizeof(delpath), UFS_FORM_SDC_HREFdel, (uint32_t)WiFi.localIP(), pp, ep);
|
ext_snprintf_P(delpath, sizeof(delpath), UFS_FORM_SDC_HREFdel, pp, ep);
|
||||||
#else
|
#else
|
||||||
char delpath[2];
|
char delpath[2];
|
||||||
delpath[0]=0;
|
delpath[0]=0;
|
||||||
#endif // GUI_TRASH_FILE
|
#endif // GUI_TRASH_FILE
|
||||||
ext_snprintf_P(npath, sizeof(npath), UFS_FORM_SDC_HREF, (uint32_t)WiFi.localIP(), pp, ep);
|
#ifdef GUI_EDIT_FILE
|
||||||
WSContentSend_P(UFS_FORM_SDC_DIRb, npath, ep, name, tstr.c_str(), entry.size(), delpath);
|
char editpath[128];
|
||||||
|
ext_snprintf_P(editpath, sizeof(editpath), UFS_FORM_SDC_HREFedit, pp, ep);
|
||||||
|
#else
|
||||||
|
char editpath[2];
|
||||||
|
editpath[0]=0;
|
||||||
|
#endif // GUI_TRASH_FILE
|
||||||
|
ext_snprintf_P(npath, sizeof(npath), UFS_FORM_SDC_HREF, pp, ep);
|
||||||
|
WSContentSend_P(UFS_FORM_SDC_DIRb, npath, ep, name, tstr.c_str(), entry.size(), delpath, editpath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
entry.close();
|
entry.close();
|
||||||
@ -733,13 +765,13 @@ uint8_t UfsDownloadFile(char *file) {
|
|||||||
File download_file;
|
File download_file;
|
||||||
|
|
||||||
if (!dfsp->exists(file)) {
|
if (!dfsp->exists(file)) {
|
||||||
AddLog(LOG_LEVEL_INFO, PSTR("UFS: File not found"));
|
AddLog(LOG_LEVEL_INFO, PSTR("UFS: File '%s' not found"), file);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
download_file = dfsp->open(file, UFS_FILE_READ);
|
download_file = dfsp->open(file, UFS_FILE_READ);
|
||||||
if (!download_file) {
|
if (!download_file) {
|
||||||
AddLog(LOG_LEVEL_INFO, PSTR("UFS: Could not open file"));
|
AddLog(LOG_LEVEL_INFO, PSTR("UFS: Could not open file '%s'"), file);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -877,6 +909,117 @@ void UfsUploadFileClose(void) {
|
|||||||
ufs_upload_file.close();
|
ufs_upload_file.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//******************************************************************************************
|
||||||
|
// File Editor
|
||||||
|
//******************************************************************************************
|
||||||
|
|
||||||
|
#ifdef GUI_EDIT_FILE
|
||||||
|
|
||||||
|
void UfsEditor(void) {
|
||||||
|
if (!HttpCheckPriviledgedAccess()) { return; }
|
||||||
|
|
||||||
|
AddLog(LOG_LEVEL_DEBUG, PSTR("UFS: UfsEditor GET"));
|
||||||
|
|
||||||
|
String fname;
|
||||||
|
if (Webserver->hasArg(F("file"))) {
|
||||||
|
fname = Webserver->arg(F("file"));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fname = D_NEW_FILE;
|
||||||
|
}
|
||||||
|
if (fname[0] != '/') fname = "/" +fname;
|
||||||
|
|
||||||
|
AddLog(LOG_LEVEL_DEBUG, PSTR("UFS: UfsEditor: file=%s, ffs_type=%d, TfsFileExist=%d"), fname.c_str(), ffs_type, TfsFileExists(fname.c_str()));
|
||||||
|
|
||||||
|
WSContentStart_P(PSTR(D_EDIT_FILE));
|
||||||
|
WSContentSendStyle();
|
||||||
|
WSContentSend_P(HTTP_EDITOR_FORM_START, fname.c_str());
|
||||||
|
|
||||||
|
if (ffs_type && TfsFileExists(fname.c_str())) {
|
||||||
|
File fp = ffsp->open(fname.c_str(), "r");
|
||||||
|
if (!fp) {
|
||||||
|
AddLog(LOG_LEVEL_DEBUG, PSTR("UFS: UfsEditor: file open failed"));
|
||||||
|
WSContentSend_P(D_NEW_FILE);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
uint8_t *buf = (uint8_t*)malloc(FILE_BUFFER_SIZE+1);
|
||||||
|
size_t filelen = fp.size();
|
||||||
|
AddLog(LOG_LEVEL_DEBUG, PSTR("UFS: UfsEditor: file len=%d"), filelen);
|
||||||
|
while ( filelen > 0 ) {
|
||||||
|
size_t l = fp.read(buf, FILE_BUFFER_SIZE);
|
||||||
|
AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("UFS: UfsEditor: read=%d"), l);
|
||||||
|
if (l < 0) break;
|
||||||
|
buf[l] = '\0';
|
||||||
|
WSContentSend_P((const char*)buf);
|
||||||
|
filelen -= l;
|
||||||
|
}
|
||||||
|
fp.close();
|
||||||
|
free(buf);
|
||||||
|
AddLog(LOG_LEVEL_DEBUG, PSTR("UFS: UfsEditor: read done"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
WSContentSend_P(D_NEW_FILE);
|
||||||
|
}
|
||||||
|
|
||||||
|
WSContentSend_P(HTTP_EDITOR_FORM_END);
|
||||||
|
WSContentSend_P(UFS_WEB_DIR, PSTR(D_MANAGE_FILE_SYSTEM));
|
||||||
|
WSContentStop();
|
||||||
|
}
|
||||||
|
|
||||||
|
void UfsEditorUpload(void) {
|
||||||
|
AddLog(LOG_LEVEL_DEBUG, PSTR("UFS: UfsEditor: file upload"));
|
||||||
|
|
||||||
|
if (!HttpCheckPriviledgedAccess()) { return; }
|
||||||
|
|
||||||
|
if (!Webserver->hasArg("name")) {
|
||||||
|
AddLog(LOG_LEVEL_ERROR, PSTR("UFS: UfsEditor: file upload - no filename"));
|
||||||
|
WSSend(400, CT_PLAIN, F("400: Bad request - no filename"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String name = Webserver->arg("name");
|
||||||
|
AddLog(LOG_LEVEL_DEBUG, PSTR("UFS: UfsEditor: file '%s'"), name.c_str());
|
||||||
|
|
||||||
|
if (!Webserver->hasArg("content")) {
|
||||||
|
AddLog(LOG_LEVEL_ERROR, PSTR("UFS: UfsEditor: file upload - no content"));
|
||||||
|
WSSend(400, CT_PLAIN, F("400: Bad request - no content"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String content = Webserver->arg("content");
|
||||||
|
|
||||||
|
if (!ffsp) {
|
||||||
|
Web.upload_error = 1;
|
||||||
|
AddLog(LOG_LEVEL_ERROR, PSTR("UFS: UfsEditor: 507: no storage available"));
|
||||||
|
WSSend(507, CT_PLAIN, F("507: no storage available"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
File fp = ffsp->open(name.c_str(), "w");
|
||||||
|
if(!fp) {
|
||||||
|
Web.upload_error = 1;
|
||||||
|
AddLog(LOG_LEVEL_ERROR, PSTR("UFS: UfsEditor: 400: invalid file name '%s'"), name.c_str());
|
||||||
|
WSSend(400, CT_PLAIN, F("400: bad request - invalid filename"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*content.c_str()) {
|
||||||
|
content.replace("\r\n", "\n");
|
||||||
|
content.replace("\r", "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!fp.print(content)) {
|
||||||
|
AddLog(LOG_LEVEL_ERROR, PSTR("UFS: UfsEditor: write error on '%s'"), name.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
fp.close();
|
||||||
|
|
||||||
|
Webserver->sendHeader(F("Location"),F("/ufsu"));
|
||||||
|
Webserver->send(303);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // #ifdef GUI_EDIT_FILE
|
||||||
|
|
||||||
#endif // USE_WEBSERVER
|
#endif // USE_WEBSERVER
|
||||||
|
|
||||||
/*********************************************************************************************\
|
/*********************************************************************************************\
|
||||||
@ -916,6 +1059,10 @@ bool Xdrv50(uint8_t function) {
|
|||||||
Webserver->on("/ufsd", UfsDirectory);
|
Webserver->on("/ufsd", UfsDirectory);
|
||||||
Webserver->on("/ufsu", HTTP_GET, UfsDirectory);
|
Webserver->on("/ufsu", HTTP_GET, UfsDirectory);
|
||||||
Webserver->on("/ufsu", HTTP_POST,[](){Webserver->sendHeader(F("Location"),F("/ufsu"));Webserver->send(303);}, HandleUploadLoop);
|
Webserver->on("/ufsu", HTTP_POST,[](){Webserver->sendHeader(F("Location"),F("/ufsu"));Webserver->send(303);}, HandleUploadLoop);
|
||||||
|
#ifdef GUI_EDIT_FILE
|
||||||
|
Webserver->on("/ufse", HTTP_GET, UfsEditor);
|
||||||
|
Webserver->on("/ufse", HTTP_POST, UfsEditorUpload);
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
#endif // USE_WEBSERVER
|
#endif // USE_WEBSERVER
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user