More listener stats tweaking for MaxMind database.

This commit is contained in:
Buster "Silver Eagle" Neece 2018-07-03 23:09:36 -05:00
parent 030c259566
commit 2489d893fc
2 changed files with 7 additions and 3 deletions

View File

@ -117,15 +117,19 @@ class ListenersController
if (empty($ip_info)) {
return [
'status' => 'failure',
'status' => 'error',
'message' => 'Internal/Reserved IP',
];
}
return [
'status' => 'success',
'lat' => $ip_info['location']['latitude'] ?? 0.0,
'lon' => $ip_info['location']['longitude'] ?? 0.0,
'timezone' => $ip_info['location']['time_zone'] ?? '',
'region' => $this->_getLocalizedString($ip_info['subdivisions'][0]['names'] ?? null, $locale),
'country' => $this->_getLocalizedString($ip_info['country']['names'] ?? null, $locale),
'city' => $this->_getLocalizedString($ip_info['city']['names'] ?? null, $locale),
'message' => 'This product includes GeoLite2 data created by MaxMind, available from <a href="http://www.maxmind.com">http://www.maxmind.com</a>.',
];
}

View File

@ -66,7 +66,7 @@ $assets
</td>
<td>
<span v-if="listener.location.status == 'success'">
{{ listener.location.region}}, {{ listener.location.country }}
{{ listener.location.region }}, {{ listener.location.country }}
</span>
<span v-else-if="listener.location.message">
{{ listener.location.message }}
@ -128,7 +128,7 @@ function setMapPoints(points) {
l.id = l.location.lon + ',' + l.location.lat + ',' + l.ip;
idlist[i] = l.id;
var content = '<div style="color: black">IP: ' + l.ip + '<br>Country: ' + l.location.country + '<br>Region: ' + l.location.regionName + '<br>City: ' + l.location.city + '<br>Connected at ' + new Date(l.connected_on * 1000) + '<br>Time connected: ' + l.connected_time + '<br>User Agent: ' + l.user_agent + '</div>';
var content = '<div style="color: black">IP: ' + l.ip + '<br>Country: ' + l.location.country + '<br>Region: ' + l.location.region + '<br>City: ' + l.location.city + '<br>Connected at ' + new Date(l.connected_on * 1000) + '<br>Time connected: ' + l.connected_time + '<br>User Agent: ' + l.user_agent + '</div>';
if (mapmarkers[l.id]) {
mapmarkers[l.id].infowindow.setContent(content);