From 11dbf744a9137cd11887f030921a4d6e8031cf1d Mon Sep 17 00:00:00 2001 From: bobbahbrown Date: Tue, 15 Dec 2020 23:57:47 -0400 Subject: [PATCH] Version 1.3.1 --- CentCom.API/CentCom.API.csproj | 14 +++++++------- CentCom.Common/CentCom.Common.csproj | 14 +++++++------- CentCom.Server/CentCom.Server.csproj | 16 ++++++++-------- CentCom.Server/Services/BeeBanService.cs | 3 ++- CentCom.Server/Services/FulpBanService.cs | 8 +++++++- CentCom.Server/Services/TGMCBanService.cs | 5 +++++ CentCom.Server/appsettings.json | 3 +++ 7 files changed, 39 insertions(+), 24 deletions(-) diff --git a/CentCom.API/CentCom.API.csproj b/CentCom.API/CentCom.API.csproj index 1487fa3..8565222 100644 --- a/CentCom.API/CentCom.API.csproj +++ b/CentCom.API/CentCom.API.csproj @@ -2,9 +2,9 @@ net5.0 - 1.3.0 - 1.3.0.0 - 1.3.0.0 + 1.3.1 + 1.3.1.0 + 1.3.1.0 @@ -18,10 +18,10 @@ - - - - + + + + diff --git a/CentCom.Common/CentCom.Common.csproj b/CentCom.Common/CentCom.Common.csproj index 86cf2bc..9b89fd2 100644 --- a/CentCom.Common/CentCom.Common.csproj +++ b/CentCom.Common/CentCom.Common.csproj @@ -2,17 +2,17 @@ net5.0 - 1.3.0 - 1.3.0.0 - 1.3.0.0 + 1.3.1 + 1.3.1.0 + 1.3.1.0 - - + + - - + + diff --git a/CentCom.Server/CentCom.Server.csproj b/CentCom.Server/CentCom.Server.csproj index a713534..286fe7a 100644 --- a/CentCom.Server/CentCom.Server.csproj +++ b/CentCom.Server/CentCom.Server.csproj @@ -3,9 +3,9 @@ Exe net5.0 - 1.3.0.0 - 1.3.0.0 - 1.3.0 + 1.3.1.0 + 1.3.1.0 + 1.3.1 @@ -14,18 +14,18 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + - - + + diff --git a/CentCom.Server/Services/BeeBanService.cs b/CentCom.Server/Services/BeeBanService.cs index 15a8378..cddd2bb 100644 --- a/CentCom.Server/Services/BeeBanService.cs +++ b/CentCom.Server/Services/BeeBanService.cs @@ -44,12 +44,13 @@ public async Task> GetBansAsync(int page = 1) var content = JsonSerializer.Deserialize>>(response.Content); foreach (var b in content) { + var expiryString = b["unban_date"].GetString() ?? b["expire_date"].GetString(); var toAdd = new Ban() { BannedOn = DateTime.Parse(b["ban_date"].GetString()).ToUniversalTime(), BannedBy = b["banner"].GetString(), BanType = ParseBanType(b["type"].GetString()), - Expires = b["unban_date"].GetString() == null ? (DateTime?)null : DateTime.Parse(b["unban_date"].GetString()).ToUniversalTime(), + Expires = expiryString == null ? (DateTime?)null : DateTime.Parse(expiryString).ToUniversalTime(), CKey = b["user"].GetString(), Reason = b["reason"].GetString(), BanID = b["id"].GetInt32().ToString(), diff --git a/CentCom.Server/Services/FulpBanService.cs b/CentCom.Server/Services/FulpBanService.cs index 24500d5..c95e310 100644 --- a/CentCom.Server/Services/FulpBanService.cs +++ b/CentCom.Server/Services/FulpBanService.cs @@ -2,6 +2,7 @@ using CentCom.Server.Exceptions; using CentCom.Server.Extensions; using Extensions; +using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; using RestSharp; using System; @@ -22,10 +23,15 @@ public class FulpBanService private readonly static BanSource _banSource = new BanSource() { Name = "fulp" }; - public FulpBanService(ILogger logger) + public FulpBanService(ILogger logger, IConfiguration config) { _logger = logger; _client = new RestClient(BASE_URL); + + if (config.GetSection("sourceConfig").GetValue("allowFulpExpiredSSL")) + { + _client.RemoteCertificateValidationCallback = (sender, certificate, chain, sslPolicyError) => true; + } } public async Task> GetBansAsync(int page = 1) diff --git a/CentCom.Server/Services/TGMCBanService.cs b/CentCom.Server/Services/TGMCBanService.cs index 62624ba..c41de3b 100644 --- a/CentCom.Server/Services/TGMCBanService.cs +++ b/CentCom.Server/Services/TGMCBanService.cs @@ -5,6 +5,7 @@ using Microsoft.Extensions.Logging; using RestSharp; using System; +using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; @@ -120,6 +121,10 @@ await range.AsyncParallelForEach(async page => } }, 12); + + if (dirtyBans.IsEmpty) + return Enumerable.Empty(); + // We have to ensure that our jobs are correctly grouped due to possible errors with paging var cleanBans = new List(dirtyBans.Where(x => x.BanType == BanType.Server)); foreach (var group in dirtyBans.Where(x => x.BanType == BanType.Job).GroupBy(x => new { x.BannedOn, x.CKey, x.Reason })) diff --git a/CentCom.Server/appsettings.json b/CentCom.Server/appsettings.json index fab3ed5..3a1f355 100644 --- a/CentCom.Server/appsettings.json +++ b/CentCom.Server/appsettings.json @@ -2,5 +2,8 @@ "dbConfig": { "connectionString": "connection_string_goes_here", "dbType": "db_type_goes_here" + }, + "sourceConfig": { + "allowFulpExpiredSSL": true } } \ No newline at end of file