diff --git a/src/WebApi_solar_charger.cpp b/src/WebApi_solar_charger.cpp index 6096f316a..0e6849d95 100644 --- a/src/WebApi_solar_charger.cpp +++ b/src/WebApi_solar_charger.cpp @@ -18,14 +18,13 @@ void WebApiSolarChargerlass::init(AsyncWebServer& server, Scheduler& scheduler) _server = &server; - _server->on("/api/solarcharger/status", HTTP_GET, std::bind(&WebApiSolarChargerlass::onStatus, this, _1)); _server->on("/api/solarcharger/config", HTTP_GET, std::bind(&WebApiSolarChargerlass::onAdminGet, this, _1)); _server->on("/api/solarcharger/config", HTTP_POST, std::bind(&WebApiSolarChargerlass::onAdminPost, this, _1)); } -void WebApiSolarChargerlass::onStatus(AsyncWebServerRequest* request) +void WebApiSolarChargerlass::onAdminGet(AsyncWebServerRequest* request) { - if (!WebApi.checkCredentialsReadonly(request)) { + if (!WebApi.checkCredentials(request)) { return; } @@ -38,15 +37,6 @@ void WebApiSolarChargerlass::onStatus(AsyncWebServerRequest* request) WebApi.sendJsonResponse(request, response, __FUNCTION__, __LINE__); } -void WebApiSolarChargerlass::onAdminGet(AsyncWebServerRequest* request) -{ - if (!WebApi.checkCredentials(request)) { - return; - } - - onStatus(request); -} - void WebApiSolarChargerlass::onAdminPost(AsyncWebServerRequest* request) { if (!WebApi.checkCredentials(request)) { diff --git a/src/WebApi_ws_solarcharger_live.cpp b/src/WebApi_ws_solarcharger_live.cpp index dbb71ad46..83ef0b329 100644 --- a/src/WebApi_ws_solarcharger_live.cpp +++ b/src/WebApi_ws_solarcharger_live.cpp @@ -283,10 +283,10 @@ void WebApiWsSolarChargerLiveClass::onLivedataStatus(AsyncWebServerRequest* requ WebApi.sendJsonResponse(request, response, __FUNCTION__, __LINE__); } catch (std::bad_alloc& bad_alloc) { - MessageOutput.printf("Calling /api/solarcharger/status has temporarily run out of resources. Reason: \"%s\".\r\n", bad_alloc.what()); + MessageOutput.printf("Calling /api/solarchargerlivedata/status has temporarily run out of resources. Reason: \"%s\".\r\n", bad_alloc.what()); WebApi.sendTooManyRequests(request); } catch (const std::exception& exc) { - MessageOutput.printf("Unknown exception in /api/solarcharger/status. Reason: \"%s\".\r\n", exc.what()); + MessageOutput.printf("Unknown exception in /api/solarchargerlivedata/status. Reason: \"%s\".\r\n", exc.what()); WebApi.sendTooManyRequests(request); } }