mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-06-09 18:19:36 +00:00
Feature Request: Make the "EMS-ESP" title text in the web interface configurable.
Fixes #3110
This commit is contained in:
11
interface/pnpm-workspace.yaml
Normal file
11
interface/pnpm-workspace.yaml
Normal file
@@ -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'
|
||||
@@ -1,4 +1,5 @@
|
||||
export interface Settings {
|
||||
system_name: string;
|
||||
locale: string;
|
||||
tx_mode: number;
|
||||
ems_bus_id: number;
|
||||
|
||||
@@ -189,7 +189,19 @@ const ApplicationSettings = () => {
|
||||
|
||||
return (
|
||||
<>
|
||||
<Typography sx={{ pb: 1 }} variant="h6" color="primary">
|
||||
<Typography variant="h6" color="primary">
|
||||
{LL.SYSTEM(0)}
|
||||
{LL.CUSTOMIZATIONS()}
|
||||
</Typography>
|
||||
<TextField
|
||||
name="system_name"
|
||||
label={LL.SYSTEM_NAME()}
|
||||
value={data.system_name}
|
||||
variant="outlined"
|
||||
onChange={updateFormValue}
|
||||
margin="normal"
|
||||
/>
|
||||
<Typography sx={{ pb: 1, pt: 2 }} variant="h6" color="primary">
|
||||
{LL.SERVICES()}
|
||||
</Typography>
|
||||
<Typography color="secondary">API</Typography>
|
||||
|
||||
@@ -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 = (
|
||||
<>
|
||||
<Toolbar disableGutters>
|
||||
<Box sx={{ display: 'flex', alignItems: 'center', p: 2 }}>
|
||||
<LayoutDrawerLogo src="/app/icon.png" alt={PROJECT_NAME} />
|
||||
<Typography variant="h6">{PROJECT_NAME}</Typography>
|
||||
<Box
|
||||
sx={{
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
justifyContent: 'center'
|
||||
}}
|
||||
>
|
||||
<Typography>{PROJECT_NAME}</Typography>
|
||||
{system_name && (
|
||||
<Typography color="secondary" variant="body2">
|
||||
{system_name}
|
||||
</Typography>
|
||||
)}
|
||||
</Box>
|
||||
</Box>
|
||||
<Divider absolute />
|
||||
</Toolbar>
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -15,6 +15,7 @@ const headers = {
|
||||
|
||||
// EMS-ESP Application Settings
|
||||
let settings = {
|
||||
system_name: '',
|
||||
locale: 'en',
|
||||
tx_mode: 1,
|
||||
ems_bus_id: 11,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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_;
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user