mirror of
https://git.mirrors.martin98.com/https://github.com/luc-github/ESP3D.git
synced 2025-08-13 22:55:53 +08:00
Allow to disable FW web update when compiling
New compilation directive to enable/disable feature //WEB_UPDATE_FEATURE: allow to flash fw using web UI #define WEB_UPDATE_FEATURE
This commit is contained in:
parent
70228adb3d
commit
75ebd04d12
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
|||||||
Thumbs.db
|
Thumbs.db
|
||||||
|
*.orig
|
@ -435,5 +435,11 @@ void CONFIG::print_config()
|
|||||||
Serial.println(F("Enabled"));
|
Serial.println(F("Enabled"));
|
||||||
#else
|
#else
|
||||||
Serial.println(F("Disabled"));
|
Serial.println(F("Disabled"));
|
||||||
|
#endif
|
||||||
|
Serial.print(F("Web update: "));
|
||||||
|
#ifdef WEB_UPDATE_FEATURE
|
||||||
|
Serial.println(F("Enabled"));
|
||||||
|
#else
|
||||||
|
Serial.println(F("Disabled"));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,9 @@
|
|||||||
//AUTHENTICATION_FEATURE: protect pages by login password
|
//AUTHENTICATION_FEATURE: protect pages by login password
|
||||||
#define AUTHENTICATION_FEATURE
|
#define AUTHENTICATION_FEATURE
|
||||||
|
|
||||||
|
//WEB_UPDATE_FEATURE: allow to flash fw using web UI
|
||||||
|
#define WEB_UPDATE_FEATURE
|
||||||
|
|
||||||
#ifndef CONFIG_h
|
#ifndef CONFIG_h
|
||||||
#define CONFIG_h
|
#define CONFIG_h
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ $SUCCESS_MSG$
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel">
|
<div class="panel" style="$WEB_UPDATE_VISIBILITY$">
|
||||||
<div class="panel-heading">Firmware Update</div>
|
<div class="panel-heading">Firmware Update</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<table><tr>
|
<table><tr>
|
||||||
|
@ -204,6 +204,7 @@ const char KEY_RETURN [] PROGMEM = "$RETURN$";
|
|||||||
const char VALUE_CHANGE_PASSWORD [] PROGMEM = "Change Password";
|
const char VALUE_CHANGE_PASSWORD [] PROGMEM = "Change Password";
|
||||||
const char MISSING_DATA [] PROGMEM = "Error: Missing data";
|
const char MISSING_DATA [] PROGMEM = "Error: Missing data";
|
||||||
const char EEPROM_NOWRITE [] PROGMEM = "Error: Cannot write to EEPROM";
|
const char EEPROM_NOWRITE [] PROGMEM = "Error: Cannot write to EEPROM";
|
||||||
|
const char KEY_WEB_UPDATE [] PROGMEM = "$WEB_UPDATE_VISIBILITY$";
|
||||||
|
|
||||||
bool WEBINTERFACE_CLASS::isHostnameValid(const char * hostname)
|
bool WEBINTERFACE_CLASS::isHostnameValid(const char * hostname)
|
||||||
{
|
{
|
||||||
@ -1183,7 +1184,12 @@ void handle_web_interface_configSys()
|
|||||||
{
|
{
|
||||||
ProcessNoAlert(KeysList, ValuesList);
|
ProcessNoAlert(KeysList, ValuesList);
|
||||||
}
|
}
|
||||||
|
KeysList.add(FPSTR(KEY_WEB_UPDATE));
|
||||||
|
#ifdef WEB_UPDATE_FEATURE
|
||||||
|
ValuesList.add(FPSTR(VALUE_ITEM_VISIBLE));
|
||||||
|
#else
|
||||||
|
ValuesList.add(FPSTR(VALUE_ITEM_HIDDEN));
|
||||||
|
#endif
|
||||||
//Firmware and Free Mem, at the end to reflect situation
|
//Firmware and Free Mem, at the end to reflect situation
|
||||||
GetFreeMem(KeysList, ValuesList);
|
GetFreeMem(KeysList, ValuesList);
|
||||||
|
|
||||||
@ -2378,6 +2384,7 @@ void SPIFFSFileupload()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef WEB_UPDATE_FEATURE
|
||||||
void WebUpdateUpload()
|
void WebUpdateUpload()
|
||||||
{
|
{
|
||||||
HTTPUpload& upload = (web_interface->WebServer).upload();
|
HTTPUpload& upload = (web_interface->WebServer).upload();
|
||||||
@ -2404,7 +2411,6 @@ void WebUpdateUpload()
|
|||||||
yield();
|
yield();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void handleUpdate()
|
void handleUpdate()
|
||||||
{
|
{
|
||||||
web_interface->is_authenticated();
|
web_interface->is_authenticated();
|
||||||
@ -2419,6 +2425,7 @@ void handleUpdate()
|
|||||||
web_interface->restartmodule=true;
|
web_interface->restartmodule=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void handleFileList()
|
void handleFileList()
|
||||||
{
|
{
|
||||||
@ -2679,6 +2686,7 @@ void handle_login()
|
|||||||
KeysList.clear();
|
KeysList.clear();
|
||||||
ValuesList.clear();
|
ValuesList.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void handle_restart()
|
void handle_restart()
|
||||||
{
|
{
|
||||||
if (SPIFFS.exists("/restart.tpl")) {
|
if (SPIFFS.exists("/restart.tpl")) {
|
||||||
@ -2746,7 +2754,6 @@ void handle_web_command()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef SSDP_FEATURE
|
#ifdef SSDP_FEATURE
|
||||||
void handle_SSDP()
|
void handle_SSDP()
|
||||||
{
|
{
|
||||||
@ -2791,7 +2798,6 @@ void WEBINTERFACE_CLASS::urldecode( String & dst, const char *src)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//constructor
|
//constructor
|
||||||
WEBINTERFACE_CLASS::WEBINTERFACE_CLASS (int port):WebServer(port)
|
WEBINTERFACE_CLASS::WEBINTERFACE_CLASS (int port):WebServer(port)
|
||||||
{
|
{
|
||||||
@ -2805,7 +2811,9 @@ WEBINTERFACE_CLASS::WEBINTERFACE_CLASS (int port):WebServer(port)
|
|||||||
WebServer.on("/PRINTER",HTTP_ANY, handle_web_interface_printer);
|
WebServer.on("/PRINTER",HTTP_ANY, handle_web_interface_printer);
|
||||||
WebServer.on("/CMD",HTTP_ANY, handle_web_command);
|
WebServer.on("/CMD",HTTP_ANY, handle_web_command);
|
||||||
WebServer.on("/RESTART",HTTP_GET, handle_restart);
|
WebServer.on("/RESTART",HTTP_GET, handle_restart);
|
||||||
|
#ifdef WEB_UPDATE_FEATURE
|
||||||
WebServer.on("/UPDATE",HTTP_ANY, handleUpdate,WebUpdateUpload);
|
WebServer.on("/UPDATE",HTTP_ANY, handleUpdate,WebUpdateUpload);
|
||||||
|
#endif
|
||||||
WebServer.on("/FILES", HTTP_ANY, handleFileList,SPIFFSFileupload);
|
WebServer.on("/FILES", HTTP_ANY, handleFileList,SPIFFSFileupload);
|
||||||
WebServer.on("/SDFILES", HTTP_ANY, handleSDFileList);
|
WebServer.on("/SDFILES", HTTP_ANY, handleSDFileList);
|
||||||
WebServer.on("/LOGIN", HTTP_ANY, handle_login);
|
WebServer.on("/LOGIN", HTTP_ANY, handle_login);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user