* MQTT fix reconnection by new lib version #780
* add `about` page
This commit is contained in:
lumapu 2023-03-27 22:18:40 +02:00
parent fae46c4667
commit c4e9fec8e7
5 changed files with 78 additions and 5 deletions

View file

@ -30,6 +30,7 @@
#include "html/h/save_html.h"
#include "html/h/update_html.h"
#include "html/h/visualization_html.h"
#include "html/h/about_html.h"
#define WEB_SERIAL_BUF_SIZE 2048
@ -83,6 +84,7 @@ class Web {
mWeb.on("/upload", HTTP_POST, std::bind(&Web::onUpload, this, std::placeholders::_1),
std::bind(&Web::onUpload2, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6));
mWeb.on("/serial", HTTP_GET, std::bind(&Web::onSerial, this, std::placeholders::_1));
mWeb.on("/about", HTTP_GET, std::bind(&Web::onAbout, this, std::placeholders::_1));
mWeb.on("/debug", HTTP_GET, std::bind(&Web::onDebug, this, std::placeholders::_1));
@ -243,7 +245,7 @@ class Web {
}
void showUpdate(AsyncWebServerRequest *request) {
bool reboot = (!Update.hasError() && Update.size() > 0);
bool reboot = (!Update.hasError());
String html = F("<!doctype html><html><head><title>Update</title><meta http-equiv=\"refresh\" content=\"20; URL=/\"></head><body>Update: ");
if (reboot)
@ -616,6 +618,21 @@ class Web {
request->send(response);
}
void onAbout(AsyncWebServerRequest *request) {
if (CHECK_MASK(mConfig->sys.protectionMask, PROT_MASK_LIVE)) {
if (mProtected) {
checkRedirect(request);
return;
}
}
AsyncWebServerResponse *response = request->beginResponse_P(200, F("text/html; charset=UTF-8"), about_html, about_html_len);
response->addHeader(F("Content-Encoding"), "gzip");
response->addHeader(F("content-type"), "text/html; charset=UTF-8");
request->send(response);
}
void onDebug(AsyncWebServerRequest *request) {
mApp->getSchedulerNames();
AsyncWebServerResponse *response = request->beginResponse(200, F("text/html; charset=UTF-8"), "ok");