This commit is contained in:
proddy
2025-04-05 10:54:55 +02:00
parent 6e01c00d46
commit 3ed5b65191
15 changed files with 344 additions and 333 deletions

View File

@@ -2,6 +2,7 @@ import { useContext, useEffect, useState } from 'react';
import { toast } from 'react-toastify';
import CancelIcon from '@mui/icons-material/Cancel';
import CloseIcon from '@mui/icons-material/Close';
import CheckIcon from '@mui/icons-material/Done';
import DownloadIcon from '@mui/icons-material/GetApp';
import WarningIcon from '@mui/icons-material/Warning';
@@ -78,7 +79,7 @@ const Version = () => {
send: loadData,
error
} = useRequest(SystemApi.readSystemStatus).onSuccess((event) => {
// older version of EMS-ESP on 4MB boards, can't use OTA because of SSL support in HttpClient
// older version of EMS-ESP using ESP32 (not S3) and no PSRAM, can't use OTA because of SSL support in HttpClient
if (event.data.arduino_version.startsWith('Tasmota')) {
setDownloadOnly(true);
}
@@ -145,20 +146,21 @@ const Version = () => {
);
};
const getBinURL = () => {
const getBinURL = (showingDev: boolean) => {
if (!internetLive) {
return '';
}
const filename =
'EMS-ESP-' +
(fetchDevVersion ? latestDevVersion.name : latestVersion.name).replaceAll(
(showingDev ? latestDevVersion.name : latestVersion.name).replaceAll(
'.',
'_'
) +
'-' +
getPlatform() +
'.bin';
return fetchDevVersion
return showingDev
? DEV_URL + filename
: STABLE_URL + 'v' + latestVersion.name + '/' + filename;
};
@@ -180,7 +182,7 @@ const Version = () => {
useLayoutTitle('EMS-ESP Firmware');
const renderInstallDialog = () => {
const binURL = getBinURL();
const binURL = getBinURL(fetchDevVersion);
return (
<Dialog
@@ -189,7 +191,7 @@ const Version = () => {
onClose={() => closeInstallDialog()}
>
<DialogTitle>
{LL.INSTALL() +
{LL.UPDATE() +
' ' +
(fetchDevVersion ? LL.DEVELOPMENT() : LL.STABLE()) +
' Firmware'}
@@ -197,6 +199,7 @@ const Version = () => {
<DialogContent dividers>
<Typography mb={2}>
{LL.INSTALL_VERSION(
downloadOnly ? LL.DOWNLOAD(1) : LL.INSTALL(),
fetchDevVersion ? latestDevVersion?.name : latestVersion?.name
)}
</Typography>
@@ -220,14 +223,16 @@ const Version = () => {
{LL.DOWNLOAD(1)}
</Link>
</Button>
<Button
startIcon={<WarningIcon color="warning" />}
variant="outlined"
onClick={() => installFirmwareURL(binURL)}
color="primary"
>
{LL.INSTALL()}
</Button>
{!downloadOnly && (
<Button
startIcon={<WarningIcon color="warning" />}
variant="outlined"
onClick={() => installFirmwareURL(binURL)}
color="primary"
>
{LL.INSTALL()}
</Button>
)}
</DialogActions>
</Dialog>
);
@@ -273,23 +278,6 @@ const Version = () => {
return;
}
if (downloadOnly) {
return (
<Button
sx={{ ml: 2 }}
startIcon={<DownloadIcon />}
variant="outlined"
onClick={() => setOpenInstallDialog(false)}
color="warning"
size="small"
>
<Link underline="none" target="_blank" href={getBinURL()} color="warning">
{LL.DOWNLOAD(1)}
</Link>
</Button>
);
}
return (
<Button
sx={{ ml: 2 }}
@@ -347,7 +335,25 @@ const Version = () => {
<Typography>
{getPlatform()}
<Typography variant="caption">
&nbsp; &#40;{data.psram ? '+PSRAM' : '-PSRAM'}&#41;
&nbsp; &#40;
{data.psram ? (
<CheckIcon
color="success"
sx={{
fontSize: '1.5em',
verticalAlign: 'middle'
}}
/>
) : (
<CloseIcon
color="error"
sx={{
fontSize: '1.5em',
verticalAlign: 'middle'
}}
/>
)}
PSRAM&#41;
</Typography>
</Typography>
</Grid>

View File

@@ -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 instalovat verze {0}. Jste si jistí?',
INSTALL_VERSION: 'Tímto se {0} verze {1}. Jste si jistí?',
UPDATE_AVAILABLE: 'update available', // TODO translate
LATEST_VERSION: 'Používáte nejnovější verzi {0}firmwaru',
PLEASE_WAIT: 'Prosím čekejte',

View File

@@ -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 {0} heruntergeladen. Sind Sie sicher?',
INSTALL_VERSION: 'Dadurch wird die Version {1} {0}. Sind Sie sicher?',
UPDATE_AVAILABLE: 'Firmware-Update verfügbar',
LATEST_VERSION: 'Sie verwenden die neueste {0} Firmware-Version',
PLEASE_WAIT: 'Bitte warten',

View File

@@ -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?',
UPDATE_AVAILABLE: 'update available',
LATEST_VERSION: 'You are using the latest {0} firmware version',
PLEASE_WAIT: 'Please wait',

View File

@@ -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
UPDATE_AVAILABLE: 'update available', // TODO translate
LATEST_VERSION: 'You are using the latest {0} firmware version', // TODO translate
PLEASE_WAIT: 'Please wait', // TODO translate

View File

@@ -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
UPDATE_AVAILABLE: 'update available', // TODO translate
LATEST_VERSION: 'You are using the latest {0}firmware version', // TODO translate
PLEASE_WAIT: 'Please wait', // TODO translate

View File

@@ -331,7 +331,7 @@ const nl: Translation = {
ALLVALUES: 'All waarden',
SPECIAL_FUNCTIONS: 'Speciale functies',
WAIT_FIRMWARE: 'Firmware wordt geüpload en geïnstalleerd',
INSTALL_VERSION: 'Hiermee wordt versie {0} geïnstalleerd. Weet je het zeker?',
INSTALL_VERSION: 'Hiermee wordt versie {1} {0}. Weet je het zeker?',
UPDATE_AVAILABLE: 'update beschikbaar',
LATEST_VERSION: 'U gebruikt de nieuwste {0} firmwareversie',
PLEASE_WAIT: 'Een ogenblik geduld',

View File

@@ -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
UPDATE_AVAILABLE: 'update available', // TODO translate
LATEST_VERSION: 'You are using the latest {0}firmware version', // TODO translate
PLEASE_WAIT: 'Please wait', // TODO translate

View File

@@ -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
UPDATE_AVAILABLE: 'update available', // TODO translate
LATEST_VERSION: 'You are using the latest {0} firmware version', // TODO translate
PLEASE_WAIT: 'Please wait', // TODO translate

View File

@@ -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 inštalovať verzia {0}. Si si istý?',
INSTALL_VERSION: 'Týmto sa {0} verzia {1}. Si si istý?',
UPDATE_AVAILABLE: 'update available', // TODO translate
LATEST_VERSION: 'Používate poslednú {0} verziu firmvéru',
PLEASE_WAIT: 'Čakajte prosím',

View File

@@ -331,7 +331,7 @@ const sv: Translation = {
ALLVALUES: 'Alla värden',
SPECIAL_FUNCTIONS: 'Specialfunktioner',
WAIT_FIRMWARE: 'Firmware laddas upp och installeras',
INSTALL_VERSION: 'Det här kommer installera version {0}. Är du säker?',
INSTALL_VERSION: 'Det här kommer {0} version {1}. Är du säker?',
UPDATE_AVAILABLE: 'update available', // TODO translate
LATEST_VERSION: 'Du använder den senaste {0} firmwareversionen.',
PLEASE_WAIT: 'Var god vänta',

View File

@@ -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
UPDATE_AVAILABLE: 'update available!', // TODO translate
LATEST_VERSION: 'You are using the latest {0}firmware version.', // TODO translate
PLEASE_WAIT: 'Please wait', // TODO translate