From 3b1532e9753e574dd11820dafda49014c69449d7 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sun, 12 Mar 2023 22:58:31 +0100 Subject: html: fix links to infobyip.com for IPv6 --- html/index.html | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'html') diff --git a/html/index.html b/html/index.html index 4a9ac19..7ac4100 100644 --- a/html/index.html +++ b/html/index.html @@ -239,11 +239,17 @@ Endpoint.prototype.sortable_value = function(value) { Endpoint.prototype.cell_contents = function(value) { value = this.sortable_value(value); - if (value == '-') + if (value == '' || value == '-') return Field.prototype.cell_contents.call(this, value); - let parts = value.split(':'); - let ip = parts[0]; + let ip = value; + + let idx = value.lastIndexOf(':'); + if (idx >= 0) + ip = value.substring(0, idx); + + if (ip.charAt(0) == '[' && ip.slice(-1) == ']') + ip = ip.slice(1, -1); let elem = document.createElement('a'); elem.setAttribute('href', 'https://infobyip.com/ip-' + ip + '.html'); -- cgit v1.2.3