fix: handle multi-IP and add tests for clickable IP link

Follow-up to #78:
- Use primaryIp() so href targets the first IP when data.ip is comma-separated (e.g. "192.168.1.1, 2001:db8::1")
- Add primaryIp() helper to maskIp.ts
- Add 4 tests covering single IP link, absent IP, multi-IP href, multi-IP display text
This commit is contained in:
Pouzor
2026-04-19 22:04:37 +02:00
parent 81b109f981
commit 2e6ee9dad2
3 changed files with 37 additions and 1 deletions
+5
View File
@@ -8,3 +8,8 @@ export function maskIp(ip: string): string {
if (parts.length === 4) return `${parts[0]}.${parts[1]}.XX.XX`
return ip
}
export function primaryIp(ip: string): string {
if (!ip?.trim()) return ''
return ip.split(',')[0].trim()
}