diff --git a/Application/Application.csproj b/Application/Application.csproj index d48d5f714..063372a6b 100644 --- a/Application/Application.csproj +++ b/Application/Application.csproj @@ -6,7 +6,7 @@ 2.2.2 false RaidMax.IW4MAdmin.Application - 2.2.5.6 + 2.2.5.7 RaidMax Forever None IW4MAdmin @@ -31,7 +31,7 @@ true true - 2.2.5.6 + 2.2.5.7 2.2.5.6 diff --git a/Application/IO/GameLogReader.cs b/Application/IO/GameLogReader.cs index 64d499020..a8c639c2b 100644 --- a/Application/IO/GameLogReader.cs +++ b/Application/IO/GameLogReader.cs @@ -34,9 +34,9 @@ namespace IW4MAdmin.Application.IO // todo: max async // take the old start position and go back the number of new characters rd.BaseStream.Seek(-fileSizeDiff, SeekOrigin.End); - // the difference should be in the range of a int :P + string newLine; - while (!String.IsNullOrEmpty(newLine = rd.ReadLine())) + while (!string.IsNullOrEmpty(newLine = await rd.ReadLineAsync())) { logLines.Add(newLine); } diff --git a/Plugins/Stats/Plugin.cs b/Plugins/Stats/Plugin.cs index 3012f5b38..c653d9a9a 100644 --- a/Plugins/Stats/Plugin.cs +++ b/Plugins/Stats/Plugin.cs @@ -325,7 +325,6 @@ namespace IW4MAdmin.Plugins.Stats manager.GetMessageTokens().Add(new MessageToken("MOSTPLAYED", mostPlayed)); ServerManager = manager; - Manager = new StatManager(manager); } diff --git a/Plugins/Web/StatsWeb/Views/Stats/Index.cshtml b/Plugins/Web/StatsWeb/Views/Stats/Index.cshtml index c76e6e1a9..7195452f0 100644 --- a/Plugins/Web/StatsWeb/Views/Stats/Index.cshtml +++ b/Plugins/Web/StatsWeb/Views/Stats/Index.cshtml @@ -11,7 +11,7 @@ } -
+
@await Component.InvokeAsync("TopPlayers", new { count = 10, offset = 0 })
diff --git a/SharedLibraryCore/Configuration/ServerConfiguration.cs b/SharedLibraryCore/Configuration/ServerConfiguration.cs index e23343bb9..812bd7351 100644 --- a/SharedLibraryCore/Configuration/ServerConfiguration.cs +++ b/SharedLibraryCore/Configuration/ServerConfiguration.cs @@ -8,7 +8,7 @@ namespace SharedLibraryCore.Configuration public class ServerConfiguration : IBaseConfiguration { public string IPAddress { get; set; } - public ushort Port { get; set; } + public int Port { get; set; } public string Password { get; set; } public IList Rules { get; set; } public IList AutoMessages { get; set; } @@ -27,8 +27,15 @@ namespace SharedLibraryCore.Configuration eventParsers = new List(); } - public void AddRConParser(IRConParser parser) => rconParsers.Add(parser); - public void AddEventParser(IEventParser parser) => eventParsers.Add(parser); + public void AddRConParser(IRConParser parser) + { + rconParsers.Add(parser); + } + + public void AddEventParser(IEventParser parser) + { + eventParsers.Add(parser); + } public void ModifyParsers() { @@ -65,26 +72,26 @@ namespace SharedLibraryCore.Configuration string input = Utilities.PromptString(loc["SETUP_SERVER_IP"]); if (System.Net.IPAddress.TryParse(input, out System.Net.IPAddress ip)) + { IPAddress = input; + } } - while(Port < 1) - { - string input = Utilities.PromptString(loc["SETUP_SERVER_PORT"]); - if (UInt16.TryParse(input, System.Globalization.NumberStyles.Integer, System.Globalization.CultureInfo.CurrentCulture, out ushort port)) - Port = port; - } - + Port = Utilities.PromptInt(Utilities.PromptString(loc["SETUP_SERVER_PORT"]), null, 1, ushort.MaxValue); Password = Utilities.PromptString(loc["SETUP_SERVER_RCON"]); AutoMessages = new List(); Rules = new List(); ReservedSlotNumber = loc["SETUP_SERVER_RESERVEDSLOT"].PromptInt(null, 0, 32); + ManualLogPath = null; ModifyParsers(); return this; } - public string Name() => "ServerConfiguration"; + public string Name() + { + return "ServerConfiguration"; + } } } diff --git a/SharedLibraryCore/Services/ClientService.cs b/SharedLibraryCore/Services/ClientService.cs index 8c904b4c0..981c27e8a 100644 --- a/SharedLibraryCore/Services/ClientService.cs +++ b/SharedLibraryCore/Services/ClientService.cs @@ -87,7 +87,7 @@ namespace SharedLibraryCore.Services //entity.CurrentServer.Logger.WriteDebug($"Updating alias link for {entity}"); await context.SaveChangesAsync(); - foreach (var alias in aliases.Union(new List() { entity.CurrentAlias }) + foreach (var alias in aliases.Append(entity.CurrentAlias) .Where(_alias => !_alias.Active || _alias.LinkId != aliasLink.AliasLinkId)) { diff --git a/SharedLibraryCore/Services/MetaService.cs b/SharedLibraryCore/Services/MetaService.cs index d1e9b0eb8..456b3edb9 100644 --- a/SharedLibraryCore/Services/MetaService.cs +++ b/SharedLibraryCore/Services/MetaService.cs @@ -58,7 +58,7 @@ namespace SharedLibraryCore.Services /// public async Task GetPersistentMeta(string metaKey, EFClient client) { - using (var ctx = new DatabaseContext(disableTracking:true)) + using (var ctx = new DatabaseContext(disableTracking: true)) { return await ctx.EFMeta .Where(_meta => _meta.Key == metaKey) diff --git a/WebfrontCore/Views/Client/Profile/Index.cshtml b/WebfrontCore/Views/Client/Profile/Index.cshtml index 8de2d58a1..7710770fb 100644 --- a/WebfrontCore/Views/Client/Profile/Index.cshtml +++ b/WebfrontCore/Views/Client/Profile/Index.cshtml @@ -6,100 +6,85 @@ string gravatarUrl = Model.Meta.FirstOrDefault(m => m.Key == "GravatarEmail")?.Value; bool isTempBanned = Model.ActivePenaltyType == "TempBan"; } -
-
-
- @if (string.IsNullOrEmpty(gravatarUrl)) - { - @shortCode - } -
+
+
+ @if (string.IsNullOrEmpty(gravatarUrl)) + { + @shortCode + }
-
-
- @if (Model.Online) - { - - } - - else - { - - } -
- @Model.Name +
+
@Model.Name
+
+
+
@Model.Level @(isTempBanned ? $"({loc["WEBFRONT_PROFILE_TEMPBAN"]})" : "")
- @{ - if (ViewBag.Authorized) +
+ @loc["WEBFRONT_PROFILE_PLAYER"] @Model.TimePlayed @loc["GLOBAL_TIME_HOURS"] +
+
+ @loc["WEBFRONT_PROFILE_FSEEN"] @Model.FirstSeen @loc["WEBFRONT_PENALTY_TEMPLATE_AGO"] +
+
+ @loc["WEBFRONT_PROFILE_LSEEN"] @Model.LastSeen @loc["WEBFRONT_PENALTY_TEMPLATE_AGO"] +
+
+
+
+
+
+ @if (ViewBag.Authorized) + { +
+
+
+ @if (Model.LevelInt != -1) { -
-
- @if (Model.LevelInt != -1) - { - - } - @if (Model.LevelInt < (int)ViewBag.User.Level && !Model.HasActivePenalty) - { - - } - - @if (Model.LevelInt < (int)ViewBag.User.Level && Model.HasActivePenalty) - { - @if (isTempBanned) - { - - - } - else - { - - } - } - -
- -
- @{ - foreach (var linked in Model.LinkedAccounts) - { - @Html.ActionLink(linked.Value.ToString("X"), "ProfileAsync", "Client", new { id = linked.Key }, new { @class = "link-inverse" })
- } - foreach (string alias in Model.Aliases) - { - @alias
- } - - if (ViewBag.Authorized) - { - foreach (string ip in Model.IPs) - { - @ip
- } - } - } -
+ } - } + @if (Model.LevelInt < (int)ViewBag.User.Level && !Model.HasActivePenalty) + { + + } + + @if (Model.LevelInt < (int)ViewBag.User.Level && Model.HasActivePenalty) + { + @if (isTempBanned) + { + + + } + else + { + + } + } + +
+ @{ + foreach (var linked in Model.LinkedAccounts) + { + @Html.ActionLink(linked.Value.ToString("X"), "ProfileAsync", "Client", new { id = linked.Key }, new { @class = "link-inverse" })
+ } + foreach (string alias in Model.Aliases) + { + @alias
+ } + + if (ViewBag.Authorized) + { + foreach (string ip in Model.IPs) + { + @ip
+ } + } + } +
+
+
+
-
-
@Model.Level @(isTempBanned ? $"({loc["WEBFRONT_PROFILE_TEMPBAN"]})" : "")
-
-
- @loc["WEBFRONT_PROFILE_PLAYER"] @Model.TimePlayed @loc["GLOBAL_TIME_HOURS"] -
-
- @loc["WEBFRONT_PROFILE_FSEEN"] @Model.FirstSeen @loc["WEBFRONT_PENALTY_TEMPLATE_AGO"] -
-
- @loc["WEBFRONT_PROFILE_LSEEN"] @Model.LastSeen @loc["WEBFRONT_PENALTY_TEMPLATE_AGO"] -
-
-
-
- @Model.ConnectionCount - @loc["WEBFRONT_CLIENT_META_CONNECTIONS"] -
-
+ }
diff --git a/WebfrontCore/WebfrontCore.csproj b/WebfrontCore/WebfrontCore.csproj index d30b9ee91..d80aedd60 100644 --- a/WebfrontCore/WebfrontCore.csproj +++ b/WebfrontCore/WebfrontCore.csproj @@ -3,7 +3,7 @@ netcoreapp2.2 2.2.2 - true + false true true 2.6 diff --git a/WebfrontCore/wwwroot/css/profile.css b/WebfrontCore/wwwroot/css/profile.css index dcae199d1..7fa514abb 100644 --- a/WebfrontCore/wwwroot/css/profile.css +++ b/WebfrontCore/wwwroot/css/profile.css @@ -164,10 +164,6 @@ line-height: 1.4em; } -#profile_wrapper { - border-bottom: 2px rgb(0, 122, 204) solid; -} - .profile-event-timestep { font-size: 1.25rem; } diff --git a/WebfrontCore/wwwroot/js/profile.js b/WebfrontCore/wwwroot/js/profile.js index 53b32e620..e9f7cbfcd 100644 --- a/WebfrontCore/wwwroot/js/profile.js +++ b/WebfrontCore/wwwroot/js/profile.js @@ -1,5 +1,6 @@ // keeps track of how many events have been displayed let count = 1; +let metaIndex = 0; $(document).ready(function () { @@ -51,7 +52,15 @@ $(document).ready(function () { $.each(clientInfo.Meta, function (index, meta) { if (!meta.key.includes("Event")) { let metaString = `
${meta.value} ${meta.key}
`; - $("#profile_meta").append(metaString); + if (metaIndex < 10) { + let selector = '#profile_meta_' + ((metaIndex % 2) + 1); + $(selector).append(metaString); + } + else { + let selector = '#profile_meta_' + (metaIndex % 3); + $(selector).append(metaString); + } + metaIndex++; } });