update welcome plugin to bypass api lookup limitation
This commit is contained in:
parent
bbcbc4c042
commit
755c149495
@ -104,14 +104,13 @@ namespace IW4MAdmin.Plugins.Welcome
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private async Task<string> GetCountryName(string ip)
|
private async Task<string> GetCountryName(string ip)
|
||||||
{
|
{
|
||||||
using (var wc = new WebClient())
|
using var wc = new WebClient();
|
||||||
{
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string response =
|
var response =
|
||||||
await wc.DownloadStringTaskAsync(new Uri($"http://extreme-ip-lookup.com/json/{ip}"));
|
await wc.DownloadStringTaskAsync(new Uri($"http://extreme-ip-lookup.com/json/{ip}?key=demo"));
|
||||||
var responseObj = JObject.Parse(response);
|
var responseObj = JObject.Parse(response);
|
||||||
response = responseObj["country"].ToString();
|
response = responseObj["country"]?.ToString();
|
||||||
|
|
||||||
return string.IsNullOrEmpty(response)
|
return string.IsNullOrEmpty(response)
|
||||||
? Utilities.CurrentLocalization.LocalizationIndex["PLUGINS_WELCOME_UNKNOWN_COUNTRY"]
|
? Utilities.CurrentLocalization.LocalizationIndex["PLUGINS_WELCOME_UNKNOWN_COUNTRY"]
|
||||||
@ -124,5 +123,4 @@ namespace IW4MAdmin.Plugins.Welcome
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user