* start implementing a wizard for initial (WiFi) configuration #1199
This commit is contained in:
lumapu 2024-01-06 02:58:19 +01:00
parent 617cf0a92a
commit 5ca26895a1
9 changed files with 158 additions and 9 deletions

View file

@ -36,6 +36,7 @@
#include "html/h/update_html.h"
#include "html/h/visualization_html.h"
#include "html/h/about_html.h"
#include "html/h/wizard_html.h"
#define WEB_SERIAL_BUF_SIZE 2048
@ -77,6 +78,7 @@ class Web {
mWeb.on("/factorytrue", HTTP_ANY, std::bind(&Web::showHtml, this, std::placeholders::_1));
mWeb.on("/setup", HTTP_GET, std::bind(&Web::onSetup, this, std::placeholders::_1));
mWeb.on("/wizard", HTTP_GET, std::bind(&Web::onWizard, this, std::placeholders::_1));
mWeb.on("/save", HTTP_POST, std::bind(&Web::showSave, this, std::placeholders::_1));
mWeb.on("/live", HTTP_ANY, std::bind(&Web::onLive, this, std::placeholders::_1));
@ -422,7 +424,7 @@ class Web {
void showNotFound(AsyncWebServerRequest *request) {
checkProtection(request);
request->redirect("/setup");
request->redirect("/wizard");
}
void onReboot(AsyncWebServerRequest *request) {
@ -444,6 +446,13 @@ class Web {
getPage(request, PROT_MASK_SETUP, setup_html, setup_html_len);
}
void onWizard(AsyncWebServerRequest *request) {
AsyncWebServerResponse *response = request->beginResponse_P(200, F("text/html; charset=UTF-8"), wizard_html, wizard_html_len);
response->addHeader(F("Content-Encoding"), "gzip");
response->addHeader(F("content-type"), "text/html; charset=UTF-8");
request->send(response);
}
void showSave(AsyncWebServerRequest *request) {
DPRINTLN(DBG_VERBOSE, F("showSave"));