diff --git a/src/WebOTA.cpp b/src/WebOTA.cpp
index ef33673..26ac89b 100644
--- a/src/WebOTA.cpp
+++ b/src/WebOTA.cpp
@@ -78,62 +78,19 @@ long WebOTA::max_sketch_size() {
}
// R Macro string literal https://en.cppreference.com/w/cpp/language/string_literal
-const char ota_upload_form[] PROGMEM = R"!^!(
+const char INDEX_HTML[] PROGMEM = R"!^!(
+
+)!^!";
-
)!^!";
#ifdef ESP8266
@@ -209,7 +204,7 @@ int WebOTA::add_http_routes(WebServer *server, const char *path) {
#endif
// Index page
server->on("/", HTTP_GET, [server]() {
- server->send(200, "text/html", "
WebOTA
");
+ server->send(200, "text/html", F("
WebOTA
"));
});
// Upload firmware page
@@ -218,7 +213,10 @@ int WebOTA::add_http_routes(WebServer *server, const char *path) {
if (this->custom_html != NULL) {
html = this->custom_html;
} else {
- html = FPSTR(ota_upload_form);
+ char buf[1024];
+ snprintf_P(buf, sizeof(buf), INDEX_HTML, WEBOTA_VERSION);
+
+ html = buf;
}
server->send_P(200, "text/html", html.c_str());
@@ -265,6 +263,21 @@ int WebOTA::add_http_routes(WebServer *server, const char *path) {
}
});
+ // FILE: main.js
+ server->on("/main.js", HTTP_GET, [server]() {
+ server->send_P(200, "application/javascript", MAIN_JS);
+ });
+
+ // FILE: main.css
+ server->on("/main.css", HTTP_GET, [server]() {
+ server->send_P(200, "text/css", MAIN_CSS);
+ });
+
+ // FILE: favicon.ico
+ server->on("/favicon.ico", HTTP_GET, [server]() {
+ server->send(200, "image/vnd.microsoft.icon", "");
+ });
+
server->begin();
return 1;