No IP address shown when in AP moode (#17599) (#17619)

This commit is contained in:
s-hadinger 2023-01-06 14:03:16 +01:00 committed by GitHub
parent 7d94a2c89e
commit 33d6dbed3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 1 deletions

View File

@ -19,6 +19,7 @@ All notable changes to this project will be documented in this file.
### Fixed
- Energy dummy switched voltage and power regression from v12.2.0.2
- Orno WE517 modbus serial config 8E1 setting (#17545)
- No IP address shown when in AP moode (#17599)
### Removed

View File

@ -761,6 +761,10 @@ bool WifiGetIP(IPAddress *ip) {
if (ip != nullptr) { *ip = WiFi.localIP(); }
return true;
}
if ((uint32_t)WiFi.softAPIP() != 0) {
if (ip != nullptr) { *ip = WiFi.softAPIP(); }
return true;
}
IPAddress lip;
if (WifiGetIPv6(&lip)) {
if (ip != nullptr) { *ip = lip; }

View File

@ -3209,7 +3209,7 @@ bool CaptivePortal(void)
if ((WifiIsInManagerMode()) && !ValidIpAddress(Webserver->hostHeader().c_str())) {
AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_REDIRECTED));
Webserver->sendHeader(F("Location"), String(F("http://")) + Webserver->client().localIP().toString(), true);
Webserver->sendHeader(F("Location"), String(F("http://")) + IPGetListeningAddressStr(), true);
WSSend(302, CT_PLAIN, ""); // Empty content inhibits Content-length header so we have to close the socket ourselves.
Webserver->client().stop(); // Stop is needed because we sent no content length
return true;