adding Cod4 support (for steam GUID is truncated to 16 characters)

exit properly whoops
add all linked accounts to drop down
consolidate linked admin accounts to the most recently seen one
limited some waits to 5s to hopefully prevent a rare thread lock
This commit is contained in:
RaidMax
2018-05-14 12:55:10 -05:00
parent 6e5501b32d
commit 699c19cd4b
30 changed files with 184 additions and 132 deletions

View File

@ -71,7 +71,7 @@ namespace WebfrontCore.Controllers
catch (System.Collections.Generic.KeyNotFoundException)
{
// force the "banned" client to be signed out
HttpContext.SignOutAsync().Wait();
HttpContext.SignOutAsync().Wait(5000);
}
}

View File

@ -41,7 +41,8 @@ namespace WebfrontCore.Controllers
.OrderBy(i => i)
.ToList(),
Online = Manager.GetActiveClients().FirstOrDefault(c => c.ClientId == client.ClientId) != null,
TimeOnline = (DateTime.UtcNow - client.LastConnection).TimeSpanText()
TimeOnline = (DateTime.UtcNow - client.LastConnection).TimeSpanText(),
LinkedAccounts = client.LinkedAccounts
};
var meta = await MetaService.GetMeta(client.ClientId);
@ -54,7 +55,7 @@ namespace WebfrontCore.Controllers
clientDto.Meta.Add(new ProfileMeta()
{
Key = Localization["WEBFRONT_CLIENT_META_MASKED"],
Value = client.Masked ? Localization["WEBFRONT_CLIENT_META_TRUE"]: Localization["WEBFRONT_CLIENT_META_FALSE"],
Value = client.Masked ? Localization["WEBFRONT_CLIENT_META_TRUE"] : Localization["WEBFRONT_CLIENT_META_FALSE"],
Sensitive = true,
When = DateTime.MinValue
});
@ -94,7 +95,9 @@ namespace WebfrontCore.Controllers
{
var admins = (await Manager.GetClientService().GetPrivilegedClients())
.Where(a => a.Active)
.OrderByDescending(a => a.Level);
.OrderByDescending(a => a.Level).ThenByDescending(a => a.LastConnection)
.GroupBy(a => a.AliasLinkId).Select(a => a.First());
var adminsDict = new Dictionary<SharedLibraryCore.Objects.Player.Permission, IList<ClientInfo>>();
foreach (var admin in admins)

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Diagnostics;
using Microsoft.AspNetCore.Mvc;
using SharedLibraryCore.Dtos;
@ -21,6 +22,11 @@ namespace WebfrontCore.Controllers
public IActionResult Error()
{
var exceptionFeature = HttpContext.Features.Get<IExceptionHandlerPathFeature>();
Manager.GetLogger().WriteError($"[Webfront] {exceptionFeature.Error.Message}");
Manager.GetLogger().WriteDebug(exceptionFeature.Path);
Manager.GetLogger().WriteDebug(exceptionFeature.Error.StackTrace);
ViewBag.Description = Localization["WEBFRONT_ERROR_DESC"];
ViewBag.Title = Localization["WEBFRONT_ERROR_TITLE"];
return View();

View File

@ -13,7 +13,6 @@ namespace WebfrontCore.Controllers
[ResponseCache(NoStore = true, Duration = 0)]
public IActionResult ClientActivity(int id)
{
var s = Manager.GetServers().FirstOrDefault(s2 => s2.GetHashCode() == id);
if (s == null)
return View("Error", "Invalid server!");
@ -27,14 +26,15 @@ namespace WebfrontCore.Controllers
ClientCount = s.ClientNum,
MaxClients = s.MaxClients,
GameType = s.Gametype,
Players = s.Players.Where(p => p != null).Select(p => new PlayerInfo
Players = s.GetPlayersAsList()
.Select(p => new PlayerInfo
{
Name = p.Name,
ClientId = p.ClientId,
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(),
ChatHistory = s.ChatHistory,
PlayerHistory = s.PlayerHistory.ToArray(),
};
return PartialView("_ClientActivity", serverInfo);