diff --git a/interface/src/api/endpoints.ts b/interface/src/api/endpoints.ts
index c0d2842e6..cbc0a4bca 100644
--- a/interface/src/api/endpoints.ts
+++ b/interface/src/api/endpoints.ts
@@ -57,7 +57,10 @@ export const alovaInstance = createAlova({
});
export const alovaInstanceGH = createAlova({
- baseURL: process.env.NODE_ENV === 'development' ? '/gh' : 'https://api.github.com/repos/emsesp/EMS-ESP32/releases',
+ baseURL:
+ process.env.NODE_ENV === 'development'
+ ? '/gh'
+ : 'https://api.github.com/repos/emsesp/EMS-ESP32/releases',
statesHook: ReactHook,
requestAdapter: xhrRequestAdapter()
});
diff --git a/interface/src/app/settings/Settings.tsx b/interface/src/app/settings/Settings.tsx
index acf630053..7aba45df7 100644
--- a/interface/src/app/settings/Settings.tsx
+++ b/interface/src/app/settings/Settings.tsx
@@ -87,7 +87,7 @@ const Settings = () => {
icon={BuildIcon}
bgcolor="#72caf9"
label="EMS-ESP Firmware"
- text={'v'+data.emsesp_version}
+ text={'v' + data.emsesp_version}
to="version"
/>
diff --git a/interface/src/app/settings/Version.tsx b/interface/src/app/settings/Version.tsx
index d86ba43c5..94332f96a 100644
--- a/interface/src/app/settings/Version.tsx
+++ b/interface/src/app/settings/Version.tsx
@@ -2,6 +2,8 @@ import { useEffect, useState } from 'react';
import { toast } from 'react-toastify';
import CancelIcon from '@mui/icons-material/Cancel';
+import CheckIcon from '@mui/icons-material/Done';
+import DownloadIcon from '@mui/icons-material/GetApp';
import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined';
import WarningIcon from '@mui/icons-material/Warning';
import {
@@ -11,7 +13,6 @@ import {
DialogActions,
DialogContent,
DialogTitle,
- Divider,
Link,
Typography
} from '@mui/material';
@@ -108,9 +109,13 @@ const Version = () => {
useLayoutTitle('EMS-ESP Firmware');
+ // see if we have internet access
const internet_live =
latestDevVersion !== undefined && latestVersion !== undefined;
+ // check for older boards where auto-upgrade is not supported
+ const download_only = data && !data.psram;
+
const renderUploadDialog = () => {
if (!internet_live) {
return null;
@@ -123,26 +128,15 @@ const Version = () => {
onClose={() => setOpenDialog(false)}
>
- {LL.INSTALL('') +
- ' ' +
- (useDev ? LL.DEVELOPMENT() : LL.STABLE()) +
- ' Firmware'}
+ {(download_only ? LL.DOWNLOAD(0) : LL.INSTALL('')) + ' ' + ' Firmware'}
- {LL.INSTALL_VERSION(useDev ? latestDevVersion : latestVersion)}
+ {LL.INSTALL_VERSION(
+ download_only ? LL.DOWNLOAD(1) : LL.INSTALL(''),
+ useDev ? latestDevVersion : latestVersion
+ )}
-
- changelog
-
- |
-
- {LL.DOWNLOAD(1)}
-
}
+ startIcon={}
variant="outlined"
- onClick={() => installFirmwareURL(getBinURL(useDev))}
+ onClick={() => setOpenDialog(false)}
color="primary"
>
- {LL.INSTALL('')}
+
+ {LL.DOWNLOAD(1)}
+
+ {!download_only && (
+ }
+ variant="outlined"
+ onClick={() => installFirmwareURL(getBinURL(useDev))}
+ color="primary"
+ >
+ {LL.INSTALL('')}
+
+ )}
);
};
- // useDevVersion = true to force using the dev version
const showFirmwareDialog = (useDevVersion: boolean) => {
if (useDevVersion || data.emsesp_version.includes('dev')) {
setUseDev(true);
@@ -184,29 +189,23 @@ const Version = () => {
return (
<>
-
+
+ Firmware Version
+
+
+
-
+
{LL.VERSION()}
-
+
Platform
-
+
Release Type
- {internet_live && (
- <>
-
- Latest Stable Release
-
-
- Latest Development Release
-
- >
- )}
-
+
{data.emsesp_version}
{data.build_flags && (
@@ -216,69 +215,101 @@ const Version = () => {
)}
{getPlatform()}
-
- {isDev ? LL.DEVELOPMENT() : LL.STABLE()}
-
- (changelog)
-
+
+ {isDev ? LL.DEVELOPMENT() : LL.STABLE()}
{!isDev && internet_live && (
-
+
+
+
)}
- {internet_live && (
- <>
- {latestVersion}
-
- {latestDevVersion}
-
- >
- )}
-
-
-
-
-
- {upgradeAvailable ? LL.UPGRADE_AVAILABLE() : LL.LATEST_VERSION()}
- {upgradeAvailable &&
- internet_live &&
- (data.psram ? (
-
- ) : (
- <>
-
-
- {LL.DOWNLOAD(1)} v
- {isDev ? latestDevVersion : latestVersion}
-
- >
- ))}
+
+ Latest Available Versions
+ {internet_live ? (
+ <>
+
+
+
+ Stable Release
+
+
+ Development Release
+
+
+
+
+ {latestVersion}
+
+ (changelog)
+
+ {!isDev && upgradeAvailable && (
+
+ )}
+
+
+ {latestDevVersion}
+
+ (changelog)
+
+ {isDev && upgradeAvailable && (
+
+ )}
+
+
+
+ {upgradeAvailable ? (
+
+
+ {LL.UPGRADE_AVAILABLE()}
+
+ ) : (
+
+
+ {LL.LATEST_VERSION()}
+
+ )}
+ >
+ ) : (
+
+ not online
+
+ )}
+
{renderUploadDialog()}
>
diff --git a/interface/src/app/settings/security/ManageUsers.tsx b/interface/src/app/settings/security/ManageUsers.tsx
index affcf6496..758882869 100644
--- a/interface/src/app/settings/security/ManageUsers.tsx
+++ b/interface/src/app/settings/security/ManageUsers.tsx
@@ -2,9 +2,9 @@ import { useContext, useState } from 'react';
import { useBlocker } from 'react-router-dom';
import CancelIcon from '@mui/icons-material/Cancel';
-import CheckIcon from '@mui/icons-material/Check';
import CloseIcon from '@mui/icons-material/Close';
import DeleteIcon from '@mui/icons-material/Delete';
+import CheckIcon from '@mui/icons-material/Done';
import EditIcon from '@mui/icons-material/Edit';
import PersonAddIcon from '@mui/icons-material/PersonAdd';
import VpnKeyIcon from '@mui/icons-material/VpnKey';
diff --git a/interface/src/i18n/cz/index.ts b/interface/src/i18n/cz/index.ts
index 8d93d0187..e8935fa62 100644
--- a/interface/src/i18n/cz/index.ts
+++ b/interface/src/i18n/cz/index.ts
@@ -331,7 +331,7 @@ const cz: Translation = {
ALLVALUES: 'Všechny hodnoty',
SPECIAL_FUNCTIONS: 'Speciální funkce',
WAIT_FIRMWARE: 'Firmware se nahrává a instaluje',
- INSTALL_VERSION: 'Tímto se nainstaluje verze {0}. Jste si jistí?',
+ INSTALL_VERSION: 'Tímto se {0} verze {1}. Jste si jistí?',
SWITCH_DEV: 'přepnout na vývojovou verzi',
UPGRADE_AVAILABLE: 'Je k dispozici aktualizace firmwaru!',
LATEST_VERSION: 'Používáte nejnovější verzi firmwaru.',
diff --git a/interface/src/i18n/de/index.ts b/interface/src/i18n/de/index.ts
index 476ebf097..a1a384452 100644
--- a/interface/src/i18n/de/index.ts
+++ b/interface/src/i18n/de/index.ts
@@ -331,7 +331,7 @@ const de: Translation = {
ALLVALUES: 'Alle Werte',
SPECIAL_FUNCTIONS: 'Sonderfunktionen',
WAIT_FIRMWARE: 'Die Firmware wird hochgeladen und installiert.',
- INSTALL_VERSION: 'Dadurch wird die Version installiert {0}. Sind Sie sicher?',
+ INSTALL_VERSION: 'Dadurch wird die Version {0} {1}. Sind Sie sicher?',
SWITCH_DEV: 'Wechseln Sie zur Entwicklungsversion!',
UPGRADE_AVAILABLE: 'Es ist ein Firmware-Upgrade verfügbar.',
LATEST_VERSION: 'Sie verwenden die neueste Firmware-Version.',
diff --git a/interface/src/i18n/en/index.ts b/interface/src/i18n/en/index.ts
index 40c14a2e4..e52b31977 100644
--- a/interface/src/i18n/en/index.ts
+++ b/interface/src/i18n/en/index.ts
@@ -331,7 +331,7 @@ const en: Translation = {
ALLVALUES: 'All Values',
SPECIAL_FUNCTIONS: 'Special Functions',
WAIT_FIRMWARE: 'Firmware is uploading and installing',
- INSTALL_VERSION: 'This will install version {0}. Are you sure?',
+ INSTALL_VERSION: 'This will {0} version {1}. Are you sure?',
SWITCH_DEV: 'switch to the development version',
UPGRADE_AVAILABLE: 'There is a firmware upgrade available!',
LATEST_VERSION: 'You are using the latest firmware version.',
diff --git a/interface/src/i18n/fr/index.ts b/interface/src/i18n/fr/index.ts
index 4672a094c..f29674778 100644
--- a/interface/src/i18n/fr/index.ts
+++ b/interface/src/i18n/fr/index.ts
@@ -331,7 +331,7 @@ const fr: Translation = {
ALLVALUES: 'All Values', // TODO translate
SPECIAL_FUNCTIONS: 'Special Functions',
WAIT_FIRMWARE: 'Firmware is uploading and installing', // TODO translate
- INSTALL_VERSION: 'This will install version {0}. Are you sure?', // TODO translate
+ INSTALL_VERSION: 'This will {0} version {1}. Are you sure?', // TODO translate
SWITCH_DEV: 'switch to the development version', // TODO translate
UPGRADE_AVAILABLE: 'There is a firmware upgrade available!', // TODO translate
LATEST_VERSION: 'You are using the latest firmware version.', // TODO translate
diff --git a/interface/src/i18n/it/index.ts b/interface/src/i18n/it/index.ts
index 8813d9dd3..582490226 100644
--- a/interface/src/i18n/it/index.ts
+++ b/interface/src/i18n/it/index.ts
@@ -331,7 +331,7 @@ const it: Translation = {
ALLVALUES: 'All Values', // TODO translate
SPECIAL_FUNCTIONS: 'Special Functions', // TODO translate
WAIT_FIRMWARE: 'Firmware is uploading and installing', // TODO translate
- INSTALL_VERSION: 'This will install version {0}. Are you sure?', // TODO translate
+ INSTALL_VERSION: 'This will {0} version {1}. Are you sure?', // TODO translate
SWITCH_DEV: 'switch to the development version', // TODO translate
UPGRADE_AVAILABLE: 'There is a firmware upgrade available!', // TODO translate
LATEST_VERSION: 'You are using the latest firmware version.', // TODO translate
diff --git a/interface/src/i18n/nl/index.ts b/interface/src/i18n/nl/index.ts
index 8f9de0884..2e5314a00 100644
--- a/interface/src/i18n/nl/index.ts
+++ b/interface/src/i18n/nl/index.ts
@@ -331,7 +331,7 @@ const nl: Translation = {
ALLVALUES: 'All Values', // TODO translate
SPECIAL_FUNCTIONS: 'Special Functions', // TODO translate
WAIT_FIRMWARE: 'Firmware is uploading and installing', // TODO translate
- INSTALL_VERSION: 'This will install version {0}. Are you sure?', // TODO translate
+ INSTALL_VERSION: 'This will {0} version {1}. Are you sure?', // TODO translate
SWITCH_DEV: 'switch to the development version', // TODO translate
UPGRADE_AVAILABLE: 'There is a firmware upgrade available!', // TODO translate
LATEST_VERSION: 'You are using the latest firmware version.', // TODO translate
diff --git a/interface/src/i18n/no/index.ts b/interface/src/i18n/no/index.ts
index 2b573c7e6..2ea128bb8 100644
--- a/interface/src/i18n/no/index.ts
+++ b/interface/src/i18n/no/index.ts
@@ -331,7 +331,7 @@ const no: Translation = {
ALLVALUES: 'All Values', // TODO translate
SPECIAL_FUNCTIONS: 'Special Functions', // TODO translate
WAIT_FIRMWARE: 'Firmware is uploading and installing', // TODO translate
- INSTALL_VERSION: 'This will install version {0}. Are you sure?', // TODO translate
+ INSTALL_VERSION: 'This will {0} version {1}. Are you sure?', // TODO translate
SWITCH_DEV: 'switch to the development version', // TODO translate
UPGRADE_AVAILABLE: 'There is a firmware upgrade available!', // TODO translate
LATEST_VERSION: 'You are using the latest firmware version.', // TODO translate
diff --git a/interface/src/i18n/pl/index.ts b/interface/src/i18n/pl/index.ts
index 99eaf709d..3910815af 100644
--- a/interface/src/i18n/pl/index.ts
+++ b/interface/src/i18n/pl/index.ts
@@ -331,7 +331,7 @@ const pl: BaseTranslation = {
ALLVALUES: 'All Values', // TODO translate
SPECIAL_FUNCTIONS: 'Special Functions', // TODO translate
WAIT_FIRMWARE: 'Firmware is uploading and installing', // TODO translate
- INSTALL_VERSION: 'This will install version {0}. Are you sure?', // TODO translate
+ INSTALL_VERSION: 'This will {0} version {1}. Are you sure?', // TODO translate
SWITCH_DEV: 'switch to the development version', // TODO translate
UPGRADE_AVAILABLE: 'There is a firmware upgrade available!', // TODO translate
LATEST_VERSION: 'You are using the latest firmware version.', // TODO translate
diff --git a/interface/src/i18n/sk/index.ts b/interface/src/i18n/sk/index.ts
index 77093b5e4..13e2bfcdc 100644
--- a/interface/src/i18n/sk/index.ts
+++ b/interface/src/i18n/sk/index.ts
@@ -331,7 +331,7 @@ const sk: Translation = {
ALLVALUES: 'Všetky hodnoty',
SPECIAL_FUNCTIONS: 'Špeciálne funkcie',
WAIT_FIRMWARE: 'Firmvér sa nahráva a inštaluje',
- INSTALL_VERSION: 'Týmto sa nainštaluje verzia {0}. Si si istý?',
+ INSTALL_VERSION: 'Týmto sa {0} verzia {1}. Si si istý?',
SWITCH_DEV: 'prejsť na vývojovú verziu',
UPGRADE_AVAILABLE: 'K dispozícii je aktualizácia firmvéru!',
LATEST_VERSION: 'Používate poslednú verziu firmvéru.',
diff --git a/interface/src/i18n/sv/index.ts b/interface/src/i18n/sv/index.ts
index ad593e1a9..ce9b6a3b1 100644
--- a/interface/src/i18n/sv/index.ts
+++ b/interface/src/i18n/sv/index.ts
@@ -331,7 +331,7 @@ const sv: Translation = {
ALLVALUES: 'All Values', // TODO translate
SPECIAL_FUNCTIONS: 'Special Functions', // TODO translate
WAIT_FIRMWARE: 'Firmware is uploading and installing', // TODO translate
- INSTALL_VERSION: 'This will install version {0}. Are you sure?', // TODO translate
+ INSTALL_VERSION: 'This will {0} version {1}. Are you sure?', // TODO translate
SWITCH_DEV: 'switch to the development version', // TODO translate
UPGRADE_AVAILABLE: 'There is a firmware upgrade available!', // TODO translate
LATEST_VERSION: 'You are using the latest firmware version.', // TODO translate
diff --git a/interface/src/i18n/tr/index.ts b/interface/src/i18n/tr/index.ts
index a21f735fd..0ac801948 100644
--- a/interface/src/i18n/tr/index.ts
+++ b/interface/src/i18n/tr/index.ts
@@ -331,7 +331,7 @@ const tr: Translation = {
ALLVALUES: 'All Values', // TODO translate
SPECIAL_FUNCTIONS: 'Special Functions', // TODO translate
WAIT_FIRMWARE: 'Firmware is uploading and installing', // TODO translate
- INSTALL_VERSION: 'This will install version {0}. Are you sure?', // TODO translate
+ INSTALL_VERSION: 'This will {0} version {1}. Are you sure?', // TODO translate
SWITCH_DEV: 'switch to the development version', // TODO translate
UPGRADE_AVAILABLE: 'There is a firmware upgrade available!', // TODO translate
LATEST_VERSION: 'You are using the latest firmware version.', // TODO translate
diff --git a/mock-api/rest_server.ts b/mock-api/rest_server.ts
index bfa115189..d6b00e235 100644
--- a/mock-api/rest_server.ts
+++ b/mock-api/rest_server.ts
@@ -35,7 +35,11 @@ let LATEST_STABLE_VERSION = '3.7.0';
let LATEST_DEV_VERSION = '3.7.1-dev.4';
let VERSION_IS_UPGRADEABLE = false;
-// for testing
+// for testing - scenario 1
+// THIS_VERSION = '3.7.1-dev.1';
+// VERSION_IS_UPGRADEABLE = true;
+
+// for testing - scenario 2
// THIS_VERSION = '3.6.5';
// VERSION_IS_UPGRADEABLE = true;
diff --git a/src/test/test.cpp b/src/test/test.cpp
index a79d9bee8..3c9bf294e 100644
--- a/src/test/test.cpp
+++ b/src/test/test.cpp
@@ -1029,17 +1029,21 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
// request.url("/rest/action");
// EMSESP::webStatusService.action(&request, doc.as());
- // should show dev version and be updatable
- char data5[] = "{\"action\":\"checkUpgrade\", \"param\":\"3.7.1-dev.99,3.7.0\"}";
- deserializeJson(doc, data5);
+ // test version checks
+ // test with "current_version_s = "3.7.1-dev.8" in WebStatusService::checkUpgrade()
request.url("/rest/action");
+ deserializeJson(doc, "{\"action\":\"checkUpgrade\", \"param\":\"3.7.1-dev.9,3.7.0\"}"); // is upgradable
+ EMSESP::webStatusService.action(&request, doc.as());
+ deserializeJson(doc, "{\"action\":\"checkUpgrade\", \"param\":\"3.7.1-dev.7,3.7.0\"}"); // is not upgradable
EMSESP::webStatusService.action(&request, doc.as());
- // should show dev version and not be updatable
- char data6[] = "{\"action\":\"checkUpgrade\", \"param\":\"3.7.1-dev.4,3.7.0\"}";
- deserializeJson(doc, data6);
- request.url("/rest/action");
- EMSESP::webStatusService.action(&request, doc.as());
+ // test with "current_version_s = "3.6.5" in WebStatusService::checkUpgrade()
+ // request.url("/rest/action");
+ // deserializeJson(doc, "{\"action\":\"checkUpgrade\", \"param\":\"3.7.1-dev.9,3.6.5\"}"); // is noy upgradable
+ // EMSESP::webStatusService.action(&request, doc.as());
+ // deserializeJson(doc, "{\"action\":\"checkUpgrade\", \"param\":\"3.7.1-dev.7,3.7.0\"}"); // is upgradable
+ // EMSESP::webStatusService.action(&request, doc.as());
+
// char data6[] = "{\"device\":\"system\", \"cmd\":\"read\",\"value\":\"8 2 27 1\"}";
// deserializeJson(doc, data6);
diff --git a/src/version.h b/src/version.h
index bc1eb86f2..4386509df 100644
--- a/src/version.h
+++ b/src/version.h
@@ -1 +1 @@
-#define EMSESP_APP_VERSION "3.7.1-dev.4"
\ No newline at end of file
+#define EMSESP_APP_VERSION "3.7.1-dev.5"
\ No newline at end of file
diff --git a/src/web/WebStatusService.cpp b/src/web/WebStatusService.cpp
index 5309a423c..e9e4a3b4c 100644
--- a/src/web/WebStatusService.cpp
+++ b/src/web/WebStatusService.cpp
@@ -203,38 +203,42 @@ void WebStatusService::action(AsyncWebServerRequest * request, JsonVariant json)
}
// action = checkUpgrade
+// versions holds the latest development version and stable version in one string, comma separated
bool WebStatusService::checkUpgrade(JsonObject root, std::string & versions) {
- std::string current_version;
+ std::string current_version_s;
#ifndef EMSESP_STANDALONE
- current_version = EMSESP_APP_VERSION; // always send back current version
+ current_version_s = EMSESP_APP_VERSION;
#else
- // for testing only
- // current_version = "3.6.5";
- current_version = "3.7.0-dev-7";
+ // for testing only - see api3 test in test.cpp
+ // current_version_s = "3.6.5";
+ current_version_s = "3.7.1-dev.8";
#endif
if (!versions.empty()) {
- // versions holds the latest development version and stable version in one string, comma separated
- std::string latest_dev_version = versions.substr(0, versions.find(','));
- std::string latest_stable_version = versions.substr(versions.find(',') + 1);
-
- version::Semver200_version this_version(current_version);
- bool using_dev_version = !this_version.prerelease().find("dev");
- version::Semver200_version latest_version(using_dev_version ? latest_dev_version : latest_stable_version); // latest version
-
- root["upgradeable"] = (latest_version > this_version);
+ version::Semver200_version current_version(current_version_s);
+ bool using_dev_version = !current_version.prerelease().find("dev"); // look for dev in the name to determine if we're using dev version
+ version::Semver200_version latest_version(using_dev_version ? versions.substr(0, versions.find(',')) : versions.substr(versions.find(',') + 1));
+ bool upgradeable = (latest_version > current_version);
#if defined(EMSESP_DEBUG)
- emsesp::EMSESP::logger().debug("Checking for version upgrade. This version=%s, latest dev=%s, latest stable=%s. Using %s releases. Upgradeable=%s",
- current_version.c_str(),
- latest_dev_version.c_str(),
- latest_stable_version.c_str(),
- using_dev_version ? "dev" : "stable",
- root["upgradeable"].as() ? "true" : "false");
+ emsesp::EMSESP::logger()
+ .debug("Checking Version upgrade. Using %s release branch. current version=%d.%d.%d-%s, latest version=%d.%d.%d-%s (%s upgradeable)",
+ (using_dev_version ? "dev" : "stable"),
+ current_version.major(),
+ current_version.minor(),
+ current_version.patch(),
+ current_version.prerelease().c_str(),
+ latest_version.major(),
+ latest_version.minor(),
+ latest_version.patch(),
+ latest_version.prerelease().c_str(),
+ upgradeable ? "IS" : "NOT");
#endif
+
+ root["upgradeable"] = upgradeable;
}
- root["emsesp_version"] = current_version;
+ root["emsesp_version"] = current_version_s; // always send back current version
return true;
}