update IP lookup api

This commit is contained in:
RaidMax 2022-01-31 08:16:12 -06:00
parent 0d3e2cb0bc
commit b2a3625288
2 changed files with 5 additions and 14 deletions

View File

@ -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();

View File

@ -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']} &mdash; ${response.ipName}<br/>`);
}
if (response.isp.length > 0) {
$('#mainModal .modal-body').append(`${_localization['WEBFRONT_PROFILE_LOOKUP_ISP']} &mdash; ${response.isp}<br/>`);
}
if (response.org.length > 0) {
$('#mainModal .modal-body').append(`${_localization['WEBFRONT_PROFILE_LOOKUP_ORG']} &mdash; ${response.org}<br/>`);
}
if (response['businessName'].length > 0) {
$('#mainModal .modal-body').append(`${_localization['WEBFRONT_PROFILE_LOOKUP_BUSINESS']} &mdash; ${response.businessName}<br/>`);
}
if (response['businessWebsite'].length > 0) {
$('#mainModal .modal-body').append(`${_localization['WEBFRONT_PROFILE_LOOKUP_WEBSITE']} &mdash; ${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']} &mdash; `);
}
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);