mirror of
https://github.com/me-no-dev/ESPAsyncWebServer.git
synced 2025-10-01 08:40:54 +02:00
Added an authentication define to SmartSwitch.ino to be able to activate on all static pages.
Same credentials as the /edit
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
 
|
 
|
||||||
|
|
||||||
## SmartSwitch
|
## SmartSwitch
|
||||||
* Based on ESP_AsyncFSBrowser
|
* Remote Temperature Control application with schedule (example car block heater or battery charger)
|
||||||
* Temperature Control for heater with schedule for car block heater or battery charger
|
* Based on the ESP_AsyncFSBrowser example
|
||||||
* Wide browser compatibility, no extra server-side needed.
|
* Wide browser compatibility, no extra server-side needed.
|
||||||
* HTTP server and WebSocket, single port
|
* HTTP server and WebSocket, single port
|
||||||
* Standalone, no JS dependencies for the browser from Internet (I hope)
|
* Standalone, no JS dependencies for the browser from Internet (I hope), ace editor included
|
||||||
* Added ESPAsyncWiFiManager
|
* Added ESPAsyncWiFiManager
|
||||||
* Real Time (NTP) w/ Time Zones
|
* Real Time (NTP) w/ Time Zones
|
||||||
* Memorized settings to EEPROM
|
* Memorized settings to EEPROM
|
||||||
|
@@ -13,7 +13,8 @@ Multiple clients can be connected at same time, they see each other requests
|
|||||||
Use latest ESP core lib (from github)
|
Use latest ESP core lib (from github)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define USE_WFM // to use ESPAsyncWiFiManager
|
#define USE_WFM // to use ESPAsyncWiFiManager
|
||||||
|
#define USE_AUTH // .setAuthentication for all static
|
||||||
|
|
||||||
#include <ArduinoOTA.h>
|
#include <ArduinoOTA.h>
|
||||||
#ifdef ESP32
|
#ifdef ESP32
|
||||||
@@ -449,8 +450,11 @@ void setup(){
|
|||||||
request->send(200, "text/plain","Erasing WiFi data ...");
|
request->send(200, "text/plain","Erasing WiFi data ...");
|
||||||
});
|
});
|
||||||
|
|
||||||
server.serveStatic("/", SPIFFS, "/").setDefaultFile("index.htm"); //.setAuthentication(http_username,http_password); //append or remove auth part
|
#ifdef USE_AUTH
|
||||||
|
server.serveStatic("/", SPIFFS, "/").setDefaultFile("index.htm").setAuthentication(http_username,http_password);
|
||||||
|
#else
|
||||||
|
server.serveStatic("/", SPIFFS, "/").setDefaultFile("index.htm");
|
||||||
|
#endif
|
||||||
|
|
||||||
server.onNotFound([](AsyncWebServerRequest *request){ // nothing known
|
server.onNotFound([](AsyncWebServerRequest *request){ // nothing known
|
||||||
Serial.print(F("NOT_FOUND: "));
|
Serial.print(F("NOT_FOUND: "));
|
||||||
|
Reference in New Issue
Block a user