From b2a3625288a4683cc0e9d2af91425e6725a2e838 Mon Sep 17 00:00:00 2001 From: RaidMax Date: Mon, 31 Jan 2022 08:16:12 -0600 Subject: [PATCH] update IP lookup api --- Plugins/Welcome/Plugin.cs | 2 +- WebfrontCore/wwwroot/js/profile.js | 17 ++++------------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/Plugins/Welcome/Plugin.cs b/Plugins/Welcome/Plugin.cs index a0d790d0a..15a353adf 100644 --- a/Plugins/Welcome/Plugin.cs +++ b/Plugins/Welcome/Plugin.cs @@ -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(); diff --git a/WebfrontCore/wwwroot/js/profile.js b/WebfrontCore/wwwroot/js/profile.js index 9f0a79b2a..a5f3e5e05 100644 --- a/WebfrontCore/wwwroot/js/profile.js +++ b/WebfrontCore/wwwroot/js/profile.js @@ -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}
`); - } if (response.isp.length > 0) { $('#mainModal .modal-body').append(`${_localization['WEBFRONT_PROFILE_LOOKUP_ISP']} — ${response.isp}
`); } if (response.org.length > 0) { $('#mainModal .modal-body').append(`${_localization['WEBFRONT_PROFILE_LOOKUP_ORG']} — ${response.org}
`); } - if (response['businessName'].length > 0) { - $('#mainModal .modal-body').append(`${_localization['WEBFRONT_PROFILE_LOOKUP_BUSINESS']} — ${response.businessName}
`); - } - if (response['businessWebsite'].length > 0) { - $('#mainModal .modal-body').append(`${_localization['WEBFRONT_PROFILE_LOOKUP_WEBSITE']} — ${response.businessWebsite}
`); - } - 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);