1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-10 15:20:48 -05:00

fix issue on about page with duplicate server names or inactive servers

This commit is contained in:
RaidMax
2021-10-19 20:02:31 -05:00
parent ad14a150e2
commit bbab849224
3 changed files with 14 additions and 8 deletions

View File

@ -27,14 +27,20 @@ namespace WebfrontCore.Controllers
? Localization["WEBFRONT_NAV_ABOUT"]
: _appConfig.CommunityInformation.Name;
var activeServers = _appConfig.Servers.Where(server =>
Manager.GetServers().FirstOrDefault(s => s.IP == server.IPAddress && s.Port == server.Port) != null);
var info = new CommunityInfo
{
GlobalRules = _appConfig.GlobalRules,
ServerRules =
_appConfig.Servers.ToDictionary(
config => Manager.GetServers().FirstOrDefault(server =>
server.IP == config.IPAddress && server.Port == config.Port)?.Hostname,
config => config.Rules),
ServerRules = activeServers.ToDictionary(
config =>
{
var server = Manager.GetServers().FirstOrDefault(server =>
server.IP == config.IPAddress && server.Port == config.Port);
return (server.Hostname, server.EndPoint);
},
config => config.Rules),
CommunityInformation = _appConfig.CommunityInformation
};