changed json var names to more visible

This commit is contained in:
Dmitry Borisenko
2020-06-19 14:50:34 +02:00
parent e6637dcd69
commit 48ba3c99dd
18 changed files with 428 additions and 340 deletions

View File

@@ -50,9 +50,9 @@ void Web_server_init() {
#endif
#ifdef ESP32
server.addHandler(new SPIFFSEditor(SPIFFS, jsonReadStr(configSetup, "web_login").c_str(), jsonReadStr(configSetup, "web_pass").c_str()));
server.addHandler(new SPIFFSEditor(SPIFFS, jsonReadStr(configSetupJson, "web_login").c_str(), jsonReadStr(configSetupJson, "web_pass").c_str()));
#elif defined(ESP8266)
server.addHandler(new SPIFFSEditor(jsonReadStr(configSetup, "web_login").c_str(), jsonReadStr(configSetup, "web_pass").c_str()));
server.addHandler(new SPIFFSEditor(jsonReadStr(configSetupJson, "web_login").c_str(), jsonReadStr(configSetupJson, "web_pass").c_str()));
#endif
/* server.on("/heap", HTTP_GET, [](AsyncWebServerRequest * request) {
@@ -63,7 +63,7 @@ void Web_server_init() {
server.serveStatic("/js/", SPIFFS, "/js/").setCacheControl("max-age=31536000");
server.serveStatic("/favicon.ico", SPIFFS, "/favicon.ico").setCacheControl("max-age=31536000");
server.serveStatic("/", SPIFFS, "/").setDefaultFile("index.htm").setAuthentication(jsonReadStr(configSetup, "web_login").c_str(), jsonReadStr(configSetup, "web_pass").c_str());
server.serveStatic("/", SPIFFS, "/").setDefaultFile("index.htm").setAuthentication(jsonReadStr(configSetupJson, "web_login").c_str(), jsonReadStr(configSetupJson, "web_pass").c_str());
server.onNotFound([](AsyncWebServerRequest *request) {
Serial.printf("NOT_FOUND: ");
@@ -130,17 +130,17 @@ void Web_server_init() {
server.begin();
// --------------------Выдаем данные configJson //config.live.json - динамические данные
// --------------------Выдаем данные configLiveJson //config.live.json - динамические данные
server.on("/config.live.json", HTTP_GET, [](AsyncWebServerRequest *request) {
request->send(200, "application/json", configJson);
request->send(200, "application/json", configLiveJson);
});
// --------------------Выдаем данные optionJson //config.option.json - данные не являющиеся событиями
// --------------------Выдаем данные configOptionJson //config.option.json - данные не являющиеся событиями
server.on("/config.option.json", HTTP_GET, [](AsyncWebServerRequest *request) {
request->send(200, "application/json", optionJson);
request->send(200, "application/json", configOptionJson);
});
// -------------------Выдаем данные configSetup //config.setup.json - для хранения постоянных данных
// -------------------Выдаем данные configSetupJson //config.setup.json - для хранения постоянных данных
server.on("/config.setup.json", HTTP_GET, [](AsyncWebServerRequest *request) {
request->send(200, "application/json", configSetup);
request->send(200, "application/json", configSetupJson);
});
// ------------------Выполнение команды из запроса