From 5dca4e7065a7588a7f9fe775ad740469e8ea82bc Mon Sep 17 00:00:00 2001 From: RaidMax Date: Mon, 16 Apr 2018 15:31:14 -0500 Subject: [PATCH] Made webfront optional for decreased ram usage initialization should be better asynced clean up publish folder after publish added chevron hover icon for loading more penalties added T6M maps to config --- Application/Application.csproj | 4 + Application/BuildScripts/PostBuild.bat | 2 +- Application/BuildScripts/PostPublish.bat | 28 ++++ Application/EventParsers/IW4EventParser.cs | 1 - Application/IW4MAdminSettings.json | 131 +++++++++++++++++- Application/Main.cs | 9 +- Application/Manager.cs | 84 +++++------ Application/Misc/VPNCheck.cs | 2 +- Application/Server.cs | 27 +--- .../Configuration/ApplicationConfiguration.cs | 2 + WebfrontCore/Controllers/BaseController.cs | 2 +- .../PenaltyListViewComponent.cs | 6 +- WebfrontCore/Views/Penalty/List.cshtml | 1 + WebfrontCore/Views/Shared/_Layout.cshtml | 6 +- WebfrontCore/WebfrontCore.csproj | 12 +- WebfrontCore/bundleconfig.json | 4 + WebfrontCore/wwwroot/_references.js | 3 - WebfrontCore/wwwroot/favicon.ico | Bin 32038 -> 0 bytes WebfrontCore/wwwroot/js/penalty.js | 17 ++- 19 files changed, 255 insertions(+), 86 deletions(-) delete mode 100644 WebfrontCore/wwwroot/_references.js delete mode 100644 WebfrontCore/wwwroot/favicon.ico diff --git a/Application/Application.csproj b/Application/Application.csproj index d51fa7f8..681fdcb5 100644 --- a/Application/Application.csproj +++ b/Application/Application.csproj @@ -48,4 +48,8 @@ + + + + diff --git a/Application/BuildScripts/PostBuild.bat b/Application/BuildScripts/PostBuild.bat index 88a048f9..ca9ed761 100644 --- a/Application/BuildScripts/PostBuild.bat +++ b/Application/BuildScripts/PostBuild.bat @@ -15,4 +15,4 @@ if not exist "%TargetDir%Plugins" ( xcopy /y "%SolutionDir%Build\Plugins" "%TargetDir%Plugins\" echo Copying plugins for publish -xcopy /Y "%SolutionDir%BUILD\Plugins" "%SolutionDir%Publish\Windows\Plugins\" +xcopy /Y "%SolutionDir%BUILD\Plugins" "%SolutionDir%Publish\Windows\Plugins\" \ No newline at end of file diff --git a/Application/BuildScripts/PostPublish.bat b/Application/BuildScripts/PostPublish.bat index 93db844e..8b8f091f 100644 --- a/Application/BuildScripts/PostPublish.bat +++ b/Application/BuildScripts/PostPublish.bat @@ -1 +1,29 @@ set SolutionDir=%1 +set ProjectDir=%2 +set TargetDir=%3 + +echo Deleting extra language files +if exist "%SolutionDir%Publish\Windows\de\" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\Windows\de' +if exist "%SolutionDir%Publish\Windows\es\" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\Windows\es' +if exist "%SolutionDir%Publish\Windows\fr\" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\Windows\fr' +if exist "%SolutionDir%Publish\Windows\it\" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\Windows\it' +if exist "%SolutionDir%Publish\Windows\ja\" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\Windows\ja' +if exist "%SolutionDir%Publish\Windows\ko\" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\Windows\ko' +if exist "%SolutionDir%Publish\Windows\ru\" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\Windows\ru' +if exist "%SolutionDir%Publish\Windows\zh-Hans\" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\Windows\zh-Hans' +if exist "%SolutionDir%Publish\Windows\zh-Hant\" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\Windows\zh-Hant' + +echo Deleting extra runtime files +if exist "%SolutionDir%Publish\Windows\runtimes\linux-arm" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\Windows\runtimes\linux-arm' +if exist "%SolutionDir%Publish\Windows\runtimes\linux-arm64" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\Windows\runtimes\linux-arm64' +if exist "%SolutionDir%Publish\Windows\runtimes\linux-armel" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\Windows\runtimes\linux-armel' + +if exist "%SolutionDir%Publish\Windows\runtimes\osx" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\Windows\runtimes\osx' +if exist "%SolutionDir%Publish\Windows\runtimes\osx-x64" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\Windows\runtimes\osx-x64' + +if exist "%SolutionDir%Publish\Windows\runtimes\win-arm" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\Windows\runtimes\win-arm' +if exist "%SolutionDir%Publish\Windows\runtimes\win-arm64" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\Windows\runtimes\win-arm64' + +echo Deleting misc files +if exist "%SolutionDir%Publish\Windows\web.config" del "%SolutionDir%Publish\Windows\web.config" +del "%SolutionDir%Publish\Windows\*pdb" diff --git a/Application/EventParsers/IW4EventParser.cs b/Application/EventParsers/IW4EventParser.cs index f5dfafd8..e6f3c424 100644 --- a/Application/EventParsers/IW4EventParser.cs +++ b/Application/EventParsers/IW4EventParser.cs @@ -1,6 +1,5 @@ using System; using System.Linq; -using System.Text; using System.Text.RegularExpressions; using SharedLibraryCore; using SharedLibraryCore.Interfaces; diff --git a/Application/IW4MAdminSettings.json b/Application/IW4MAdminSettings.json index fb3c78fe..eb6056e3 100644 --- a/Application/IW4MAdminSettings.json +++ b/Application/IW4MAdminSettings.json @@ -234,6 +234,135 @@ "Name": "mp_bloc_sh" } ] + }, + { + "Game": "T6M", + "Maps": [ + { + "Alias": "Aftermath", + "Name": "mp_la" + }, + { + "Alias": "Cargo", + "Name": "mp_dockside" + }, + { + "Alias": "Carrier", + "Name": "mp_carrier" + }, + { + "Alias": "Drone", + "Name": "mp_drone" + }, + { + "Alias": "Express", + "Name": "mp_express" + }, + { + "Alias": "Hijacked", + "Name": "mp_hijacked" + }, + { + "Alias": "Meltdown", + "Name": "mp_meltdown" + }, + { + "Alias": "Overflow", + "Name": "mp_overflow" + }, + { + "Alias": "Plaza", + "Name": "mp_nightclub" + }, + { + "Alias": "Raid", + "Name": "mp_raid" + }, + { + "Alias": "Slums", + "Name": "mp_slums" + }, + { + "Alias": "Standoff", + "Name": "mp_village" + }, + { + "Alias": "Turbine", + "Name": "mp_turbine" + }, + { + "Alias": "Yemen", + "Name": "mp_socotra" + }, + { + "Alias": "Nuketown 2025", + "Name": "mp_nuketown_2020" + }, + { + "Alias": "Downhill", + "Name": "mp_downhill" + }, + { + "Alias": "Mirage", + "Name": "mp_mirage" + }, + { + "Alias": "Hydro", + "Name": "mp_hydro" + }, + { + "Alias": "Grind", + "Name": "mp_skate" + }, + { + "Alias": "Encore", + "Name": "mp_concert" + }, + { + "Alias": "Magma", + "Name": "mp_magma" + }, + { + "Alias": "Vertigo", + "Name": "mp_vertigo" + }, + { + "Alias": "Studio", + "Name": "mp_studio" + }, + { + "Alias": "Uplink", + "Name": "mp_uplink" + }, + { + "Alias": "Detour", + "Name": "mp_bridge" + }, + { + "Alias": "Cove", + "Name": "mp_castaway" + }, + { + "Alias": "Rush", + "Name": "mp_paintball" + }, + { + "Alias": "Dig", + "Name": "mp_dig" + }, + { + "Alias": "Frost", + "Name": "mp_frostbite" + }, + { + "Alias": "Pod", + "Name": "mp_pod" + }, + { + "Alias": "Takeoff", + "Name": "mp_takeoff" + } + ] } ] -} \ No newline at end of file +} diff --git a/Application/Main.cs b/Application/Main.cs index f80826d4..0d83c256 100644 --- a/Application/Main.cs +++ b/Application/Main.cs @@ -38,7 +38,7 @@ namespace IW4MAdmin.Application ServerManager = ApplicationManager.GetInstance(); ServerManager.Init().Wait(); - Task.Run((Action)(() => + Task.Run(() => { String userInput; Player Origin = ServerManager.GetClientService().Get(1).Result.AsPlayer(); @@ -59,9 +59,12 @@ namespace IW4MAdmin.Application Console.Write('>'); } while (ServerManager.Running); - })); + }); - Task.Run(() => WebfrontCore.Program.Init(ServerManager)); + if (ServerManager.GetApplicationSettings().Configuration().EnableWebFront) + { + Task.Run(() => WebfrontCore.Program.Init(ServerManager)); + } ServerManager.Start(); ServerManager.Logger.WriteVerbose("Shutdown complete"); diff --git a/Application/Manager.cs b/Application/Manager.cs index d6dad891..8a7f2a62 100644 --- a/Application/Manager.cs +++ b/Application/Manager.cs @@ -136,7 +136,7 @@ namespace IW4MAdmin.Application else if (config.Servers.Count == 0) throw new ServerException("A server configuration in IW4MAdminSettings.json is invalid"); - + #endregion #region PLUGINS SharedLibraryCore.Plugins.PluginImporter.Load(this); @@ -156,46 +156,6 @@ namespace IW4MAdmin.Application } #endregion - foreach (var Conf in config.Servers) - { - try - { - var ServerInstance = new IW4MServer(this, Conf); - await ServerInstance.Initialize(); - - lock (_servers) - { - _servers.Add(ServerInstance); - } - - Logger.WriteVerbose($"Now monitoring {ServerInstance.Hostname}"); - - // this way we can keep track of execution time and see if problems arise. - var Status = new AsyncStatus(ServerInstance, UPDATE_FREQUENCY); - lock (TaskStatuses) - { - TaskStatuses.Add(Status); - } - } - - catch (ServerException e) - { - Logger.WriteError($"Not monitoring server {Conf.IPAddress}:{Conf.Port} due to uncorrectable errors"); - if (e.GetType() == typeof(DvarException)) - Logger.WriteDebug($"Could not get the dvar value for {(e as DvarException).Data["dvar_name"]} (ensure the server has a map loaded)"); - else if (e.GetType() == typeof(NetworkException)) - { - Logger.WriteDebug(e.Message); - //Logger.WriteDebug($"Internal Exception: {e.Data["internal_exception"]}"); - } - - // throw the exception to the main method to stop before instantly exiting - throw e; - } - - } - #endregion - #region COMMANDS if (ClientSvc.GetOwners().Result.Count == 0) Commands.Add(new COwner()); @@ -239,6 +199,48 @@ namespace IW4MAdmin.Application Commands.Add(C); #endregion + #region INIT + async Task Init(ServerConfiguration Conf) + { + try + { + var ServerInstance = new IW4MServer(this, Conf); + await ServerInstance.Initialize(); + + lock (_servers) + { + _servers.Add(ServerInstance); + } + + Logger.WriteVerbose($"Now monitoring {ServerInstance.Hostname}"); + + // this way we can keep track of execution time and see if problems arise. + var Status = new AsyncStatus(ServerInstance, UPDATE_FREQUENCY); + lock (TaskStatuses) + { + TaskStatuses.Add(Status); + } + } + + catch (ServerException e) + { + Logger.WriteError($"Not monitoring server {Conf.IPAddress}:{Conf.Port} due to uncorrectable errors"); + if (e.GetType() == typeof(DvarException)) + Logger.WriteDebug($"Could not get the dvar value for {(e as DvarException).Data["dvar_name"]} (ensure the server has a map loaded)"); + else if (e.GetType() == typeof(NetworkException)) + { + Logger.WriteDebug(e.Message); + } + + // throw the exception to the main method to stop before instantly exiting + throw e; + } + } + + await Task.WhenAll(config.Servers.Select(c => Init(c)).ToArray()); + + #endregion + Running = true; } diff --git a/Application/Misc/VPNCheck.cs b/Application/Misc/VPNCheck.cs index 6d0056f0..d21a19c2 100644 --- a/Application/Misc/VPNCheck.cs +++ b/Application/Misc/VPNCheck.cs @@ -5,7 +5,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -namespace IW4MAdmin.Application.Misc +namespace Application.Misc { public class VPNCheck { diff --git a/Application/Server.cs b/Application/Server.cs index 3c7f0622..c82637f5 100644 --- a/Application/Server.cs +++ b/Application/Server.cs @@ -5,6 +5,7 @@ using System.IO; using System.Linq; using System.Threading.Tasks; using System.Text.RegularExpressions; +using System.Runtime.InteropServices; using SharedLibraryCore; using SharedLibraryCore.Interfaces; @@ -12,12 +13,12 @@ using SharedLibraryCore.Objects; using SharedLibraryCore.Database.Models; using SharedLibraryCore.Dtos; using SharedLibraryCore.Configuration; +using SharedLibraryCore.Exceptions; -using IW4MAdmin.Application.Misc; +using Application.Misc; using Application.RconParsers; using Application.EventParsers; -using SharedLibraryCore.Exceptions; -using System.Runtime.InteropServices; + namespace IW4MAdmin { @@ -612,23 +613,6 @@ namespace IW4MAdmin var logfile = await this.GetDvarAsync("g_log"); var logsync = await this.GetDvarAsync("g_logsync"); - Dvar onelog = null; - if (GameName == Game.IW4) - { - try - { - onelog = await this.GetDvarAsync("iw4x_onelog"); - } - - catch (Exception) - { - onelog = new Dvar("iw4x_onelog") - { - Value = -1 - }; - } - } - try { var website = await this.GetDvarAsync("_website"); @@ -662,9 +646,8 @@ namespace IW4MAdmin CustomCallback = await ScriptLoaded(); string mainPath = EventParser.GetGameDir(); - mainPath = (GameName == Game.IW4 && onelog.Value > 0) ? "main" : mainPath; #if DEBUG - basepath.Value = @"\\192.168.88.253\Call of Duty Black Ops II"; + // basepath.Value = @"\\192.168.88.253\Call of Duty Black Ops II"; #endif string logPath = game.Value == string.Empty ? $"{basepath.Value.Replace('\\', Path.DirectorySeparatorChar)}{Path.DirectorySeparatorChar}{mainPath}{Path.DirectorySeparatorChar}{logfile.Value}" : diff --git a/SharedLibraryCore/Configuration/ApplicationConfiguration.cs b/SharedLibraryCore/Configuration/ApplicationConfiguration.cs index ef9613ac..e7a5b796 100644 --- a/SharedLibraryCore/Configuration/ApplicationConfiguration.cs +++ b/SharedLibraryCore/Configuration/ApplicationConfiguration.cs @@ -7,6 +7,7 @@ namespace SharedLibraryCore.Configuration { public class ApplicationConfiguration : IBaseConfiguration { + public bool EnableWebFront { get; set; } public bool EnableMultipleOwners { get; set; } public bool EnableSteppedHierarchy { get; set; } public bool EnableClientVPNs { get; set; } @@ -23,6 +24,7 @@ namespace SharedLibraryCore.Configuration public IBaseConfiguration Generate() { + EnableWebFront = Utilities.PromptBool("Enable webfront"); EnableMultipleOwners = Utilities.PromptBool("Enable multiple owners"); EnableSteppedHierarchy = Utilities.PromptBool("Enable stepped privilege hierarchy"); EnableCustomSayName = Utilities.PromptBool("Enable custom say name"); diff --git a/WebfrontCore/Controllers/BaseController.cs b/WebfrontCore/Controllers/BaseController.cs index 7d5bdd2c..044b78e1 100644 --- a/WebfrontCore/Controllers/BaseController.cs +++ b/WebfrontCore/Controllers/BaseController.cs @@ -22,7 +22,7 @@ namespace WebfrontCore.Controllers { Manager = Program.Manager; - User = new EFClient() + User = User ?? new EFClient() { ClientId = -1 }; diff --git a/WebfrontCore/ViewComponents/PenaltyListViewComponent.cs b/WebfrontCore/ViewComponents/PenaltyListViewComponent.cs index 2c674f60..d867d2ca 100644 --- a/WebfrontCore/ViewComponents/PenaltyListViewComponent.cs +++ b/WebfrontCore/ViewComponents/PenaltyListViewComponent.cs @@ -4,7 +4,6 @@ using SharedLibraryCore.Dtos; using SharedLibraryCore.Objects; using System; using System.Linq; -using System.Security.Claims; using System.Threading.Tasks; namespace WebfrontCore.ViewComponents @@ -13,7 +12,7 @@ namespace WebfrontCore.ViewComponents { public async Task InvokeAsync(int offset) { - var penalties = await Program.Manager.GetPenaltyService().GetRecentPenalties(15, offset); + var penalties = await Program.Manager.GetPenaltyService().GetRecentPenalties(12, offset); var penaltiesDto = penalties.Select(p => new PenaltyInfo() { OffenderId = p.OffenderId, @@ -28,8 +27,7 @@ namespace WebfrontCore.ViewComponents Sensitive = p.Type == Penalty.PenaltyType.Flag }); - bool authorized = User.Identity.IsAuthenticated; - penaltiesDto = authorized ? penaltiesDto.ToList() : penaltiesDto.Where(p => !p.Sensitive).ToList(); + penaltiesDto = User.Identity.IsAuthenticated ? penaltiesDto.ToList() : penaltiesDto.Where(p => !p.Sensitive).ToList(); return View("_List", penaltiesDto); } diff --git a/WebfrontCore/Views/Penalty/List.cshtml b/WebfrontCore/Views/Penalty/List.cshtml index c76ad4fe..5205f72d 100644 --- a/WebfrontCore/Views/Penalty/List.cshtml +++ b/WebfrontCore/Views/Penalty/List.cshtml @@ -17,6 +17,7 @@
+ @section scripts { diff --git a/WebfrontCore/Views/Shared/_Layout.cshtml b/WebfrontCore/Views/Shared/_Layout.cshtml index 958a6c21..42910d12 100644 --- a/WebfrontCore/Views/Shared/_Layout.cshtml +++ b/WebfrontCore/Views/Shared/_Layout.cshtml @@ -11,6 +11,8 @@ + + @@ -136,10 +138,6 @@ - - - - diff --git a/WebfrontCore/WebfrontCore.csproj b/WebfrontCore/WebfrontCore.csproj index e2937c84..9083ed1a 100644 --- a/WebfrontCore/WebfrontCore.csproj +++ b/WebfrontCore/WebfrontCore.csproj @@ -33,10 +33,20 @@ + + + + + + + + + + - + diff --git a/WebfrontCore/bundleconfig.json b/WebfrontCore/bundleconfig.json index d1fda815..38588e92 100644 --- a/WebfrontCore/bundleconfig.json +++ b/WebfrontCore/bundleconfig.json @@ -13,6 +13,10 @@ { "outputFileName": "wwwroot/js/global.min.js", "inputFiles": [ + "wwwroot/lib/jQuery/dist/jquery.min.js", + "wwwroot/lib/moment/min/moment.min.js", + "wwwroot/lib/moment-timezone/builds/moment-timezone.min.js", + "wwwroot/lib/bootstrap/dist/js/bootstrap.min.js", "wwwroot/js/action.js", "wwwroot/js/console.js", "wwwroot/js/penalty.js", diff --git a/WebfrontCore/wwwroot/_references.js b/WebfrontCore/wwwroot/_references.js deleted file mode 100644 index 53daa2be..00000000 --- a/WebfrontCore/wwwroot/_references.js +++ /dev/null @@ -1,3 +0,0 @@ -/// -/// -/// \ No newline at end of file diff --git a/WebfrontCore/wwwroot/favicon.ico b/WebfrontCore/wwwroot/favicon.ico deleted file mode 100644 index 3edaf82e78eddb63bc92829bab97e7199c2b7c02..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32038 zcmeHQ30PF;xt!?&}l~y%rk_w@(>I1DxwM?Z_`T7ogry+g^;ubF+{9d3^{dAg2wRGvg z_oA0ns{ZFyszoS+tbi~Ok3a>mswv|J9?LiW-M)QWJycKE)vM}*rKK8Y;fHM6v?M4l zE+;THwi8cpP;Bf;eEY9YPWF+4)z{aj4vvri3(EB4xsB%ro{qtH`fdx|wCOo97$NcT zD+cpk0i4x|+qaJ)m=Q@y^MF5oFs%*WGx;zw3kp1uehyDR=wHT9zuwcM28=j@fiQ@l zjxx^=rXAs@vESiINplH4Rc##rR(#naLA)mJup6SaBs6oQNA>X!IF%|qEe zWr1p53L<$4G=XjsSQ=Z0k)za?0fU;$<}X!C=9yxH5^Yr{7S zqb%~iiH!f~H;^~ptkX2u(xC3D+P1=z&Fd)aXew7T!IK{}`+I)G=sdC@!%ik(-1Cmg ziKUyL$Wizc$VTJdu929;TcXlBgEH8ocrwh$unm(DVdp`NA!A+ z;gD-nON%BvG4WZn)iBtKGPGNZ%|dt;-<4>KF<}V_uk0@^)w-J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gUAph(Z?$P}L zx177*@%t6CL5Jo1HpczOK$qpN>l#C<#t`BYrIdFnhrR51e0php74=TGx0@$-JAV}I zF9-RDr0%(NVZ5^nXC&j;KEKwyO=Ar8iE)K@3;#OLZYK6A>)j``RtBEv{tQt+hm{HH zqz!Zb^SN{m)q55C-!nJ^Oz^AreW69YN4v^9TOQ{c{+-~Wzx@l+&Aw<&DqxX>RQ#CZH6SL#qn+47U1OC$PPI@3&N_s?Q&^=;aJz@`mXSh?pf=;JIt?GUtg!8Xxfy5Sj%FT5i^e++c} zt!=w^Tm6FJ;+w@&vT4~uoSDpL{Ip$Sb>{APW8kD;vH0(nFhA)-Z)2G6i>AN{>o9N4 znEW)i+|4%&5BG9p+%0^I(Q!EaEAOTq!11GK8sO?lhxcOniqua5AQm7VZ76uo326Xg91%zbY8fd zV8C`5Lht>dqw@c3=?Auljy)2w_ys0l>?cJ*_pSbC<8OqYk#mH1gAU+&fRVrd#}fEo D@Z25R diff --git a/WebfrontCore/wwwroot/js/penalty.js b/WebfrontCore/wwwroot/js/penalty.js index 2d15024e..064beeca 100644 --- a/WebfrontCore/wwwroot/js/penalty.js +++ b/WebfrontCore/wwwroot/js/penalty.js @@ -1,16 +1,24 @@ -let offset = 15; +let offset = 12; +let isLoading = false; function loadMorePenalties() { + if (isLoading) { + return false; + } + showLoader(); + isLoading = true; $.get('/Penalty/ListAsync', { offset: offset }) .done(function (response) { $('#penalty_table').append(response); hideLoader(); + isLoading = false; }) .fail(function (jqxhr, statis, error) { errorLoader(); + isLoading = false; }); - offset += 15; + offset += 12; } if ($('#penalty_table').length === 1) { @@ -37,10 +45,13 @@ if ($('#penalty_table').length === 1) { var hasScrollBar = false; $document.ready(function () { - $window .off('scroll', ScrollHandler) .on('scroll', ScrollHandler); + + $('#load_penalties_button').hover(function () { + loadMorePenalties(); + }); }); function ScrollHandler(e) {