Improved IP geolocation ui.

This commit is contained in:
Ylian Saint-Hilaire 2019-01-31 15:21:28 -08:00
parent e6ebca7820
commit f7be945aef

View File

@ -1276,18 +1276,16 @@
QH('d2netinfo', 'No network interface information available for this device.'); QH('d2netinfo', 'No network interface information available for this device.');
} else { } else {
var x = '<div style=width:100%;max-height:260px;overflow-x:hidden;overflow-y:auto;line-height:160%>'; var x = '<div style=width:100%;max-height:260px;overflow-x:hidden;overflow-y:auto;line-height:160%>';
if (currentNode.publicip) {
x += addHtmlValue2('Public IP address', currentNode.publicip); if (currentNode.lastconnect) { x += addHtmlValue2('Last agent connection', new Date(currentNode.lastconnect).toLocaleString()); }
} else { if (currentNode.lastaddr) {
if (currentNode.lastconnect) { x += addHtmlValue2('Last agent connection', new Date(currentNode.lastconnect).toLocaleString()); } if (isPrivateIP(currentNode.lastaddr)) {
if (currentNode.lastaddr) { x += addHtmlValue2('Last agent address', currentNode.lastaddr.split(':')[0]);
if (isPrivateIP(currentNode.lastaddr)) { } else {
x += addHtmlValue2('Last agent address:port', currentNode.lastaddr); x += addHtmlValue2('Last agent address', '<a href="https://iplocation.com/?ip=' + currentNode.lastaddr.split(':')[0] + '" rel="noreferrer noopener" target=_blank>' + currentNode.lastaddr.split(':')[0] + '</a>');
} else {
x += addHtmlValue2('Last agent address:port', '<a href="https://iplocation.com/?ip=' + currentNode.lastaddr.split(':')[0] + '" rel="noreferrer noopener" target=_blank>' + currentNode.lastaddr + '</a>');
}
} }
} }
x += addHtmlValue2('Last interfaces update', new Date(message.updateTime).toLocaleString()); x += addHtmlValue2('Last interfaces update', new Date(message.updateTime).toLocaleString());
for (var i in message.netif) { for (var i in message.netif) {
var net = message.netif[i]; var net = message.netif[i];