diff --git a/src/AutoConnect.cpp b/src/AutoConnect.cpp index 48c5788..33efcb6 100644 --- a/src/AutoConnect.cpp +++ b/src/AutoConnect.cpp @@ -311,13 +311,8 @@ bool AutoConnect::_configSTA(const IPAddress& ip, const IPAddress& gateway, cons return rc; } -/** - * Get URI to redirect at boot. It uses the URI according to the - * AutoConnectConfig::bootUti setting with the AutoConnectConfig::homeUri - * as the boot path. - * @return the boot uri. - */ -String AutoConnect::_getBootUri(void) const { +String AutoConnect::_getBootUri() +{ if (_apConfig.bootUri == AC_ONBOOTURI_ROOT) return String(AUTOCONNECT_URI); else if (_apConfig.bootUri == AC_ONBOOTURI_HOME) @@ -690,7 +685,7 @@ bool AutoConnect::_captivePortal(void) { String hostHeader = _webServer->hostHeader(); if (!_isIP(hostHeader) && (hostHeader != WiFi.localIP().toString()) && (!hostHeader.endsWith(F(".local")))) { AC_DBG("Detected application, %s, %s\n", hostHeader.c_str(), WiFi.localIP().toString().c_str()); - String location = String(F("http://")) + _webServer->client().localIP().toString() + (_apConfig.bootUri == AC_ONBOOTURI_PORTAL ? _getBootUri() : String(AUTOCONNECT_URI)); + String location = String(F("http://")) + _webServer->client().localIP().toString() + _getBootUri(); _webServer->sendHeader(String(F("Location")), location, true); _webServer->send(302, String(F("text/plain")), _emptyString); _webServer->client().flush(); diff --git a/src/AutoConnect.h b/src/AutoConnect.h index 6c1d005..e275dbe 100644 --- a/src/AutoConnect.h +++ b/src/AutoConnect.h @@ -47,8 +47,7 @@ typedef enum AC_SAVECREDENTIAL { typedef enum AC_ONBOOTURI { AC_ONBOOTURI_ROOT, - AC_ONBOOTURI_HOME, - AC_ONBOOTURI_PORTAL + AC_ONBOOTURI_HOME } AC_ONBOOTURI_t; class AutoConnectConfig { @@ -225,7 +224,7 @@ class AutoConnect { } AC_STARECONNECT_t; bool _config(void); bool _configSTA(const IPAddress& ip, const IPAddress& gateway, const IPAddress& netmask, const IPAddress& dns1, const IPAddress& dns2); - String _getBootUri(void) const; + String _getBootUri(); bool _getConfigSTA(station_config_t* config); void _startWebServer(void); void _startDNSServer(void);