add gateway ipv6 (#3246)

This commit is contained in:
proddy
2026-09-20 12:28:25 +02:00
parent 307ae9247f
commit 7a338f465d
11 changed files with 173 additions and 91 deletions
+7 -2
View File
@@ -89,13 +89,18 @@ const AddressList = ({
));
};
const isSet = (ip?: string) => !!ip && ip !== '0.0.0.0' && ip !== '::';
const isSet = (ip?: string): ip is string => !!ip && ip !== '0.0.0.0' && ip !== '::';
const ipAddresses = ({ local_ip, ipv6 }: NetworkStatusType) => [
...(isSet(local_ip) ? [{ value: local_ip }] : []),
...(ipv6 ?? []).map(({ address, scope }) => ({ value: address, note: scope }))
];
const gateways = ({ gateway_ip, gateway_ipv6 }: NetworkStatusType) => [
...(isSet(gateway_ip) ? [{ value: gateway_ip }] : []),
...(gateway_ipv6 ?? []).filter(isSet).map((value) => ({ value }))
];
const dnsServers = ({ dns }: NetworkStatusType) =>
(dns ?? []).filter(isSet).map((value) => ({ value }));
@@ -230,7 +235,7 @@ const NetworkStatus = () => {
</ListItemAvatar>
<ListItemText
primary={LL.NETWORK_GATEWAY()}
secondary={data.gateway_ip || 'none'}
secondary={<AddressList addresses={gateways(data)} />}
/>
</ListItem>
<Divider variant="inset" component="li" />