From 1e5cdd826728a0cdc92f3607076d9bac7592eb81 Mon Sep 17 00:00:00 2001 From: technyon Date: Wed, 15 Jun 2022 20:10:23 +0200 Subject: [PATCH] ui changes for OTA --- Version.h | 2 +- WebCfgServer.cpp | 30 ++++++++++++++++++++---------- WebCfgServer.h | 1 + 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/Version.h b/Version.h index 7fbaec4..77741a1 100644 --- a/Version.h +++ b/Version.h @@ -1,3 +1,3 @@ #pragma once -#define nuki_hub_version "3.2" \ No newline at end of file +#define nuki_hub_version "3.3" \ No newline at end of file diff --git a/WebCfgServer.cpp b/WebCfgServer.cpp index 9cbb08e..f91ba9c 100644 --- a/WebCfgServer.cpp +++ b/WebCfgServer.cpp @@ -125,11 +125,12 @@ void WebCfgServer::initialize() return _server.requestAuthentication(); } - String response = ""; - buildConfirmHtml(response, "Initiating Over-the-air Update. This will take a moment, please be patient.", 35); - - _server.send(200, "text/html", response); + _server.send(200, "text/html", ""); }, [&]() { + if (_hasCredentials && !_server.authenticate(_credUser, _credPassword)) { + return _server.requestAuthentication(); + } + handleOtaUpload(); }); @@ -371,7 +372,7 @@ void WebCfgServer::buildHtml(String& response) response.concat(""); response.concat(""); - response.concat("

OTA

"); + response.concat("

Firmware update

"); response.concat("
"); response.concat(""); response.concat("
"); @@ -453,11 +454,20 @@ void WebCfgServer::buildCredHtml(String &response) void WebCfgServer::buildOtaHtml(String &response) { buildHtmlHeader(response); - - response.concat("
"); - response.concat(""); - response.concat("Choose a file to upload:
"); - response.concat("
"); + response.concat("
Choose a file to upload:
"); + response.concat("
"); + response.concat("
Initiating Over-the-air update. This will take about a minute, please be patient.
You will be forwarwed automatically when the update is complete.
"); + response.concat(""); response.concat("\n\n"); } diff --git a/WebCfgServer.h b/WebCfgServer.h index c55f0e8..38dd12b 100644 --- a/WebCfgServer.h +++ b/WebCfgServer.h @@ -62,6 +62,7 @@ private: char _credPassword[20] = {0}; bool _allowRestartToPortal = false; uint32_t _transferredSize = 0; + bool _otaStart = true; String _confirmCode = "----";