update IP lookup api
This commit is contained in:
parent
0d3e2cb0bc
commit
b2a3625288
@ -111,7 +111,7 @@ namespace IW4MAdmin.Plugins.Welcome
|
||||
try
|
||||
{
|
||||
var response =
|
||||
await wc.GetStringAsync(new Uri($"http://extreme-ip-lookup.com/json/{ip}?key=demo"));
|
||||
await wc.GetStringAsync(new Uri($"http://ip-api.com/json/{ip}"));
|
||||
var responseObj = JObject.Parse(response);
|
||||
response = responseObj["country"]?.ToString();
|
||||
|
||||
|
@ -96,33 +96,24 @@
|
||||
$('.ip-locate-link').click(function (e) {
|
||||
e.preventDefault();
|
||||
const ip = $(this).data("ip");
|
||||
$.getJSON('https://extreme-ip-lookup.com/json/' + ip + '?key=demo')
|
||||
$.getJSON( `http://ip-api.com/json/${ip}`)
|
||||
.done(function (response) {
|
||||
$('#mainModal .modal-title').text(ip);
|
||||
$('#mainModal .modal-body').text('');
|
||||
if (response.ipName.length > 0) {
|
||||
$('#mainModal .modal-body').append(`${_localization['WEBFRONT_PROFILE_LOOKUP_HOSTNAME']} — ${response.ipName}<br/>`);
|
||||
}
|
||||
if (response.isp.length > 0) {
|
||||
$('#mainModal .modal-body').append(`${_localization['WEBFRONT_PROFILE_LOOKUP_ISP']} — ${response.isp}<br/>`);
|
||||
}
|
||||
if (response.org.length > 0) {
|
||||
$('#mainModal .modal-body').append(`${_localization['WEBFRONT_PROFILE_LOOKUP_ORG']} — ${response.org}<br/>`);
|
||||
}
|
||||
if (response['businessName'].length > 0) {
|
||||
$('#mainModal .modal-body').append(`${_localization['WEBFRONT_PROFILE_LOOKUP_BUSINESS']} — ${response.businessName}<br/>`);
|
||||
}
|
||||
if (response['businessWebsite'].length > 0) {
|
||||
$('#mainModal .modal-body').append(`${_localization['WEBFRONT_PROFILE_LOOKUP_WEBSITE']} — ${response.businessWebsite}<br/>`);
|
||||
}
|
||||
if (response.city.length > 0 || response.region.length > 0 || response.country.length > 0) {
|
||||
if (response.regionName.length > 0 || response.city.length > 0 || response.country.length > 0) {
|
||||
$('#mainModal .modal-body').append(`${_localization['WEBFRONT_PROFILE_LOOKUP_LOCATION']} — `);
|
||||
}
|
||||
if (response.city.length > 0) {
|
||||
$('#mainModal .modal-body').append(response.city);
|
||||
}
|
||||
if (response.region.length > 0) {
|
||||
$('#mainModal .modal-body').append((response.city.length > 0 ? ', ' : '') + response.region);
|
||||
if (response.regionName.length > 0) {
|
||||
$('#mainModal .modal-body').append((response.regionName.length > 0 ? ', ' : '') + response.region);
|
||||
}
|
||||
if (response.country.length > 0) {
|
||||
$('#mainModal .modal-body').append((response.country.length > 0 ? ', ' : '') + response.country);
|
||||
|
Loading…
Reference in New Issue
Block a user