From 3efb536629b5750275a64afe92b1a1c0b4a8a7de Mon Sep 17 00:00:00 2001 From: tablatronix <807787+tablatronix@users.noreply.github.com> Date: Fri, 17 Nov 2023 19:37:44 -0600 Subject: [PATCH] disable captiveportal for webportal --- WiFiManager.cpp | 2 +- WiFiManager.h | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/WiFiManager.cpp b/WiFiManager.cpp index 6bc96708..efeb83e5 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -2422,7 +2422,7 @@ void WiFiManager::handleNotFound() { */ boolean WiFiManager::captivePortal() { - if(!_enableCaptivePortal) return false; // skip redirections, @todo maybe allow redirection even when no cp ? might be useful + if(!_enableCaptivePortal || !configPortalActive) return false; // skip redirections if cp not enabled or not in ap mode String serverLoc = toStringIp(server->client().localIP()); diff --git a/WiFiManager.h b/WiFiManager.h index f5c7ae3d..c4c8be55 100644 --- a/WiFiManager.h +++ b/WiFiManager.h @@ -767,8 +767,15 @@ class WiFiManager boolean abort = false; boolean reset = false; boolean configPortalActive = false; + + + // these are state flags for portal mode, we are either in webportal mode(STA) or configportal mode(AP) + // these are mutually exclusive as STA+AP mode is not supported due to channel restrictions and stability + // if we decide to support this, these checks will need to be replaced with something client aware to check if client origin is ap or web + // These state checks are critical and used for internal function checks boolean webPortalActive = false; boolean portalTimeoutResult = false; + boolean portalAbortResult = false; boolean storeSTAmode = true; // option store persistent STA mode in connectwifi int timer = 0; // timer for debug throttle for numclients, and portal timeout messages