1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-10 23:31:13 -05:00

support hostnames for server config

This commit is contained in:
RaidMax
2021-07-11 17:26:30 -05:00
parent da6da0edca
commit 19b5c456a5
12 changed files with 59 additions and 52 deletions

View File

@ -12,7 +12,7 @@ namespace WebfrontCore.ViewComponents
{
public IViewComponentResult Invoke(Game? game)
{
var servers = Program.Manager.GetServers().Where(_server => !game.HasValue ? true : _server.GameName == game);
var servers = Program.Manager.GetServers().Where(_server => !game.HasValue || _server.GameName == game);
var serverInfo = servers.Select(s => new ServerInfo()
{
@ -36,8 +36,8 @@ namespace WebfrontCore.ViewComponents
}).ToList(),
ChatHistory = s.ChatHistory.ToList(),
Online = !s.Throttled,
IPAddress = $"{(IPAddress.Parse(s.IP).IsInternal() ? Program.Manager.ExternalIPAddress : s.IP)}:{s.Port}",
ConnectProtocolUrl = s.EventParser.URLProtocolFormat.FormatExt(IPAddress.Parse(s.IP).IsInternal() ? Program.Manager.ExternalIPAddress : s.IP, s.Port)
IPAddress = $"{(s.ResolvedIpEndPoint.Address.IsInternal() ? Program.Manager.ExternalIPAddress : s.IP)}:{s.Port}",
ConnectProtocolUrl = s.EventParser.URLProtocolFormat.FormatExt(s.ResolvedIpEndPoint.Address.IsInternal() ? Program.Manager.ExternalIPAddress : s.IP, s.Port)
}).ToList();
return View("_List", serverInfo);
}

View File

@ -139,7 +139,7 @@
: null;
var headShots = allPerServer.Any()
? allPerServer.Where(hit => hit.MeansOfDeath?.Name == headshotKey || hit.MeansOfDeath?.Name == headshotKey2).Sum(hit => hit.HitCount)
? allPerServer.Where(hit => hit.MeansOfDeath?.Name == headshotKey || hit.HitLocation?.Name == headshotKey2).Sum(hit => hit.HitCount)
: (int?) null; // want to default to -- in ui instead of 0
var meleeKills = allPerServer.Any()