mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 00:09:51 +03:00
initial commit
This commit is contained in:
13
lib/framework/RestartService.cpp
Normal file
13
lib/framework/RestartService.cpp
Normal file
@@ -0,0 +1,13 @@
|
||||
#include <RestartService.h>
|
||||
|
||||
RestartService::RestartService(AsyncWebServer* server, SecurityManager* securityManager) {
|
||||
server->on(RESTART_SERVICE_PATH,
|
||||
HTTP_POST,
|
||||
securityManager->wrapRequest(std::bind(&RestartService::restart, this, std::placeholders::_1),
|
||||
AuthenticationPredicates::IS_ADMIN));
|
||||
}
|
||||
|
||||
void RestartService::restart(AsyncWebServerRequest* request) {
|
||||
request->onDisconnect([]() { RestartService::restartNow(); });
|
||||
request->send(200);
|
||||
}
|
||||
Reference in New Issue
Block a user