Add buttons to /ota

This commit is contained in:
iranl
2024-02-15 22:46:47 +01:00
parent 533e78e06a
commit 8139c23785
4 changed files with 18 additions and 13 deletions

View File

@@ -356,7 +356,7 @@ bool WebCfgServer::processArgs(String& message)
{
_preferences->putString(preference_mqtt_hass_cu_url, value);
configChanged = true;
}
}
else if(key == "HOSTNAME")
{
_preferences->putString(preference_hostname, value);
@@ -622,16 +622,16 @@ void WebCfgServer::buildHtml(String& response)
printParameter(response, "Nuki Opener state", lockstateArr);
}
printParameter(response, "Firmware", version.c_str(), "/info");
const char* _latestVersion = _network->latestHubVersion();
if(_preferences->getBool(preference_check_updates))
{
//if(atof(_latestVersion) > atof(NUKI_HUB_VERSION) || (atof(_latestVersion) == atof(NUKI_HUB_VERSION) && _latestVersion != NUKI_HUB_VERSION)) {
printParameter(response, "Latest Firmware", _latestVersion, GITHUB_LATEST_RELEASE_URL);
printParameter(response, "Latest Firmware", _latestVersion, "/ota");
//}
}
response.concat("</table><br><br>");
response.concat("<h3>MQTT and Network Configuration</h3>");
@@ -741,6 +741,18 @@ void WebCfgServer::buildOtaHtml(String &response, bool errored)
response.concat("<form id=\"upform\" enctype=\"multipart/form-data\" action=\"/uploadota\" method=\"POST\"><input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"100000\" />Choose the updated nuki_hub.bin file to upload: <input name=\"uploadedfile\" type=\"file\" accept=\".bin\" /><br/>");
response.concat("<br><input id=\"submitbtn\" type=\"submit\" value=\"Upload File\" /></form>");
if(_preferences->getBool(preference_check_updates))
{
response.concat("<button title=\"Open latest release on GitHub\" onclick=\" window.open('");
response.concat(GITHUB_LATEST_RELEASE_URL);
response.concat("', '_blank'); return false;\">Open latest release on GitHub</button>");
response.concat("<br><br><button title=\"Download latest binary from GitHub\" onclick=\" window.open('");
response.concat(GITHUB_LATEST_RELEASE_BINARY_URL);
response.concat("'); return false;\">Download latest binary from GitHub</button>");
}
response.concat("<div id=\"msgdiv\" style=\"visibility:hidden\">Initiating Over-the-air update. This will take about two minutes, please be patient.<br>You will be forwarded automatically when the update is complete.</div>");
response.concat("<script type=\"text/javascript\">");
response.concat("window.addEventListener('load', function () {");