diff --git a/src/WebOTA.cpp b/src/WebOTA.cpp
index e424454..54161a4 100644
--- a/src/WebOTA.cpp
+++ b/src/WebOTA.cpp
@@ -78,22 +78,20 @@ long WebOTA::max_sketch_size() {
}
// R Macro string literal https://en.cppreference.com/w/cpp/language/string_literal
-const char ota_version_html[] PROGMEM = "
WebOTA Version: " WEBOTA_VERSION "
";
-
const char ota_upload_form[] PROGMEM = R"!^!(
-
-
-
- WebOTA upload form
-
+
+
+
+ WebOTA upload form
+
-
-
+
+
WebOTA Version: %s
@@ -173,16 +171,16 @@ domReady(function() {
if (evt.lengthComputable) {
var per = Math.round((evt.loaded / evt.total) * 100);
var prg = document.getElementById('prg');
-
+
var str = per + "%%";
prg.style.width = str;
-
+
if (per == 100) {
str += " - Rebooting...";
}
-
+
prg.innerHTML = str;
-
+
prg.style.display = "block";
}
}, false);
@@ -203,7 +201,6 @@ domReady(function() {
)!^!";
-
#ifdef ESP8266
int WebOTA::add_http_routes(ESP8266WebServer *server, const char *path) {
#endif
@@ -219,14 +216,15 @@ int WebOTA::add_http_routes(WebServer *server, const char *path) {
server->on(path, HTTP_GET, [server,this]() {
String html = "";
if (this->custom_html != NULL) {
- html += this->custom_html;
+ html = this->custom_html;
} else {
- html += FPSTR(ota_version_html);
+ char buf[4096];
+ snprintf(buf, 4096, ota_upload_form, WEBOTA_VERSION); // Put the version string in the HTML
+
+ html.concat(buf);
}
- char buf[4096];
- snprintf(buf, 4096, ota_upload_form, WEBOTA_VERSION); // Put the version string in the HTML
- server->send_P(200, "text/html", buf);
+ server->send_P(200, "text/html", html.c_str());
});
// Handling uploading firmware file