mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
Build error fix and added back ip property
This commit is contained in:
parent
868ee2a4ff
commit
38edb68574
@ -280,17 +280,18 @@
|
||||
if (GeolocationCache.ContainsKey(ActivityMachineAddress))
|
||||
return GeolocationCache[ActivityMachineAddress];
|
||||
|
||||
string location, locationCity, locationRegion, locationCountry = "";
|
||||
|
||||
IPInfoResponse locationInformation;
|
||||
string location = "", locationCity = "", locationRegion = "", locationCountry = "";
|
||||
|
||||
try
|
||||
{
|
||||
IPInfoResponse locationInformation = await Http.GetJson<IPInfoResponse>($"https://ipinfo.io/{ActivityMachineAddress}/json");
|
||||
var locationInformation = await Http.GetJson<IPInfoResponse>($"https://ipinfo.io/{ActivityMachineAddress}/json");
|
||||
|
||||
locationCity = locationInformation.IP;
|
||||
locationRegion = locationInformation.Region;
|
||||
locationCountry = locationInformation.Country;
|
||||
if (locationInformation is not null)
|
||||
{
|
||||
locationCity = locationInformation.IP;
|
||||
locationRegion = locationInformation.Region;
|
||||
locationCountry = locationInformation.Country;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -2,13 +2,13 @@ namespace Bloxstrap.Models
|
||||
{
|
||||
public class IPInfoResponse
|
||||
{
|
||||
[JsonPropertyName("city")]
|
||||
public string? City { get; set; }
|
||||
[JsonPropertyName("ip")]
|
||||
public string IP { get; set; } = null!;
|
||||
|
||||
[JsonPropertyName("country")]
|
||||
public string? Country { get; set; }
|
||||
public string Country { get; set; } = null!;
|
||||
|
||||
[JsonPropertyName("region")]
|
||||
public string? Region { get; set; }
|
||||
public string Region { get; set; } = null!;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user