ui tweaks/improvements including recent players and ip info lookup
This commit is contained in:
@ -10,5 +10,6 @@ namespace SharedLibraryCore.Dtos
|
||||
public int LinkId { get; set; }
|
||||
public EFClient.Permission Level { get; set; }
|
||||
public DateTime LastConnection { get; set; }
|
||||
public bool IsMasked { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ namespace SharedLibraryCore.Dtos
|
||||
public int MaxClients { get; set; }
|
||||
public List<ChatInfo> ChatHistory { get; set; }
|
||||
public List<PlayerInfo> Players { get; set; }
|
||||
public List<Report> Reports { get; set; }
|
||||
public ClientHistoryInfo ClientHistory { get; set; }
|
||||
public long ID { get; set; }
|
||||
public bool Online { get; set; }
|
||||
|
@ -47,13 +47,15 @@ namespace SharedLibraryCore.Services
|
||||
private readonly ApplicationConfiguration _appConfig;
|
||||
private readonly IDatabaseContextFactory _contextFactory;
|
||||
private readonly ILogger _logger;
|
||||
private readonly IGeoLocationService _geoLocationService;
|
||||
|
||||
public ClientService(ILogger<ClientService> logger, IDatabaseContextFactory databaseContextFactory,
|
||||
ApplicationConfiguration appConfig)
|
||||
ApplicationConfiguration appConfig, IGeoLocationService geoLocationService)
|
||||
{
|
||||
_contextFactory = databaseContextFactory;
|
||||
_logger = logger;
|
||||
_appConfig = appConfig;
|
||||
_geoLocationService = geoLocationService;
|
||||
}
|
||||
|
||||
public async Task<EFClient> Create(EFClient entity)
|
||||
@ -782,7 +784,8 @@ namespace SharedLibraryCore.Services
|
||||
Password = client.Password,
|
||||
PasswordSalt = client.PasswordSalt,
|
||||
NetworkId = client.NetworkId,
|
||||
LastConnection = client.LastConnection
|
||||
LastConnection = client.LastConnection,
|
||||
Masked = client.Masked
|
||||
};
|
||||
|
||||
return await iqClients.ToListAsync();
|
||||
@ -901,18 +904,24 @@ namespace SharedLibraryCore.Services
|
||||
|
||||
await using var context = _contextFactory.CreateContext(false);
|
||||
var iqClients = context.Clients
|
||||
.Where(_client => _client.CurrentAlias.IPAddress != null)
|
||||
.Where(_client => _client.FirstConnection >= startOfPeriod)
|
||||
.OrderByDescending(_client => _client.FirstConnection)
|
||||
.Select(_client => new PlayerInfo
|
||||
.Where(client => client.CurrentAlias.IPAddress != null)
|
||||
.Where(client => client.FirstConnection >= startOfPeriod)
|
||||
.OrderByDescending(client => client.FirstConnection)
|
||||
.Select(client => new PlayerInfo
|
||||
{
|
||||
ClientId = _client.ClientId,
|
||||
Name = _client.CurrentAlias.Name,
|
||||
IPAddress = _client.CurrentAlias.IPAddress.ConvertIPtoString(),
|
||||
LastConnection = _client.FirstConnection
|
||||
ClientId = client.ClientId,
|
||||
Name = client.CurrentAlias.Name,
|
||||
IPAddress = client.CurrentAlias.IPAddress.ConvertIPtoString(),
|
||||
LastConnection = client.FirstConnection
|
||||
});
|
||||
|
||||
return await iqClients.ToListAsync();
|
||||
var clientList = await iqClients.ToListAsync();
|
||||
foreach (var client in clientList)
|
||||
{
|
||||
client.GeoLocationInfo = await _geoLocationService.Locate(client.IPAddress);
|
||||
}
|
||||
|
||||
return clientList;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
Reference in New Issue
Block a user