Skip to content

Commit

Permalink
20240525.1
Browse files Browse the repository at this point in the history
- Fix mDNS error. Thanks @chrizy66 and @charrus 🚀 #30
- Keep working on cz.json. Thanks @leroyloren 🚀 #31
- Add Discord community link
  • Loading branch information
xyzroe committed May 25, 2024
1 parent c776fcc commit 3356c59
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/web.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ extern struct MqttConfigStruct mqttCfg;

extern LEDControl ledControl;

extern IPAddress apIP;

bool wifiWebSetupInProgress = false;

bool eventOK = false;
Expand Down Expand Up @@ -241,21 +243,25 @@ void initWebServer()
LOGD("done");
}

IPAddress apIP2(192, 168, 1, 1);
// IPAddress apIP2(192, 168, 1, 1);

bool captivePortal()
{
IPAddress ip;
if (!ip.fromString(serverWeb.hostHeader()))
if (vars.apStarted)
{
LOGD("Request redirected to captive portal");
serverWeb.sendHeader("Location", String("http://") + apIP2.toString(), true);
serverWeb.send(302, "text/plain", "");
serverWeb.client().stop();
return true;
IPAddress ip;
if (!ip.fromString(serverWeb.hostHeader()))
{
LOGD("Request redirected to captive portal");
serverWeb.sendHeader("Location", String("http://") + apIP.toString(), true);
serverWeb.send(302, "text/plain", "");
serverWeb.client().stop();
return true;
}
}
return false;
}

/*
void handleNotFound()
{
Expand Down

0 comments on commit 3356c59

Please sign in to comment.