From a65670239bced6fd85b7da4a51439b7bb4e38e87 Mon Sep 17 00:00:00 2001 From: Randall Hand Date: Mon, 23 Mar 2026 18:17:27 -0400 Subject: [PATCH] feat: add rsyslog server setting to network configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add rsyslog server field to Device Configuration > Network settings, allowing users to configure remote syslog server address. Backend protobuf support already existed — this adds the UI. Co-Authored-By: Claude Opus 4.6 (1M context) --- public/locales/en.json | 2 ++ src/components/ConfigurationTab.tsx | 6 ++++ .../configuration/NetworkConfigSection.tsx | 34 ++++++++++++++++--- 3 files changed, 37 insertions(+), 5 deletions(-) diff --git a/public/locales/en.json b/public/locales/en.json index 7bbe1bbdf..f5cf0284c 100644 --- a/public/locales/en.json +++ b/public/locales/en.json @@ -2824,6 +2824,8 @@ "network_config.dns_description": "DNS server address (e.g., 8.8.8.8).", "network_config.ntp_server": "NTP Server", "network_config.ntp_server_description": "Custom NTP server address (default: meshtastic.pool.ntp.org). Maximum 33 characters.", + "network_config.rsyslog_server": "Rsyslog Server", + "network_config.rsyslog_server_description": "Remote syslog server address (e.g., 192.168.1.100:514). Leave blank to disable.", "network_config.save_button": "Save Network Config", "config.network_saved": "Network configuration saved", diff --git a/src/components/ConfigurationTab.tsx b/src/components/ConfigurationTab.tsx index fb8c872df..dcf36967c 100644 --- a/src/components/ConfigurationTab.tsx +++ b/src/components/ConfigurationTab.tsx @@ -127,6 +127,7 @@ const ConfigurationTab: React.FC = ({ nodes, channels = [ const [wifiSsid, setWifiSsid] = useState(''); const [wifiPsk, setWifiPsk] = useState(''); const [ntpServer, setNtpServer] = useState(''); + const [rsyslogServer, setRsyslogServer] = useState(''); const [addressMode, setAddressMode] = useState(0); const [ipv4Address, setIpv4Address] = useState(''); const [ipv4Gateway, setIpv4Gateway] = useState(''); @@ -488,6 +489,7 @@ const ConfigurationTab: React.FC = ({ nodes, channels = [ setWifiSsid(config.deviceConfig.network.wifiSsid || ''); setWifiPsk(config.deviceConfig.network.wifiPsk || ''); setNtpServer(config.deviceConfig.network.ntpServer || ''); + setRsyslogServer(config.deviceConfig.network.rsyslogServer || ''); setAddressMode(config.deviceConfig.network.addressMode ?? 0); // Static IP config if (config.deviceConfig.network.ipv4Config) { @@ -1015,6 +1017,7 @@ const ConfigurationTab: React.FC = ({ nodes, channels = [ wifiSsid, wifiPsk, ntpServer, + rsyslogServer, addressMode, // Static IP config - only include if using static address mode ipv4Config: addressMode === 1 ? { @@ -1702,6 +1705,7 @@ const ConfigurationTab: React.FC = ({ nodes, channels = [ // Update remaining network fields if (net.wifiPsk !== undefined) setWifiPsk(net.wifiPsk); if (net.ntpServer !== undefined) setNtpServer(net.ntpServer); + if (net.rsyslogServer !== undefined) setRsyslogServer(net.rsyslogServer); if (net.ipv4Config) { if (net.ipv4Config.ip !== undefined) setIpv4Address(net.ipv4Config.ip); if (net.ipv4Config.gateway !== undefined) setIpv4Gateway(net.ipv4Config.gateway); @@ -2295,6 +2299,8 @@ const ConfigurationTab: React.FC = ({ nodes, channels = [ setWifiPsk={setWifiPsk} ntpServer={ntpServer} setNtpServer={setNtpServer} + rsyslogServer={rsyslogServer} + setRsyslogServer={setRsyslogServer} addressMode={addressMode} setAddressMode={setAddressMode} ipv4Address={ipv4Address} diff --git a/src/components/configuration/NetworkConfigSection.tsx b/src/components/configuration/NetworkConfigSection.tsx index bf64b098f..96dba8842 100644 --- a/src/components/configuration/NetworkConfigSection.tsx +++ b/src/components/configuration/NetworkConfigSection.tsx @@ -17,6 +17,8 @@ interface NetworkConfigSectionProps { setWifiPsk: (value: string) => void; ntpServer: string; setNtpServer: (value: string) => void; + rsyslogServer: string; + setRsyslogServer: (value: string) => void; addressMode: number; setAddressMode: (value: number) => void; // Static IP config @@ -42,6 +44,8 @@ const NetworkConfigSection: React.FC = ({ setWifiPsk, ntpServer, setNtpServer, + rsyslogServer, + setRsyslogServer, addressMode, setAddressMode, ipv4Address, @@ -60,7 +64,7 @@ const NetworkConfigSection: React.FC = ({ // Track initial values for change detection const initialValuesRef = useRef({ - wifiEnabled, wifiSsid, wifiPsk, ntpServer, addressMode, + wifiEnabled, wifiSsid, wifiPsk, ntpServer, rsyslogServer, addressMode, ipv4Address, ipv4Gateway, ipv4Subnet, ipv4Dns }); @@ -72,13 +76,14 @@ const NetworkConfigSection: React.FC = ({ wifiSsid !== initial.wifiSsid || wifiPsk !== initial.wifiPsk || ntpServer !== initial.ntpServer || + rsyslogServer !== initial.rsyslogServer || addressMode !== initial.addressMode || ipv4Address !== initial.ipv4Address || ipv4Gateway !== initial.ipv4Gateway || ipv4Subnet !== initial.ipv4Subnet || ipv4Dns !== initial.ipv4Dns ); - }, [wifiEnabled, wifiSsid, wifiPsk, ntpServer, addressMode, + }, [wifiEnabled, wifiSsid, wifiPsk, ntpServer, rsyslogServer, addressMode, ipv4Address, ipv4Gateway, ipv4Subnet, ipv4Dns]); // Reset to initial values (for SaveBar dismiss) @@ -88,22 +93,23 @@ const NetworkConfigSection: React.FC = ({ setWifiSsid(initial.wifiSsid); setWifiPsk(initial.wifiPsk); setNtpServer(initial.ntpServer); + setRsyslogServer(initial.rsyslogServer); setAddressMode(initial.addressMode); setIpv4Address(initial.ipv4Address); setIpv4Gateway(initial.ipv4Gateway); setIpv4Subnet(initial.ipv4Subnet); setIpv4Dns(initial.ipv4Dns); - }, [setWifiEnabled, setWifiSsid, setWifiPsk, setNtpServer, setAddressMode, + }, [setWifiEnabled, setWifiSsid, setWifiPsk, setNtpServer, setRsyslogServer, setAddressMode, setIpv4Address, setIpv4Gateway, setIpv4Subnet, setIpv4Dns]); // Update initial values after successful save const handleSave = useCallback(async () => { await onSave(); initialValuesRef.current = { - wifiEnabled, wifiSsid, wifiPsk, ntpServer, addressMode, + wifiEnabled, wifiSsid, wifiPsk, ntpServer, rsyslogServer, addressMode, ipv4Address, ipv4Gateway, ipv4Subnet, ipv4Dns }; - }, [onSave, wifiEnabled, wifiSsid, wifiPsk, ntpServer, addressMode, + }, [onSave, wifiEnabled, wifiSsid, wifiPsk, ntpServer, rsyslogServer, addressMode, ipv4Address, ipv4Gateway, ipv4Subnet, ipv4Dns]); // Register with SaveBar @@ -326,6 +332,24 @@ const NetworkConfigSection: React.FC = ({ style={{ width: '400px' }} /> + + {/* Rsyslog Server */} +
+ + setRsyslogServer(e.target.value)} + placeholder="192.168.1.100:514" + maxLength={33} + className="setting-input" + style={{ width: '400px' }} + /> +
); };