mirror of
https://git.mirrors.martin98.com/https://github.com/luc-github/ESP3D.git
synced 2025-08-12 19:59:11 +08:00
Add index.html/index.html.gz as default /
if no file redirect to /HOME
This commit is contained in:
parent
104b6c8c55
commit
a40192fe67
Binary file not shown.
@ -593,6 +593,20 @@ void WEBINTERFACE_CLASS::ProcessNoAlert(STORESTRINGS_CLASS & KeysList, STORESTRI
|
|||||||
void handle_web_interface_root()
|
void handle_web_interface_root()
|
||||||
{
|
{
|
||||||
static const char HOME_PAGE [] PROGMEM = "HTTP/1.1 301 OK\r\nLocation: /HOME\r\nCache-Control: no-cache\r\n\r\n";
|
static const char HOME_PAGE [] PROGMEM = "HTTP/1.1 301 OK\r\nLocation: /HOME\r\nCache-Control: no-cache\r\n\r\n";
|
||||||
|
String path = "/index.html";
|
||||||
|
String contentType = web_interface->getContentType(path);
|
||||||
|
String pathWithGz = path + ".gz";
|
||||||
|
//if have a index.html or gzip version this is default root page
|
||||||
|
if(SPIFFS.exists(pathWithGz) || SPIFFS.exists(path)) {
|
||||||
|
if(SPIFFS.exists(pathWithGz)) {
|
||||||
|
path = pathWithGz;
|
||||||
|
}
|
||||||
|
FSFILE file = SPIFFS.open(path, "r");
|
||||||
|
web_interface->WebServer.streamFile(file, contentType);
|
||||||
|
file.close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//if no lets launch the /HOME
|
||||||
web_interface->WebServer.sendContent_P(HOME_PAGE);
|
web_interface->WebServer.sendContent_P(HOME_PAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user