tweaked rcon throttle rate/made async

increased cutoff for server overview messages
dont print message if timed out
This commit is contained in:
RaidMax
2018-04-02 00:25:06 -05:00
parent 1bdf4e63fc
commit 2952e307b2
21 changed files with 441 additions and 337 deletions

View File

@ -24,7 +24,9 @@ namespace WebfrontCore.Controllers
try
{
User.ClientId = Manager.PrivilegedClients[context.HttpContext.Connection.RemoteIpAddress.ToString().ConvertToIP()];
var client = Manager.PrivilegedClients[context.HttpContext.Connection.RemoteIpAddress.ToString().ConvertToIP()];
User.ClientId = client.ClientId;
User.Level = client.Level;
}
catch (KeyNotFoundException)
@ -36,11 +38,16 @@ namespace WebfrontCore.Controllers
User.ClientId >= 0;
ViewBag.Authorized = Authorized;
ViewBag.Url = Startup.Configuration["Web:Address"];
string inviteLink = Manager.GetApplicationSettings().Configuration().DiscordInviteCode;
if (inviteLink != null)
ViewBag.DiscordLink = inviteLink.Contains("https") ? inviteLink : $"https://discordapp.com/invite/{inviteLink}";
else
ViewBag.DiscordLink = "";
ViewBag.User = User;
if (Manager.GetApplicationSettings().Configuration().EnableDiscordLink)
{
string inviteLink = Manager.GetApplicationSettings().Configuration().DiscordInviteCode;
if (inviteLink != null)
ViewBag.DiscordLink = inviteLink.Contains("https") ? inviteLink : $"https://discordapp.com/invite/{inviteLink}";
else
ViewBag.DiscordLink = "";
}
base.OnActionExecuting(context);
}
}

View File

@ -18,6 +18,7 @@ namespace WebfrontCore.Controllers
{
Name = client.Name,
Level = client.Level.ToString(),
LevelInt = (int)client.Level,
ClientId = client.ClientId,
IPAddress = client.IPAddressString,
NetworkId = client.NetworkId,
@ -54,6 +55,17 @@ namespace WebfrontCore.Controllers
When = DateTime.MinValue
});
if (Authorized)
{
clientDto.Meta.AddRange(client.AliasLink.Children.Select(a => new ProfileMeta()
{
Key = "AliasEvent",
Value = $"Connected with name {a.Name}",
Sensitive = true,
When = a.DateAdded
}));
}
clientDto.Meta.AddRange(Authorized ? meta : meta.Where(m => !m.Sensitive));
clientDto.Meta.AddRange(Authorized ? penaltyMeta : penaltyMeta.Where(m => !m.Sensitive));
clientDto.Meta.AddRange(Authorized ? administeredPenaltiesMeta : administeredPenaltiesMeta.Where(m => !m.Sensitive));
@ -105,6 +117,7 @@ namespace WebfrontCore.Controllers
{
Name = c.Name,
Level = c.Level.ToString(),
LevelInt = (int)c.Level,
ClientId = c.ClientId,
LastSeen = Utilities.GetTimePassed(c.LastConnection, false)
})

View File

@ -31,7 +31,8 @@ namespace WebfrontCore.Controllers
{
Name = p.Name,
ClientId = p.ClientId,
Level = p.Level.ToString()
Level = p.Level.ToString(),
LevelInt = (int)p.Level
}).ToList(),
ChatHistory = s.ChatHistory.OrderBy(c => c.Time).Take((int)Math.Ceiling(s.ClientNum / 2.0)).ToArray(),
PlayerHistory = s.PlayerHistory.ToArray()