Skip to content

Commit

Permalink
remove unused endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasBoehm committed Nov 21, 2024
1 parent 5f0c0b3 commit 706bca2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
14 changes: 2 additions & 12 deletions src/WebApi_solar_charger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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)) {
Expand Down
4 changes: 2 additions & 2 deletions src/WebApi_ws_solarcharger_live.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

0 comments on commit 706bca2

Please sign in to comment.