diff --git a/WiFiManager.cpp b/WiFiManager.cpp index 416e126..79a25ab 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -250,6 +250,7 @@ void WiFiManager::setupConfigPortal() { server->on("/r", std::bind(&WiFiManager::handleReset, this)); server->on("/exit", std::bind(&WiFiManager::handleExit, this)); server->on("/erase", std::bind(&WiFiManager::handleErase, this)); + server->on("/status", std::bind(&WiFiManager::handleWiFiStatus, this)); //server->on("/fwlink", std::bind(&WiFiManager::handleRoot, this)); //Microsoft captive portal. Maybe not needed. Might be handled by notFound handler. server->onNotFound (std::bind(&WiFiManager::handleNotFound, this)); @@ -827,6 +828,15 @@ String WiFiManager::getParamOut(){ return page; } +void WiFiManager::handleWiFiStatus(){ + DEBUG_WM(F("<- HTTP WiFi status ")); + String page; + // String page = "{\"result\":true,\"count\":1}"; + page = FPSTR(HTTP_JS); + server->sendHeader("Content-Length", String(page.length())); + server->send(200, "text/html", page); +} + /** * HTTPD CALLBACK save form and redirect to WLAN config page again */ diff --git a/WiFiManager.h b/WiFiManager.h index 577f492..6f7be6d 100644 --- a/WiFiManager.h +++ b/WiFiManager.h @@ -188,6 +188,7 @@ class WiFiManager void handleNotFound(); void handleExit(); void handleErase(); + void handleWiFiStatus(); boolean captivePortal(); boolean configPortalHasTimeout(); diff --git a/strings_en.h b/strings_en.h index 15c9a1e..9ec0541 100644 --- a/strings_en.h +++ b/strings_en.h @@ -68,4 +68,27 @@ const char HTTP_HELP[] PROGMEM = "" "

More information about WiFiManager at https://github.com/tzapu/WiFiManager."; +const char HTTP_JS[] PROGMEM = +""; #endif \ No newline at end of file