fix up/download scheduler files

This commit is contained in:
MichaelDvP
2023-03-22 17:33:34 +01:00
parent a5d2beb3e7
commit aea2277e26
4 changed files with 20 additions and 1 deletions

View File

@@ -36,6 +36,7 @@ WebAPIService::WebAPIService(AsyncWebServer * server, SecurityManager * security
server->on(GET_CUSTOMIZATIONS_PATH,
HTTP_GET,
securityManager->wrapRequest(std::bind(&WebAPIService::getCustomizations, this, _1), AuthenticationPredicates::IS_ADMIN));
server->on(GET_SCHEDULE_PATH, HTTP_GET, securityManager->wrapRequest(std::bind(&WebAPIService::getSchedule, this, _1), AuthenticationPredicates::IS_ADMIN));
}
// HTTP GET
@@ -196,4 +197,16 @@ void WebAPIService::getCustomizations(AsyncWebServerRequest * request) {
request->send(response);
}
void WebAPIService::getSchedule(AsyncWebServerRequest * request) {
auto * response = new AsyncJsonResponse(false, FS_BUFFER_SIZE);
JsonObject root = response->getRoot();
root["type"] = "schedule";
System::extractSettings(EMSESP_SCHEDULER_FILE, "Schedule", root, FS_BUFFER_SIZE);
response->setLength();
request->send(response);
}
} // namespace emsesp