fix: display IPv6 address in device table and disable wassup provider
Build & Deploy / build (push) Successful in 31s
Build & Deploy / docker (push) Successful in 1m3s
Build & Deploy / deploy (push) Successful in 24s

- Home.vue: add getIpAddress() with IPv4/IPv6 fallback chain (TR-098, TR-181)
  hoisted regex constants, prefer interface index 1, format IPv6 with brackets
- config/references.json: disable wassup provider (mock URL unreachable)
This commit is contained in:
Kevin L'Hereec committed 2026-07-17 11:57:09 +02:00
1 parent b12141792f
commit 1fc9715888
2 files changed
+42 -2

No files matched your search

+1 -1
View File
@@ -3,7 +3,7 @@
{
"name": "wassup",
"type": "wassup",
"enabled": true,
"enabled": false,
"url": "http://wassup-mock:9999",
"timeout": 3000,
"trigger": ["BOOT", "BOOTSTRAP"],
+41 -1
View File
@@ -56,6 +56,46 @@ function getPropertyValue(props: any[], name: string): string {
return prop?.value ?? ''
}
// Hoisted regex constants — compiled once, not on every call
const RE_IPV4 = /^Device\.IP\.Interface\.\d+\.IPv4Address\.\d+\.IPAddress$/
const RE_IPV6 = /^Device\.IP\.Interface\.\d+\.IPv6Address\.\d+\.IPAddress$/
function getIpAddress(parameters: any[], properties: any[]): string {
// Priority 1 : TR-098 ExternalIPAddress (reuse existing helpers to avoid duplication)
const tr098Paths = [
'InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.ExternalIPAddress',
'Device.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.ExternalIPAddress',
]
for (const path of tr098Paths) {
const v = getParameterValue(parameters, path) || getPropertyValue(properties, path)
if (v) return v
}
// Priority 2 : TR-181 IPv4 — prefer index 1, then any index
const ipv4Exact =
getParameterValue(parameters, 'Device.IP.Interface.1.IPv4Address.1.IPAddress') ||
getPropertyValue(properties, 'Device.IP.Interface.1.IPv4Address.1.IPAddress')
if (ipv4Exact) return ipv4Exact
const ipv4Any =
parameters?.find((p: any) => RE_IPV4.test(p.name) && p.value) ||
properties?.find((p: any) => RE_IPV4.test(p.name) && p.value)
if (ipv4Any) return ipv4Any.value
// Priority 3 : TR-181 IPv6 — prefer index 1, then any index (displayed with brackets)
const ipv6Exact =
getParameterValue(parameters, 'Device.IP.Interface.1.IPv6Address.1.IPAddress') ||
getPropertyValue(properties, 'Device.IP.Interface.1.IPv6Address.1.IPAddress')
if (ipv6Exact) return `[${ipv6Exact}]`
const ipv6Any =
parameters?.find((p: any) => RE_IPV6.test(p.name) && p.value) ||
properties?.find((p: any) => RE_IPV6.test(p.name) && p.value)
if (ipv6Any) return `[${ipv6Any.value}]`
return '—'
}
function goToDevice(identifier: string) {
router.visit(`/devices/${encodeURIComponent(identifier)}`)
}
@@ -141,7 +181,7 @@ async function deleteSelected() {
<td>{{ device.deviceId?.manufacturer }}</td>
<td>{{ device.deviceId?.productClass }}</td>
<td>{{ device.deviceId?.serialNumber }}</td>
<td>{{ getParameterValue(device.parameters, 'InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.ExternalIPAddress') || getPropertyValue(device.properties, 'InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.ExternalIPAddress') || getParameterValue(device.parameters, 'Device.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.ExternalIPAddress') || getPropertyValue(device.properties, 'Device.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.ExternalIPAddress') || getParameterValue(device.parameters, 'Device.IP.Interface.1.IPv4Address.1.IPAddress') || getPropertyValue(device.properties, 'Device.IP.Interface.1.IPv4Address.1.IPAddress') || '—' }}</td>
<td>{{ getIpAddress(device.parameters, device.properties) }}</td>
<td>{{ getPropertyValue(device.properties, 'InternetGatewayDevice.DeviceInfo.SoftwareVersion') || getPropertyValue(device.properties, 'Device.DeviceInfo.SoftwareVersion') || '—' }}</td>
</tr>
</tbody>