mirror of
https://github.com/letscontrolit/ESPEasy.git
synced 2026-09-12 09:36:59 +00:00
ESP32's WebServer class has the same name as our global object had. So you could only define it in ESPEasy.ino. Now it is renamed to `web_server` and now ESP32 and ESP8266 will happily build with the global object defined in .h/.cpp.
44 lines
988 B
Arduino
44 lines
988 B
Arduino
|
|
#ifdef WEBSERVER_DOWNLOAD
|
|
|
|
// ********************************************************************************
|
|
// Web Interface download page
|
|
// ********************************************************************************
|
|
void handle_download()
|
|
{
|
|
checkRAM(F("handle_download"));
|
|
|
|
if (!isLoggedIn()) { return; }
|
|
navMenuIndex = MENU_INDEX_TOOLS;
|
|
|
|
// TXBuffer.startStream();
|
|
// sendHeadandTail_stdtemplate();
|
|
|
|
|
|
fs::File dataFile = tryOpenFile(F(FILE_CONFIG), "r");
|
|
|
|
if (!dataFile) {
|
|
return;
|
|
}
|
|
|
|
String str = F("attachment; filename=config_");
|
|
str += Settings.Name;
|
|
str += "_U";
|
|
str += Settings.Unit;
|
|
str += F("_Build");
|
|
str += BUILD;
|
|
str += '_';
|
|
|
|
if (node_time.systemTimePresent())
|
|
{
|
|
str += node_time.getDateTimeString('\0', '\0', '\0');
|
|
}
|
|
str += F(".dat");
|
|
|
|
web_server.sendHeader(F("Content-Disposition"), str);
|
|
web_server.streamFile(dataFile, F("application/octet-stream"));
|
|
dataFile.close();
|
|
}
|
|
|
|
#endif // ifdef WEBSERVER_DOWNLOAD
|