diff --git a/Bloxstrap/Integrations/ActivityWatcher.cs b/Bloxstrap/Integrations/ActivityWatcher.cs index 142eba8..09692ba 100644 --- a/Bloxstrap/Integrations/ActivityWatcher.cs +++ b/Bloxstrap/Integrations/ActivityWatcher.cs @@ -284,9 +284,11 @@ try { - locationCity = await App.HttpClient.GetStringAsync($"https://ipinfo.io/{ActivityMachineAddress}/city"); - locationRegion = await App.HttpClient.GetStringAsync($"https://ipinfo.io/{ActivityMachineAddress}/region"); - locationCountry = await App.HttpClient.GetStringAsync($"https://ipinfo.io/{ActivityMachineAddress}/country"); + locationInformation = await Http.GetJson($"https://ipinfo.io/{ActivityMachineAddress}/json"); + + locationCity = locationInformation.IP; + locationRegion = locationInformation.Region; + locationCountry = locationInformation.Country; } catch (Exception ex) { diff --git a/Bloxstrap/Models/IPInfoResponse.cs b/Bloxstrap/Models/IPInfoResponse.cs new file mode 100644 index 0000000..dab396e --- /dev/null +++ b/Bloxstrap/Models/IPInfoResponse.cs @@ -0,0 +1,35 @@ +namespace Bloxstrap.Models +{ + public class IPInfoResponse + { + [JsonPropertyName("city")] + public string City { get; set; } + + [JsonPropertyName("country")] + public string Country { get; set; } + + [JsonPropertyName("region")] + public string Region { get; set; } + + [JsonPropertyName("ip")] + public string IP { get; set; } + + [JsonPropertyName("postal")] + public string Postal { get; set; } + + [JsonPropertyName("timezone")] + public string TimeZone { get; set; } + + [JsonPropertyName("readme")] + public string ReadME { get; set; } + + [JsonPropertyName("org")] + public string Org { get; set; } + + [JsonPropertyName("loc")] + public string Loc { get; set; } + + [JsonPropertyName("anycast")] + public string AnyCast { get; set; } + } +}