From 67d40b5407ff8477ae6dba1f0cda1ae4eec03e59 Mon Sep 17 00:00:00 2001 From: bobbahbrown Date: Sun, 22 Aug 2021 20:21:54 -0300 Subject: [PATCH] big funny update --- .idea/.idea.CentCom/.idea/workspace.xml | 29 +++++++++++++++++-- CentCom.API/CentCom.API.csproj | 23 ++++++++------- .../Controllers/ScraperInfoController.cs | 13 +++++++++ CentCom.API/Startup.cs | 2 +- CentCom.API/Views/ScraperInfo/index.cshtml | 12 ++++++++ CentCom.Bot/CentCom.Bot.csproj | 2 +- CentCom.Common/CentCom.Common.csproj | 2 +- CentCom.Exporter/CentCom.Exporter.csproj | 2 +- CentCom.Server/CentCom.Server.csproj | 2 +- CentCom.Server/Services/RestBanService.cs | 6 ++++ CentCom.Server/appsettings.json | 6 ++++ 11 files changed, 81 insertions(+), 18 deletions(-) create mode 100644 CentCom.API/Controllers/ScraperInfoController.cs create mode 100644 CentCom.API/Views/ScraperInfo/index.cshtml diff --git a/.idea/.idea.CentCom/.idea/workspace.xml b/.idea/.idea.CentCom/.idea/workspace.xml index eca2079..44c9ef7 100644 --- a/.idea/.idea.CentCom/.idea/workspace.xml +++ b/.idea/.idea.CentCom/.idea/workspace.xml @@ -11,8 +11,17 @@ + + - + + + + + + + + + + + file://$PROJECT_DIR$/CentCom.Exporter/Controllers/BanController.cs + 26 + + + + + + + + diff --git a/CentCom.API/CentCom.API.csproj b/CentCom.API/CentCom.API.csproj index 47cddf2..7d6190a 100644 --- a/CentCom.API/CentCom.API.csproj +++ b/CentCom.API/CentCom.API.csproj @@ -2,7 +2,7 @@ net5.0 - 1.3.11 + 1.3.12 1f5f48fa-862f-4472-ba34-2c5a26035e88 @@ -15,19 +15,20 @@ - - - - - - - - - + + + + + + + + + + - + diff --git a/CentCom.API/Controllers/ScraperInfoController.cs b/CentCom.API/Controllers/ScraperInfoController.cs new file mode 100644 index 0000000..9957944 --- /dev/null +++ b/CentCom.API/Controllers/ScraperInfoController.cs @@ -0,0 +1,13 @@ +using Microsoft.AspNetCore.Mvc; + +namespace CentCom.API.Controllers +{ + [Route("scraper")] + public class ScraperInfoController : Controller + { + public IActionResult Index() + { + return View(); + } + } +} \ No newline at end of file diff --git a/CentCom.API/Startup.cs b/CentCom.API/Startup.cs index a190d26..a57c8de 100644 --- a/CentCom.API/Startup.cs +++ b/CentCom.API/Startup.cs @@ -31,7 +31,7 @@ public void ConfigureServices(IServiceCollection services) { x.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter()); x.JsonSerializerOptions.IgnoreNullValues = true; - }); + }).AddRazorRuntimeCompilation(); // Add DB context var dbConfig = new DbConfig(); diff --git a/CentCom.API/Views/ScraperInfo/index.cshtml b/CentCom.API/Views/ScraperInfo/index.cshtml new file mode 100644 index 0000000..519f6e7 --- /dev/null +++ b/CentCom.API/Views/ScraperInfo/index.cshtml @@ -0,0 +1,12 @@ +@{ + ViewBag.Title = "CentCom"; +} +

Data Aggregation Bots

+

+ CentCom makes use of automated data aggregators which collect information from consenting websites. The information provided by our consenting partners is temporarily replicated within CentCom's databases, and is + updated often to reflect any modification or deletion of the source data. If your site is being parsed by CentCom without your consent, or you otherwise have any issues, contact the + developer bobbahbrown through Discord at bobbahbrown#0001. +

+

+ Our aggregators can be identified by their user agent: Mozilla/5.0 (compatible; CentComBot/<version> +https://centcom.melonmesa.com/scraper) +

\ No newline at end of file diff --git a/CentCom.Bot/CentCom.Bot.csproj b/CentCom.Bot/CentCom.Bot.csproj index 3951c4f..8c67b3f 100644 --- a/CentCom.Bot/CentCom.Bot.csproj +++ b/CentCom.Bot/CentCom.Bot.csproj @@ -2,7 +2,7 @@ Exe - 1.3.11 + 1.3.12 net5.0 c8af1449-8cdf-4707-a66d-51e896551bfb diff --git a/CentCom.Common/CentCom.Common.csproj b/CentCom.Common/CentCom.Common.csproj index c01fd05..fcb9579 100644 --- a/CentCom.Common/CentCom.Common.csproj +++ b/CentCom.Common/CentCom.Common.csproj @@ -2,7 +2,7 @@ net5.0 - 1.3.11 + 1.3.12 diff --git a/CentCom.Exporter/CentCom.Exporter.csproj b/CentCom.Exporter/CentCom.Exporter.csproj index 0931aa9..6bc5dca 100644 --- a/CentCom.Exporter/CentCom.Exporter.csproj +++ b/CentCom.Exporter/CentCom.Exporter.csproj @@ -2,7 +2,7 @@ net5.0 - 1.3.11 + 1.3.12 a625260b-31a1-4f4b-84f4-96ccc7a335e7 diff --git a/CentCom.Server/CentCom.Server.csproj b/CentCom.Server/CentCom.Server.csproj index d129adc..8163e59 100644 --- a/CentCom.Server/CentCom.Server.csproj +++ b/CentCom.Server/CentCom.Server.csproj @@ -3,7 +3,7 @@ Exe net5.0 - 1.3.11 + 1.3.12 94572412-7eb8-4652-aff2-8afc154cf139 diff --git a/CentCom.Server/Services/RestBanService.cs b/CentCom.Server/Services/RestBanService.cs index b4fc1b6..584feb4 100644 --- a/CentCom.Server/Services/RestBanService.cs +++ b/CentCom.Server/Services/RestBanService.cs @@ -1,3 +1,4 @@ +using System.Reflection; using System.Text; using CentCom.Server.Exceptions; using Microsoft.Extensions.Logging; @@ -39,6 +40,11 @@ protected void FailedRequest(IRestResponse response) protected void InitializeClient() { Client = BaseUrl != null ? new RestClient(BaseUrl) : null; + if (Client == null) + return; + + // Setup user agent + Client.UserAgent = $"Mozilla/5.0 (compatible; CentComBot/{Assembly.GetExecutingAssembly().GetName().Version}; +https://centcom.melonmesa.com/scraper)"; } } } \ No newline at end of file diff --git a/CentCom.Server/appsettings.json b/CentCom.Server/appsettings.json index 79dac15..594c67c 100644 --- a/CentCom.Server/appsettings.json +++ b/CentCom.Server/appsettings.json @@ -7,5 +7,11 @@ "allowFulpExpiredSSL": true }, "standardSources": [ + { + "id": "shiptest", + "display": "Shiptest 13", + "roleplayLevel": "Medium", + "url": "https://bans.shiptest.ga/" + } ] } \ No newline at end of file