diff --git a/.github/workflows/beta.yml b/.github/workflows/beta.yml index 461f18c..8200247 100644 --- a/.github/workflows/beta.yml +++ b/.github/workflows/beta.yml @@ -48,7 +48,7 @@ jobs: env: Version: ${{ github.run_id }}.${{ github.run_number }}.${{ github.run_attempt }} run: | - sed -i "s/unknownbuildnr/$Version (${BUILD})/g" src/Config.h + sed -i "s/unknownbuildnr/$Version/g" src/Config.h - name: Build ${{ matrix.build }} PlatformIO Project ${{ matrix.board }} run: | if [ "$BUILD" = "debug" ]; then diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c041f56..7b552d6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -54,7 +54,7 @@ jobs: env: Version: ${{ github.run_id }}.${{ github.run_number }}.${{ github.run_attempt }} run: | - sed -i "s/unknownbuildnr/$Version (${BUILD})/g" src/Config.h + sed -i "s/unknownbuildnr/$Version/g" src/Config.h - name: Build ${{ matrix.build }} PlatformIO Project ${{ matrix.board }} run: | if [ "$BUILD" = "debug" ]; then diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index c23aa90..f7cb421 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -55,7 +55,7 @@ jobs: env: Version: ${{ github.run_id }}.${{ github.run_number }}.${{ github.run_attempt }} run: | - sed -i "s/unknownbuildnr/$Version (${BUILD})/g" src/Config.h + sed -i "s/unknownbuildnr/$Version/g" src/Config.h - name: Build ${{ matrix.build }} PlatformIO Project ${{ matrix.board }} run: | if [ "$BUILD" = "debug" ]; then diff --git a/src/NukiNetwork.cpp b/src/NukiNetwork.cpp index dec4d85..690e422 100644 --- a/src/NukiNetwork.cpp +++ b/src/NukiNetwork.cpp @@ -477,8 +477,9 @@ bool NukiNetwork::update() { _lastUpdateCheckTs = ts; + https.setFollowRedirects(HTTPC_STRICT_FOLLOW_REDIRECTS); https.useHTTP10(true); - https.begin(GITHUB_LATEST_RELEASE_API_URL); + https.begin(GITHUB_OTA_MANIFEST_URL); int httpResponseCode = https.GET(); @@ -489,7 +490,7 @@ bool NukiNetwork::update() if (!jsonError) { - _latestVersion = doc["tag_name"]; + _latestVersion = doc["release"]["version"]; publishString(_maintenancePathPrefix, mqtt_topic_info_nuki_hub_latest, _latestVersion, true); if (_latestVersion != _preferences->getString(preference_latest_version).c_str()) diff --git a/src/WebCfgServer.cpp b/src/WebCfgServer.cpp index 738da82..98b5272 100644 --- a/src/WebCfgServer.cpp +++ b/src/WebCfgServer.cpp @@ -9,6 +9,7 @@ #include #ifndef NUKI_HUB_UPDATER +#include #include "ArduinoJson.h" WebCfgServer::WebCfgServer(NukiWrapper* nuki, NukiOpenerWrapper* nukiOpener, NukiNetwork* network, Gpio* gpio, EthServer* ethServer, Preferences* preferences, bool allowRestartToPortal, uint8_t partitionType) @@ -419,9 +420,63 @@ void WebCfgServer::buildOtaHtml(String &response, bool errored) response.concat("

"); response.concat("

"); response.concat("

"); - response.concat("


"); + response.concat("

"); + + response.concat("Current version: "); + response.concat(NUKI_HUB_VERSION); + response.concat(" ("); + response.concat(NUKI_HUB_BUILD); + response.concat(")
"); + + #ifndef NUKI_HUB_UPDATER + HTTPClient https; + https.setFollowRedirects(HTTPC_STRICT_FOLLOW_REDIRECTS); + https.setTimeout(2500); + https.useHTTP10(true); + https.begin(GITHUB_OTA_MANIFEST_URL); + + int httpResponseCode = https.GET(); + + if (httpResponseCode == HTTP_CODE_OK || httpResponseCode == HTTP_CODE_MOVED_PERMANENTLY) + { + JsonDocument doc; + DeserializationError jsonError = deserializeJson(doc, https.getStream()); + + if (!jsonError) + { + response.concat("Latest release version: "); + response.concat(doc["release"]["version"].as()); + response.concat(" ("); + response.concat(doc["release"]["build"].as()); + response.concat("), "); + response.concat(doc["release"]["time"].as()); + response.concat("
"); + response.concat("Latest beta version: "); + response.concat(doc["beta"]["version"].as()); + if(doc["beta"]["version"] != "No beta available") + { + response.concat(" ("); + response.concat(doc["beta"]["build"].as()); + response.concat("), "); + response.concat(doc["beta"]["time"].as()); + } + response.concat("
"); + response.concat("Latest development version: "); + response.concat(doc["master"]["version"].as()); + response.concat(" ("); + response.concat(doc["master"]["build"].as()); + response.concat("), "); + response.concat(doc["master"]["time"].as()); + response.concat("
"); + } + } + + https.end(); #endif - + + response.concat("
"); + #endif + if(_partitionType == 1) { response.concat("

Manually update Nuki Hub

"); @@ -2512,6 +2567,12 @@ void WebCfgServer::buildInfoHtml(String &response) response.concat("Nuki Hub build: "); response.concat(NUKI_HUB_BUILD); response.concat("\n"); + response.concat("Nuki Hub build type: "); + #ifndef DEBUG_NUKIHUB + response.concat("Release\n"); + #else + response.concat("Debug\n"); + #endif response.concat(debugPreferences.preferencesToString(_preferences));