mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
added back format console command
This commit is contained in:
@@ -2,16 +2,16 @@
|
||||
|
||||
using namespace std::placeholders;
|
||||
|
||||
FactoryResetService::FactoryResetService(AsyncWebServer* server, FS* fs, SecurityManager* securityManager) : fs(fs) {
|
||||
server->on(FACTORY_RESET_SERVICE_PATH,
|
||||
HTTP_POST,
|
||||
securityManager->wrapRequest(std::bind(&FactoryResetService::handleRequest, this, _1),
|
||||
AuthenticationPredicates::IS_ADMIN));
|
||||
FactoryResetService::FactoryResetService(AsyncWebServer * server, FS * fs, SecurityManager * securityManager)
|
||||
: fs(fs) {
|
||||
server->on(FACTORY_RESET_SERVICE_PATH,
|
||||
HTTP_POST,
|
||||
securityManager->wrapRequest(std::bind(&FactoryResetService::handleRequest, this, _1), AuthenticationPredicates::IS_ADMIN));
|
||||
}
|
||||
|
||||
void FactoryResetService::handleRequest(AsyncWebServerRequest* request) {
|
||||
request->onDisconnect(std::bind(&FactoryResetService::factoryReset, this));
|
||||
request->send(200);
|
||||
void FactoryResetService::handleRequest(AsyncWebServerRequest * request) {
|
||||
request->onDisconnect(std::bind(&FactoryResetService::factoryReset, this));
|
||||
request->send(200);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -19,16 +19,16 @@ void FactoryResetService::handleRequest(AsyncWebServerRequest* request) {
|
||||
*/
|
||||
void FactoryResetService::factoryReset() {
|
||||
#ifdef ESP32
|
||||
File root = fs->open(FS_CONFIG_DIRECTORY);
|
||||
File file;
|
||||
while (file = root.openNextFile()) {
|
||||
fs->remove(file.name());
|
||||
}
|
||||
File root = fs->open(FS_CONFIG_DIRECTORY);
|
||||
File file;
|
||||
while (file = root.openNextFile()) {
|
||||
fs->remove(file.name());
|
||||
}
|
||||
#elif defined(ESP8266)
|
||||
Dir configDirectory = fs->openDir(FS_CONFIG_DIRECTORY);
|
||||
while (configDirectory.next()) {
|
||||
fs->remove(configDirectory.fileName());
|
||||
}
|
||||
Dir configDirectory = fs->openDir(FS_CONFIG_DIRECTORY);
|
||||
while (configDirectory.next()) {
|
||||
fs->remove(configDirectory.fileName());
|
||||
}
|
||||
#endif
|
||||
RestartService::restartNow();
|
||||
RestartService::restartNow();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user