From b251ef00c432500d80cbca7cd74510a17b665472 Mon Sep 17 00:00:00 2001 From: RaidMax Date: Fri, 27 Dec 2019 12:10:20 -0600 Subject: [PATCH] potential fix for a invalid operation exception on client update change client library cdn provider as cdnjs seems broken at the moment --- Application/IW4MServer.cs | 7 ++++++- Application/Main.cs | 7 ++++--- WebfrontCore/Controllers/API/APIController.cs | 1 + WebfrontCore/libman.json | 4 ++-- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Application/IW4MServer.cs b/Application/IW4MServer.cs index edb1a3583..52c7bc158 100644 --- a/Application/IW4MServer.cs +++ b/Application/IW4MServer.cs @@ -558,7 +558,12 @@ namespace IW4MAdmin private async Task OnClientUpdate(EFClient origin) { - var client = GetClientsAsList().First(_client => _client.Equals(origin)); + var client = GetClientsAsList().FirstOrDefault(_client => _client.Equals(origin)); + + if (client == null) + { + Logger.WriteWarning($"{origin} expected to exist in client list for update, but they do not"); + } client.Ping = origin.Ping; client.Score = origin.Score; diff --git a/Application/Main.cs b/Application/Main.cs index 57123d703..f0381394f 100644 --- a/Application/Main.cs +++ b/Application/Main.cs @@ -236,9 +236,10 @@ namespace IW4MAdmin.Application private static void ConfigureServices() { - //var serviceProvider = new ServiceCollection(); - //serviceProvider.AddSingleton(ServerManager); - //serviceProvider.BuildServiceProvider(); + var serviceProvider = new ServiceCollection(); + serviceProvider.AddSingleton(ServerManager); + var builder = serviceProvider.BuildServiceProvider(); + builder.Dispose(); } } } diff --git a/WebfrontCore/Controllers/API/APIController.cs b/WebfrontCore/Controllers/API/APIController.cs index 4c47d5ecb..505496422 100644 --- a/WebfrontCore/Controllers/API/APIController.cs +++ b/WebfrontCore/Controllers/API/APIController.cs @@ -12,6 +12,7 @@ namespace WebfrontCore.Controllers.API { } + public IActionResult Index() { return Ok($"IW4MAdmin API"); diff --git a/WebfrontCore/libman.json b/WebfrontCore/libman.json index c62cb2e46..b8b551c0d 100644 --- a/WebfrontCore/libman.json +++ b/WebfrontCore/libman.json @@ -1,6 +1,6 @@ { "version": "1.0", - "defaultProvider": "cdnjs", + "defaultProvider": "jsdelivr", "libraries": [ { "library": "jquery@3.3.1", @@ -24,7 +24,7 @@ "destination": "wwwroot/lib/bootstrap/" }, { - "library": "moment.js@2.24.0", + "library": "moment@2.24.0", "destination": "wwwroot/lib/moment.js/" } ]