diff --git a/src/utils.cpp b/src/utils.cpp index ffa6bf4..74191c6 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -16,6 +16,10 @@ #include "display.h" #include "utils.h" +// +#include "web_utils.h" +// + AsyncWebServer server(80); @@ -44,10 +48,7 @@ extern String versionDate; extern uint32_t lastWiFiCheck; extern bool WiFiConnect; -// -const char* htmlPage1 = "

Page 1

"; -const char* htmlPage2 = "

Page 2

"; -// + namespace Utils { @@ -273,11 +274,16 @@ void startOTAServer() { }); server.on("/test1", HTTP_GET, [](AsyncWebServerRequest *request) { - request->send(200, "text/plain", htmlPage1 ); + request->send(200, "text/html", htmlPage1); }); server.on("/test2", HTTP_GET, [](AsyncWebServerRequest *request) { - request->send(200, "text/plain", htmlPage2 ); + String dynamicContent = String(htmlPage3); + dynamicContent.replace("%VCALLSIGN%", Config.callsign); + + + + request->send(200, "text/html", dynamicContent); }); AsyncElegantOTA.begin(&server); diff --git a/src/web_utils.h b/src/web_utils.h new file mode 100644 index 0000000..2c2350d --- /dev/null +++ b/src/web_utils.h @@ -0,0 +1,26 @@ +#ifndef WEB_UTILS_H_ +#define WEB_UTILS_H_ + + +#include "configuration.h" +#include + +extern Configuration Config; + +// +const char* htmlPage1 = "

Page 1

"; +//const char* htmlPage2 = "

Page 2

"; +const char* htmlPage3 = "Dynamic Content Example

LoRa iGate Configuration Data

Callsign: %VCALLSIGN%

"; + +// + + +namespace WEB_Utils { + +/*void checkWiFi(); +void startWiFi(); +void setup();*/ + +} + +#endif \ No newline at end of file