mirror of
https://github.com/s00500/ESPUI.git
synced 2024-11-23 05:40:54 +00:00
Changes per suggestions by maintainer (Lukas Bachschwell).
This commit is contained in:
parent
90ba90a717
commit
79b9acf9f4
@ -646,10 +646,12 @@ _There are many issues with the graph component currently and work is ongoing. C
|
||||
|
||||
### Captive Portal
|
||||
|
||||
You can set ESPUI to redirect all unknown URLs it is asked for to the 'root' the local HTTP server instead of responding with an HTTP code 404. This turns it into a simple 'captive portal'. Note you must also set up the ESP to be a DNS server that responds to all DNS requests with the IP address of the ESP for this to be effective and this is only useful when the ESP is acting as a WiFi hotspot in AP mode. All the example sketches will work as captive portals if not connected to a local WiFi network as a station.
|
||||
ESPUI will redirect all unknown URLs it is asked for to the 'root' of the local HTTP server instead of responding with an HTTP code 404. This makes it act as a simple 'captive portal'. Note you must also set up the ESP to be a DNS server that responds to all DNS requests with the IP address of the ESP. This only effective when the ESP is acting as a WiFi hotspot in AP mode and assigning itself as the DNS server to connected clients.
|
||||
|
||||
All the example sketches include the DNS related code and will work as captive portals when used as a hotspot. In the event you wish to disable this feature you can do so by removing the DNS server code and adding the code below.
|
||||
|
||||
```
|
||||
ESPUI.captivePortal == true;
|
||||
ESPUI.captivePortal = false;
|
||||
```
|
||||
|
||||
|
||||
|
@ -199,7 +199,7 @@ void setup(void)
|
||||
if (WiFi.status() != WL_CONNECTED)
|
||||
{
|
||||
Serial.print("\n\nCreating hotspot");
|
||||
ESPUI.captivePortal = true; //Configure ESPUI to be a captive portal only if the ESP is acting as a hotspot
|
||||
|
||||
WiFi.mode(WIFI_AP);
|
||||
delay(100);
|
||||
WiFi.softAPConfig(apIP, apIP, IPAddress(255, 255, 255, 0));
|
||||
|
@ -189,7 +189,7 @@ void setup(void)
|
||||
if (WiFi.status() != WL_CONNECTED)
|
||||
{
|
||||
Serial.print("\n\nCreating hotspot");
|
||||
ESPUI.captivePortal = true; //Configure ESPUI to be a captive portal only if the ESP is acting as a hotspot
|
||||
|
||||
WiFi.mode(WIFI_AP);
|
||||
delay(100);
|
||||
WiFi.softAPConfig(apIP, apIP, IPAddress(255, 255, 255, 0));
|
||||
|
@ -197,7 +197,7 @@ void setup(void)
|
||||
if (WiFi.status() != WL_CONNECTED)
|
||||
{
|
||||
Serial.print("\n\nCreating hotspot");
|
||||
ESPUI.captivePortal = true; //Configure ESPUI to be a captive portal only if the ESP is acting as a hotspot
|
||||
|
||||
WiFi.mode(WIFI_AP);
|
||||
delay(100);
|
||||
WiFi.softAPConfig(apIP, apIP, IPAddress(255, 255, 255, 0));
|
||||
|
@ -25,7 +25,7 @@ beginLITTLEFS KEYWORD2
|
||||
print KEYWORD2
|
||||
updateSwitcher KEYWORD2
|
||||
updateSlider KEYWORD2
|
||||
captivePortal KEYWORD2
|
||||
captivePortal LITERAL1
|
||||
|
||||
#######################################
|
||||
# Instances (KEYWORD2)
|
||||
|
@ -1352,7 +1352,7 @@ void ESPUIClass::beginLITTLEFS(const char* _title, const char* username, const c
|
||||
});
|
||||
|
||||
server->onNotFound([this](AsyncWebServerRequest* request) {
|
||||
if(captivePortal == true)
|
||||
if(captivePortal)
|
||||
{
|
||||
request->redirect("/");
|
||||
}
|
||||
@ -1506,7 +1506,7 @@ void ESPUIClass::begin(const char* _title, const char* username, const char* pas
|
||||
});
|
||||
|
||||
server->onNotFound([this](AsyncWebServerRequest* request) {
|
||||
if(captivePortal == true)
|
||||
if(captivePortal)
|
||||
{
|
||||
request->redirect("/");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user