|
|
@ -79,11 +79,13 @@ void setup() {
|
|
|
|
|
|
|
|
|
|
|
|
//========== Web server setup ==========
|
|
|
|
//========== Web server setup ==========
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(METRICS_EXPORT || API){
|
|
|
|
if(METRICS_EXPORT){
|
|
|
|
if(METRICS_EXPORT){
|
|
|
|
server.on("/metrics", HTTP_GET, [](AsyncWebServerRequest *request){
|
|
|
|
server.on("/metrics", HTTP_GET, [](AsyncWebServerRequest *request){
|
|
|
|
request->send(200, "text/plain; charset=utf-8", metrics);
|
|
|
|
request->send(200, "text/plain; charset=utf-8", metrics);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(API){
|
|
|
|
server.on("/set", HTTP_GET, [](AsyncWebServerRequest *request){
|
|
|
|
server.on("/set", HTTP_GET, [](AsyncWebServerRequest *request){
|
|
|
|
//nutno nastavit maxima a minima
|
|
|
|
//nutno nastavit maxima a minima
|
|
|
|
|
|
|
|
|
|
|
@ -135,12 +137,14 @@ void setup() {
|
|
|
|
|
|
|
|
|
|
|
|
request->send(200, "text/plain; charset=utf-8", repply);
|
|
|
|
request->send(200, "text/plain; charset=utf-8", repply);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(API && WEBAPP){
|
|
|
|
server.serveStatic("/", SPIFFS, "/").setDefaultFile("index.html");
|
|
|
|
server.serveStatic("/", SPIFFS, "/").setDefaultFile("index.html");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
server.onNotFound(notFound);
|
|
|
|
server.onNotFound(notFound);
|
|
|
|
server.begin();
|
|
|
|
server.begin();
|
|
|
|
|
|
|
|
}
|
|
|
|
//=================================
|
|
|
|
//=================================
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|