diff --git a/src/AutoConnect.cpp b/src/AutoConnect.cpp index 669f727..33efcb6 100644 --- a/src/AutoConnect.cpp +++ b/src/AutoConnect.cpp @@ -311,6 +311,16 @@ bool AutoConnect::_configSTA(const IPAddress& ip, const IPAddress& gateway, cons return rc; } +String AutoConnect::_getBootUri() +{ + if (_apConfig.bootUri == AC_ONBOOTURI_ROOT) + return String(AUTOCONNECT_URI); + else if (_apConfig.bootUri == AC_ONBOOTURI_HOME) + return _apConfig.homeUri.length() > 0 ? _apConfig.homeUri : String("/"); + else + return _emptyString; +} + /** * Obtains the currently established AP connection to determine if the * station configuration needs to run before the first WiFi.begin. @@ -675,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() + 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 1f34f02..e275dbe 100644 --- a/src/AutoConnect.h +++ b/src/AutoConnect.h @@ -224,6 +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(); bool _getConfigSTA(station_config_t* config); void _startWebServer(void); void _startDNSServer(void); diff --git a/src/AutoConnectPage.cpp b/src/AutoConnectPage.cpp index f69b99a..3afa18e 100644 --- a/src/AutoConnectPage.cpp +++ b/src/AutoConnectPage.cpp @@ -550,7 +550,7 @@ const char AutoConnect::_ELM_MENU_PRE[] PROGMEM = { "