mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
fix up/download scheduler files
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user