diff --git a/interface/pnpm-workspace.yaml b/interface/pnpm-workspace.yaml new file mode 100644 index 000000000..613c8cdaf --- /dev/null +++ b/interface/pnpm-workspace.yaml @@ -0,0 +1,11 @@ +allowBuilds: + cwebp-bin: false + esbuild: false + gifsicle: false + jpegtran-bin: false + mozjpeg: false + optipng-bin: false + pngquant-bin: false +minimumReleaseAgeExclude: + - '@types/node@25.9.2' + - '@types/react@19.2.17' diff --git a/interface/src/app/main/types.ts b/interface/src/app/main/types.ts index 80bc10d20..391c22a01 100644 --- a/interface/src/app/main/types.ts +++ b/interface/src/app/main/types.ts @@ -1,4 +1,5 @@ export interface Settings { + system_name: string; locale: string; tx_mode: number; ems_bus_id: number; diff --git a/interface/src/app/settings/ApplicationSettings.tsx b/interface/src/app/settings/ApplicationSettings.tsx index 60e240a80..17e55e7e3 100644 --- a/interface/src/app/settings/ApplicationSettings.tsx +++ b/interface/src/app/settings/ApplicationSettings.tsx @@ -189,7 +189,19 @@ const ApplicationSettings = () => { return ( <> - + + {LL.SYSTEM(0)}  + {LL.CUSTOMIZATIONS()} + + + {LL.SERVICES()} API diff --git a/interface/src/components/layout/LayoutDrawer.tsx b/interface/src/components/layout/LayoutDrawer.tsx index 89237615f..debe49bcb 100644 --- a/interface/src/components/layout/LayoutDrawer.tsx +++ b/interface/src/components/layout/LayoutDrawer.tsx @@ -2,6 +2,9 @@ import { memo } from 'react'; import { Box, Divider, Drawer, Toolbar, Typography, styled } from '@mui/material'; +import { readSettings } from 'api/app'; + +import { useRequest } from 'alova/client'; import { PROJECT_NAME } from 'env'; import { DRAWER_WIDTH } from './Layout'; @@ -24,12 +27,28 @@ interface LayoutDrawerProps { } const LayoutDrawerComponent = ({ mobileOpen, onClose }: LayoutDrawerProps) => { + const { data: settings } = useRequest(readSettings); + const system_name = settings?.system_name; + const drawer = ( <> - {PROJECT_NAME} + + {PROJECT_NAME} + {system_name && ( + + {system_name} + + )} + diff --git a/interface/src/i18n/cz/index.ts b/interface/src/i18n/cz/index.ts index 32e03654f..9aa52367a 100644 --- a/interface/src/i18n/cz/index.ts +++ b/interface/src/i18n/cz/index.ts @@ -363,7 +363,8 @@ const cz: Translation = { UPGRADE_IMPORTANT_MESSAGES_1: 'Tato aktualizace vyžaduje obnovení továrního nastavení. Ujistěte se, že nejprve stáhnete systémovou zálohu před pokračováním a poté nahrajte tento soubor po instalaci nové verze.', UPGRADE_IMPORTANT_MESSAGES_2: 'Aktualizujete se na novou hlavní verzi. Ujistěte se, že jste přečetli ChangeLog pro jakékoliv závažné změny.', WARNING_SYSTEM_BACKUP: 'Toto vytvoří zálohu vašich celých systémových konfigurací a nastavení. Všechna hesla budou v zálohovém souboru čitelná. Buďte opatrní při sdílení! Opravdu chcete pokračovat?', - TEST_EMAIL_SUCCESSFUL: 'Test email byl úspěšně odeslán' + TEST_EMAIL_SUCCESSFUL: 'Test email byl úspěšně odeslán', + SYSTEM_NAME: 'Název systému' }; export default cz; diff --git a/interface/src/i18n/de/index.ts b/interface/src/i18n/de/index.ts index b6a43b923..4aa9d5bb9 100644 --- a/interface/src/i18n/de/index.ts +++ b/interface/src/i18n/de/index.ts @@ -363,7 +363,8 @@ const de: Translation = { UPGRADE_IMPORTANT_MESSAGES_1: 'Für diese Aktualisierung ist ein Werksreset erforderlich. Stellen Sie sicher, dass Sie zuerst eine Systemsicherung herunterladen, bevor Sie fortfahren, und laden Sie diese Datei dann nach der Installation der neuen Version hoch.', UPGRADE_IMPORTANT_MESSAGES_2: 'Sie aktualisieren auf eine neue Hauptversion. Stellen Sie sicher, dass Sie den ChangeLog für alle wichtigen Änderungen gelesen haben.', WARNING_SYSTEM_BACKUP: 'Dies wird eine Sicherung Ihrer vollständigen Systemkonfiguration und Einstellungen erstellen. Alle Passwörter werden in dieser Sicherungsdatei lesbar sein. Seien Sie vorsichtig beim Teilen! Möchten Sie fortfahren?', - TEST_EMAIL_SUCCESSFUL: 'Test email erfolgreich gesendet' + TEST_EMAIL_SUCCESSFUL: 'Test email erfolgreich gesendet', + SYSTEM_NAME: 'Systemname' }; export default de; diff --git a/interface/src/i18n/en/index.ts b/interface/src/i18n/en/index.ts index e02415987..8c46008ff 100644 --- a/interface/src/i18n/en/index.ts +++ b/interface/src/i18n/en/index.ts @@ -363,7 +363,8 @@ const en: Translation = { UPGRADE_IMPORTANT_MESSAGES_1: 'This upgrade requires a factory reset. Make sure you first download a System Backup before continuing, and then upload this file after the new version is installed.', UPGRADE_IMPORTANT_MESSAGES_2: 'You are upgrading to a new major version. Make sure you have read the ChangeLog for any breaking changes.', WARNING_SYSTEM_BACKUP: 'This will create a backup of your full system configuration and settings. All passwords will be readable in the backup file. Be careful with sharing! Do you want to continue?', - TEST_EMAIL_SUCCESSFUL: 'Test email sent successfully' + TEST_EMAIL_SUCCESSFUL: 'Test email sent successfully', + SYSTEM_NAME: 'System Name' }; export default en; diff --git a/interface/src/i18n/fr/index.ts b/interface/src/i18n/fr/index.ts index a4b1c031e..a28c5379f 100644 --- a/interface/src/i18n/fr/index.ts +++ b/interface/src/i18n/fr/index.ts @@ -363,7 +363,8 @@ const fr: Translation = { UPGRADE_IMPORTANT_MESSAGES_1: 'Cette mise à jour nécessite une réinitialisation de fabrique. Assurez-vous de télécharger une sauvegarde système avant de continuer, et de la charger après l\'installation de la nouvelle version.', UPGRADE_IMPORTANT_MESSAGES_2: 'Vous mettez à jour vers une nouvelle version majeure. Assurez-vous de lire le ChangeLog pour tout changement important.', WARNING_SYSTEM_BACKUP: 'Cela créera une sauvegarde de votre configuration et paramètres complets. Tous les mots de passe seront lisibles dans le fichier de sauvegarde. Soyez prudent avec le partage ! Voulez-vous continuer ?', - TEST_EMAIL_SUCCESSFUL: 'Test email envoyé avec succès' + TEST_EMAIL_SUCCESSFUL: 'Test email envoyé avec succès', + SYSTEM_NAME: 'Nom du système' }; export default fr; diff --git a/interface/src/i18n/it/index.ts b/interface/src/i18n/it/index.ts index 0c86e8729..dcd1d3942 100644 --- a/interface/src/i18n/it/index.ts +++ b/interface/src/i18n/it/index.ts @@ -363,7 +363,8 @@ const it: Translation = { UPGRADE_IMPORTANT_MESSAGES_1: 'Questa aggiornamento richiede un ripristino di fabbrica. Assicurati di prima scaricare un backup del sistema prima di continuare, e poi caricare questo file dopo l\'installazione della nuova versione.', UPGRADE_IMPORTANT_MESSAGES_2: 'Stai aggiornando a una nuova versione principale. Assicurati di aver letto il ChangeLog per qualsiasi cambiamento importante.', WARNING_SYSTEM_BACKUP: 'Questo creerà un backup delle tue configurazioni e impostazioni complete. Tutte le password saranno leggibili nel file di backup. Sei sicuro di voler continuare?', - TEST_EMAIL_SUCCESSFUL: 'Test email inviata con successo' + TEST_EMAIL_SUCCESSFUL: 'Test email inviata con successo', + SYSTEM_NAME: 'Nome del sistema' }; export default it; diff --git a/interface/src/i18n/nl/index.ts b/interface/src/i18n/nl/index.ts index bee059f8f..1d989d850 100644 --- a/interface/src/i18n/nl/index.ts +++ b/interface/src/i18n/nl/index.ts @@ -363,7 +363,8 @@ const nl: Translation = { UPGRADE_IMPORTANT_MESSAGES_1: 'Deze upgrade vereist een fabrieksinstelling. Zorg ervoor dat u eerst een Systeem Backup download voordat u doorgaat, en upload deze file na de installatie van de nieuwe versie.', UPGRADE_IMPORTANT_MESSAGES_2: 'U updatet naar een nieuwe grote versie. Zorg ervoor dat u de ChangeLog hebt gelezen voor alle brekende wijzigingen.', WARNING_SYSTEM_BACKUP: 'Dit zal een back-up van uw volledige systeemconfiguratie en instellingen maken. Alle wachtwoorden zijn leesbaar in het back-upbestand. Wees voorzichtig bij delen! Wilt u doorgaan?', - TEST_EMAIL_SUCCESSFUL: 'Test email verzonden succesvol' + TEST_EMAIL_SUCCESSFUL: 'Test email verzonden succesvol', + SYSTEM_NAME: 'Systeemnaam' }; export default nl; diff --git a/interface/src/i18n/no/index.ts b/interface/src/i18n/no/index.ts index 7817faeb7..2c3b1acc0 100644 --- a/interface/src/i18n/no/index.ts +++ b/interface/src/i18n/no/index.ts @@ -363,7 +363,8 @@ const no: Translation = { UPGRADE_IMPORTANT_MESSAGES_1: 'Denne oppdateringen krever en fabriksinstilling. Sørg for at du først lastet ned en System Backup før du fortsetter, og last denne filen etter at den nye versjonen er installert.', UPGRADE_IMPORTANT_MESSAGES_2: 'Du oppdaterer til en ny hovedversjon. Sørg for at du har lest ChangeLog for eventuelle bruddende endringer.', WARNING_SYSTEM_BACKUP: 'Dette vil lage en sikkerhetskopi av din fullstendige systemkonfigurasjon og innstillinger. Alle passord vil være lesbare i sikkerhetskopien. Vær forsiktig med deling! Vil du fortsette?', - TEST_EMAIL_SUCCESSFUL: 'Test email sendt suksessfullt' + TEST_EMAIL_SUCCESSFUL: 'Test email sendt suksessfullt', + SYSTEM_NAME: 'Systemnavn' }; export default no; diff --git a/interface/src/i18n/pl/index.ts b/interface/src/i18n/pl/index.ts index d0cea7a59..7f01b15be 100644 --- a/interface/src/i18n/pl/index.ts +++ b/interface/src/i18n/pl/index.ts @@ -363,7 +363,8 @@ const pl: BaseTranslation = { UPGRADE_IMPORTANT_MESSAGES_1: 'Ta aktualizacja wymaga resetu fabrycznego. Upewnij się, że najpierw pobierzesz kopię zapasową systemu przed kontynuowaniem, a następnie przesuń tę plik po zainstalowaniu nowej wersji.', UPGRADE_IMPORTANT_MESSAGES_2: 'Aktualizujesz się do nowej głównej wersji. Upewnij się, że przeczytałeś ChangeLog dla wszelkich istotnych zmian.', WARNING_SYSTEM_BACKUP: 'To spowoduje utworzenie kopii zapasowej całej konfiguracji i ustawień systemu. Wszystkie hasła będą widoczne w pliku kopii zapasowej. Bądź ostrożny przy udostępnianiu! Chcesz kontynuować?', - TEST_EMAIL_SUCCESSFUL: 'Test email wysłany pomyślnie' + TEST_EMAIL_SUCCESSFUL: 'Test email wysłany pomyślnie', + SYSTEM_NAME: 'Nazwa systemu' }; export default pl; diff --git a/interface/src/i18n/sk/index.ts b/interface/src/i18n/sk/index.ts index d18c12a7a..bafe9916b 100644 --- a/interface/src/i18n/sk/index.ts +++ b/interface/src/i18n/sk/index.ts @@ -363,7 +363,8 @@ const sk: Translation = { UPGRADE_IMPORTANT_MESSAGES_1: 'Táto aktualizácia vyžaduje reštart základných nastavení. Uistite sa, že najprv stiahnete systémovú zálohu pred pokračovaním, a potom nahrajte tento súbor po instalácii novej verzie.', UPGRADE_IMPORTANT_MESSAGES_2: 'Aktualizujete sa na novú hlavnú verziu. Uistite sa, že ste prečítali ChangeLog pre akékoľvek dôležité zmeny.', WARNING_SYSTEM_BACKUP: 'Toto vytvorí zálohu všetkých vašich celých systémových konfigurácií a nastavení. Všetky hesla budú čitateľné v zálohovom súbore. Buďte opatrní pri zdieľaní! Chcete pokračovať?', - TEST_EMAIL_SUCCESSFUL: 'Test email bol úspešne odoslaný' + TEST_EMAIL_SUCCESSFUL: 'Test email bol úspešne odoslaný', + SYSTEM_NAME: 'Názov systému' }; export default sk; diff --git a/interface/src/i18n/sv/index.ts b/interface/src/i18n/sv/index.ts index fb3e644a6..d67ad48f1 100644 --- a/interface/src/i18n/sv/index.ts +++ b/interface/src/i18n/sv/index.ts @@ -363,7 +363,8 @@ const sv: Translation = { UPGRADE_IMPORTANT_MESSAGES_1: 'Denna uppdatering kräver en fabriksåterställning. Se till att du först laddar ned en System Backup innan du fortsätter, och ladda upp denna fil efter att den nya versionen är installerad.', UPGRADE_IMPORTANT_MESSAGES_2: 'Du uppdaterar till en ny huvudversion. Se till att du har läst ChangeLog för eventuella brkande ändringar.', WARNING_SYSTEM_BACKUP: 'Detta kommer att skapa en säkerhetskopia av din fullständiga systemkonfiguration och inställningar. Alla lösenord kommer att vara läsbara i säkerhetskopien. Var försiktig med att dela! Vill du fortsätta?', - TEST_EMAIL_SUCCESSFUL: 'Test email skickad lyckades' + TEST_EMAIL_SUCCESSFUL: 'Test email skickad lyckades', + SYSTEM_NAME: 'Systemnamn' }; export default sv; diff --git a/interface/src/i18n/tr/index.ts b/interface/src/i18n/tr/index.ts index 36b934b3c..4059a9d9e 100644 --- a/interface/src/i18n/tr/index.ts +++ b/interface/src/i18n/tr/index.ts @@ -363,7 +363,8 @@ const tr: Translation = { UPGRADE_IMPORTANT_MESSAGES_1: 'Bu güncelleme továrnı ayarlarını gerektirir. Yapılandırmanızı ve ayarlarınızı önce yedekleyin ve ardından yeni sürüm yüklendikten sonra yükleyin.', UPGRADE_IMPORTANT_MESSAGES_2: 'Yeni bir büyük sürüme yükselteceksiniz. Değişiklikleri ChangeLogı okuduğunuzdan emin olun.', WARNING_SYSTEM_BACKUP: 'Bu, sistem yapılandırmanızı ve ayarlarınızın bir yedeklemesi oluşturacaktır. Tüm şifreler yedekleme dosyasında okunabilir olacaktır. Paylaşırken dikkatli olun! Devam etmek istediğinize emin misiniz?', - TEST_EMAIL_SUCCESSFUL: 'Test email başarıyla gönderildi' + TEST_EMAIL_SUCCESSFUL: 'Test email başarıyla gönderildi', + SYSTEM_NAME: 'Sistem Adı' }; export default tr; diff --git a/mock-api/restServer.ts b/mock-api/restServer.ts index 18ace9b04..eda4d9c7e 100644 --- a/mock-api/restServer.ts +++ b/mock-api/restServer.ts @@ -15,6 +15,7 @@ const headers = { // EMS-ESP Application Settings let settings = { + system_name: '', locale: 'en', tx_mode: 1, ems_bus_id: 11, diff --git a/src/core/default_settings.h b/src/core/default_settings.h index 031056429..681622a68 100644 --- a/src/core/default_settings.h +++ b/src/core/default_settings.h @@ -21,6 +21,10 @@ // GENERAL SETTINGS +#ifndef EMSESP_DEFAULT_SYSTEM_NAME +#define EMSESP_DEFAULT_SYSTEM_NAME "" +#endif + #ifndef EMSESP_DEFAULT_LOCALE #define EMSESP_DEFAULT_LOCALE EMSESP_LOCALE_EN // English #endif diff --git a/src/core/system.cpp b/src/core/system.cpp index df63c2930..4af5a03f9 100644 --- a/src/core/system.cpp +++ b/src/core/system.cpp @@ -684,6 +684,7 @@ void System::store_settings(WebSettings & settings) { enum_format_ = settings.enum_format; readonly_mode_ = settings.readonly_mode; locale_ = settings.locale; + system_name_ = settings.system_name; developer_mode_ = settings.developer_mode; } @@ -836,8 +837,9 @@ void System::send_info_mqtt() { } _connection = connection; JsonDocument doc; - // doc["event"] = "connected"; + doc["version"] = EMSESP_APP_VERSION; + doc["system_name"] = system_name_.isEmpty() ? "EMS-ESP" : system_name_; // if NTP is enabled send the boot_time in local time in ISO 8601 format (eg: 2022-11-15 20:46:38) // https://github.com/emsesp/EMS-ESP32/issues/751 @@ -852,16 +854,6 @@ void System::send_info_mqtt() { if (EMSESP::network_.ethernet_connected()) { doc["network"] = "ethernet"; doc["hostname"] = ETH.getHostname(); - /* - doc["MAC"] = ETH.macAddress(); - doc["IPv4 address"] = uuid::printable_to_string(ETH.localIP()) + "/" + uuid::printable_to_string(ETH.subnetMask()); - doc["IPv4 gateway"] = uuid::printable_to_string(ETH.gatewayIP()); - doc["IPv4 nameserver"] = uuid::printable_to_string(ETH.dnsIP()); - if (ETH.localIPv6().toString() != "0000:0000:0000:0000:0000:0000:0000:0000" && ETH.localIPv6().toString() != "::") { - doc["IPv6 address"] = uuid::printable_to_string(ETH.localIPv6()); - } - */ - } else if (EMSESP::network_.wifi_connected()) { doc["network"] = "wifi"; doc["hostname"] = WiFi.getHostname(); diff --git a/src/core/system.h b/src/core/system.h index 6c6f62e2c..d09d4bfc6 100644 --- a/src/core/system.h +++ b/src/core/system.h @@ -265,6 +265,10 @@ class System { return std::string(locale_.c_str()); } + std::string system_name() { + return std::string(system_name_.c_str()); + } + void healthcheck(uint8_t healthcheck) { healthcheck_ = healthcheck; } @@ -410,6 +414,7 @@ class System { // EMS-ESP settings std::string hostname_; + String system_name_; String locale_; bool low_clock_; String board_profile_; diff --git a/src/web/WebSettingsService.cpp b/src/web/WebSettingsService.cpp index 38769e33d..db13df2d3 100644 --- a/src/web/WebSettingsService.cpp +++ b/src/web/WebSettingsService.cpp @@ -36,6 +36,7 @@ void WebSettings::read(WebSettings & settings, JsonObject root) { root["version"] = settings.version; root["board_profile"] = settings.board_profile; root["platform"] = EMSESP_PLATFORM; + root["system_name"] = settings.system_name; root["locale"] = settings.locale; root["tx_mode"] = settings.tx_mode; root["ems_bus_id"] = settings.ems_bus_id; @@ -284,6 +285,8 @@ StateUpdateResult WebSettings::update(JsonObject root, WebSettings & settings) { // // without checks or necessary restarts... // + settings.system_name = root["system_name"] | EMSESP_DEFAULT_SYSTEM_NAME; + settings.trace_raw = root["trace_raw"] | EMSESP_DEFAULT_TRACELOG_RAW; EMSESP::trace_raw(settings.trace_raw); diff --git a/src/web/WebSettingsService.h b/src/web/WebSettingsService.h index 0574437c1..29695a599 100644 --- a/src/web/WebSettingsService.h +++ b/src/web/WebSettingsService.h @@ -58,6 +58,7 @@ namespace emsesp { class WebSettings { public: String version = EMSESP_APP_VERSION; + String system_name; String locale; uint8_t tx_mode; uint8_t ems_bus_id;