From 562cc4352ba6782c7b048707e21a9deac59740b7 Mon Sep 17 00:00:00 2001 From: jomjol <30766535+jomjol@users.noreply.github.com> Date: Mon, 19 Sep 2022 22:07:16 +0200 Subject: [PATCH] Rolling 20220919 --- sd-card/html/ota_page_new.html | 72 +++++++++++++++++---------------- sd-card/html/reboot_action.html | 11 +++++ 2 files changed, 49 insertions(+), 34 deletions(-) create mode 100644 sd-card/html/reboot_action.html diff --git a/sd-card/html/ota_page_new.html b/sd-card/html/ota_page_new.html index 356ae46c..adf4dc2b 100644 --- a/sd-card/html/ota_page_new.html +++ b/sd-card/html/ota_page_new.html @@ -35,36 +35,29 @@ Check at Update - +

+ +

+ + + +

+ +

+ + +

+ +

+ + +

+

Status: idle

+

- - - - - - - - - - - -
- - - - - -
- - - - - -
-

Reboot

- +
@@ -79,7 +72,6 @@ function init(){ basepath = getbasepath(); document.getElementById("reboot").disabled = true; - document.getElementById("upload").disabled = true; document.getElementById("doUpdate").disabled = true; } @@ -124,15 +116,16 @@ function doReboot() { function setpath() { var nameneu = document.getElementById("newfile").value; nameneu = nameneu.split(/[\\\/]/).pop(); - document.getElementById("filepath").value = nameneu; - document.getElementById("upload").disabled = false; + document.getElementById("doUpdate").disabled = false; + document.getElementById("status").innerText = "Status: file selected"; } function upload() { var xhttp = new XMLHttpRequest(); - var filePath = document.getElementById("filepath").value; + var nameneu = document.getElementById("newfile").value; + filePath = nameneu.split(/[\\\/]/).pop(); var upload_path = "/upload/firmware/" + filePath; var fileInput = document.getElementById("newfile").files; @@ -196,18 +189,29 @@ function upload() { var file = fileInput[0]; xhttp.open("POST", upload_path, false); + document.getElementById("status").innerText = "Status: uploading"; xhttp.send(file); } - alert("Start processing!"); + document.getElementById("status").innerText = "Status: processing on ESP32"; var xhttp = new XMLHttpRequest(); /* first delete the old firmware */ xhttp.onreadystatechange = function() { if (xhttp.readyState == 4) { if (xhttp.status == 200) { - alert("Processing done!\n" + xhttp.responseText); - /* keine Reaktion, damit sich das Dokument nicht ändert */ + if (xhttp.responseText == "reboot") + { + var stringota = "/reboot_action.html"; + window.location = stringota; + window.location.href = stringota; + window.location.assign(stringota); + window.location.replace(stringota); + } + else + { + alert("Processing done!\n\n" + xhttp.responseText); + } } else if (xhttp.status == 0) { alert("Server closed the connection abruptly!"); UpdatePage(); diff --git a/sd-card/html/reboot_action.html b/sd-card/html/reboot_action.html new file mode 100644 index 00000000..1ebe851b --- /dev/null +++ b/sd-card/html/reboot_action.html @@ -0,0 +1,11 @@ + +

+ + + \ No newline at end of file