From c9ea74267b66746c820dcf87071c49c4ef68242b Mon Sep 17 00:00:00 2001 From: pcjones Date: Mon, 30 Sep 2024 14:09:01 +0200 Subject: [PATCH 01/15] Fix typo --- UmlautAdaptarr/Services/Factory/ArrApplicationFactory.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/UmlautAdaptarr/Services/Factory/ArrApplicationFactory.cs b/UmlautAdaptarr/Services/Factory/ArrApplicationFactory.cs index 2fe4ddc..8836304 100644 --- a/UmlautAdaptarr/Services/Factory/ArrApplicationFactory.cs +++ b/UmlautAdaptarr/Services/Factory/ArrApplicationFactory.cs @@ -45,9 +45,9 @@ namespace UmlautAdaptarr.Services.Factory ReadarrInstances = rrArrApplications.Values.OfType(); AllInstances = rrArrApplications; - if (!AllInstances.Values.Any()) + if (AllInstances.Values.Count == 0) { - throw new Exception("No RrApplication could be successfully initialized. This could be due to a faulty configuration"); + throw new Exception("No ArrApplication could be successfully initialized. This could be due to a faulty configuration"); } } catch (Exception e) From ee329c23e59fb036c539640192e6d5cb1aff2a0b Mon Sep 17 00:00:00 2001 From: pcjones Date: Mon, 30 Sep 2024 14:09:32 +0200 Subject: [PATCH 02/15] Fix typos --- .../Services/Factory/ArrApplicationFactory.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/UmlautAdaptarr/Services/Factory/ArrApplicationFactory.cs b/UmlautAdaptarr/Services/Factory/ArrApplicationFactory.cs index 8836304..32a92ad 100644 --- a/UmlautAdaptarr/Services/Factory/ArrApplicationFactory.cs +++ b/UmlautAdaptarr/Services/Factory/ArrApplicationFactory.cs @@ -33,17 +33,17 @@ namespace UmlautAdaptarr.Services.Factory /// /// Constructor for the ArrApplicationFactory. /// - /// A dictionary of IArrApplication instances. + /// A dictionary of IArrApplication instances. /// Logger Instanz - public ArrApplicationFactory(IDictionary rrArrApplications, ILogger logger) + public ArrApplicationFactory(IDictionary arrArrApplications, ILogger logger) { _logger = logger; try { - SonarrInstances = rrArrApplications.Values.OfType(); - LidarrInstances = rrArrApplications.Values.OfType(); - ReadarrInstances = rrArrApplications.Values.OfType(); - AllInstances = rrArrApplications; + SonarrInstances = arrArrApplications.Values.OfType(); + LidarrInstances = arrArrApplications.Values.OfType(); + ReadarrInstances = arrArrApplications.Values.OfType(); + AllInstances = arrArrApplications; if (AllInstances.Values.Count == 0) { From 0e38d5a0f3b5de29fca3b3445f90b65c307050c6 Mon Sep 17 00:00:00 2001 From: pcjones Date: Mon, 30 Sep 2024 14:09:46 +0200 Subject: [PATCH 03/15] Fix typos --- .../Services/Factory/ArrApplicationFactory.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/UmlautAdaptarr/Services/Factory/ArrApplicationFactory.cs b/UmlautAdaptarr/Services/Factory/ArrApplicationFactory.cs index 32a92ad..4d14fe7 100644 --- a/UmlautAdaptarr/Services/Factory/ArrApplicationFactory.cs +++ b/UmlautAdaptarr/Services/Factory/ArrApplicationFactory.cs @@ -33,17 +33,17 @@ namespace UmlautAdaptarr.Services.Factory /// /// Constructor for the ArrApplicationFactory. /// - /// A dictionary of IArrApplication instances. + /// A dictionary of IArrApplication instances. /// Logger Instanz - public ArrApplicationFactory(IDictionary arrArrApplications, ILogger logger) + public ArrApplicationFactory(IDictionary arrApplications, ILogger logger) { _logger = logger; try { - SonarrInstances = arrArrApplications.Values.OfType(); - LidarrInstances = arrArrApplications.Values.OfType(); - ReadarrInstances = arrArrApplications.Values.OfType(); - AllInstances = arrArrApplications; + SonarrInstances = arrApplications.Values.OfType(); + LidarrInstances = arrApplications.Values.OfType(); + ReadarrInstances = arrApplications.Values.OfType(); + AllInstances = arrApplications; if (AllInstances.Values.Count == 0) { From 2085a28da2a185ded7798a53b82166131506f702 Mon Sep 17 00:00:00 2001 From: pcjones Date: Mon, 30 Sep 2024 14:10:56 +0200 Subject: [PATCH 04/15] Fix typo --- UmlautAdaptarr/Services/Factory/ArrApplicationFactory.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UmlautAdaptarr/Services/Factory/ArrApplicationFactory.cs b/UmlautAdaptarr/Services/Factory/ArrApplicationFactory.cs index 4d14fe7..98f2b5c 100644 --- a/UmlautAdaptarr/Services/Factory/ArrApplicationFactory.cs +++ b/UmlautAdaptarr/Services/Factory/ArrApplicationFactory.cs @@ -4,7 +4,7 @@ using UmlautAdaptarr.Providers; namespace UmlautAdaptarr.Services.Factory { /// - /// Factory for creating RrApplication instances. + /// Factory for creating ArrApplication instances. /// public class ArrApplicationFactory { From e95d18ed91b5b9cd71aedbe7a08d173d03d4ee03 Mon Sep 17 00:00:00 2001 From: pcjones Date: Mon, 21 Oct 2024 14:25:03 +0200 Subject: [PATCH 05/15] Clarify error message --- UmlautAdaptarr/Utilities/ServicesExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UmlautAdaptarr/Utilities/ServicesExtensions.cs b/UmlautAdaptarr/Utilities/ServicesExtensions.cs index 7037172..fb44872 100644 --- a/UmlautAdaptarr/Utilities/ServicesExtensions.cs +++ b/UmlautAdaptarr/Utilities/ServicesExtensions.cs @@ -68,7 +68,7 @@ public static class ServicesExtensions Console.WriteLine(($"Property {failure.PropertyName } failed validation. Error was: {failure.ErrorMessage}")); } - throw new Exception("Please fix first you config and then Start UmlautAdaptarr again"); + throw new Exception("Please fix cour environment variables and then Start UmlautAdaptarr again"); } var instanceState = (bool)(typeof(TOptions).GetProperty("Enabled")?.GetValue(option, null) ?? false); From 4c582c7a6c18e8150d8c6ae389a4698f66d1bda0 Mon Sep 17 00:00:00 2001 From: akuntsch Date: Mon, 21 Oct 2024 17:15:11 +0200 Subject: [PATCH 06/15] Fix reachable and ipleak test (#47) * Fix reachable check Fixes failing reachable checks when Basic Authentication is enabled in Sonarr, Radarr, etc. * Add option to disable IP leak test --------- Co-authored-by: Jonas F --- UmlautAdaptarr/Program.cs | 23 ++++++---- UmlautAdaptarr/Utilities/Helper.cs | 4 +- .../Utilities/ServicesExtensions.cs | 12 +++--- .../GlobalInstanceOptionsValidator.cs | 42 +++++++------------ UmlautAdaptarr/appsettings.json | 3 ++ 5 files changed, 41 insertions(+), 43 deletions(-) diff --git a/UmlautAdaptarr/Program.cs b/UmlautAdaptarr/Program.cs index c6e42f4..5df6506 100644 --- a/UmlautAdaptarr/Program.cs +++ b/UmlautAdaptarr/Program.cs @@ -8,10 +8,12 @@ using UmlautAdaptarr.Utilities; internal class Program { - private static void Main(string[] args) + private static void Main(string[] args) { + MainAsync(args).Wait(); + } + + private static async Task MainAsync(string[] args) { - Helper.ShowLogo(); - Helper.ShowInformation(); // TODO: // add option to sort by nzb age var builder = WebApplication.CreateBuilder(args); @@ -43,9 +45,9 @@ internal class Program builder.AddTitleLookupService(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); - builder.AddSonarrSupport(); - builder.AddLidarrSupport(); - builder.AddReadarrSupport(); + await builder.AddSonarrSupport(); + await builder.AddLidarrSupport(); + await builder.AddReadarrSupport(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); @@ -54,6 +56,13 @@ internal class Program var app = builder.Build(); + Helper.ShowLogo(); + + if (app.Configuration.GetValue("IpLeakTest:Enabled")) + { + await Helper.ShowInformation(); + } + GlobalStaticLogger.Initialize(app.Services.GetService()!); app.UseHttpsRedirection(); app.UseAuthorization(); @@ -109,4 +118,4 @@ internal class Program //.Enrich.With(new ApiKeyMaskingEnricher("appsettings.json")) // TODO - Not working currently .CreateLogger(); } -} \ No newline at end of file +} diff --git a/UmlautAdaptarr/Utilities/Helper.cs b/UmlautAdaptarr/Utilities/Helper.cs index 002310e..ff6a26c 100644 --- a/UmlautAdaptarr/Utilities/Helper.cs +++ b/UmlautAdaptarr/Utilities/Helper.cs @@ -11,10 +11,10 @@ public static class Helper "\r\n _ _ _ _ ___ _ _ \r\n| | | | | | | | / _ \\ | | | | \r\n| | | |_ __ ___ | | __ _ _ _| |_/ /_\\ \\ __| | __ _ _ __ | |_ __ _ _ __ _ __ \r\n| | | | '_ ` _ \\| |/ _` | | | | __| _ |/ _` |/ _` | '_ \\| __/ _` | '__| '__|\r\n| |_| | | | | | | | (_| | |_| | |_| | | | (_| | (_| | |_) | || (_| | | | | \r\n \\___/|_| |_| |_|_|\\__,_|\\__,_|\\__\\_| |_/\\__,_|\\__,_| .__/ \\__\\__,_|_| |_| \r\n | | \r\n |_| \r\n"); } - public static void ShowInformation() + public static async Task ShowInformation() { Console.WriteLine("--------------------------[IP Leak Test]-----------------------------"); - var ipInfo = GetPublicIpAddressInfoAsync().GetAwaiter().GetResult(); + var ipInfo = await GetPublicIpAddressInfoAsync(); if (ipInfo != null) { diff --git a/UmlautAdaptarr/Utilities/ServicesExtensions.cs b/UmlautAdaptarr/Utilities/ServicesExtensions.cs index 7037172..3c7184d 100644 --- a/UmlautAdaptarr/Utilities/ServicesExtensions.cs +++ b/UmlautAdaptarr/Utilities/ServicesExtensions.cs @@ -29,7 +29,7 @@ public static class ServicesExtensions /// The to configure the service collection. /// The name of the configuration section containing service options. /// The configured . - private static WebApplicationBuilder AddServicesWithOptions( + private static async Task AddServicesWithOptions( this WebApplicationBuilder builder, string sectionName) where TOptions : class, new() where TService : class, TInterface @@ -57,9 +57,9 @@ public static class ServicesExtensions foreach (var option in optionsArray) { - GlobalInstanceOptionsValidator validator = new GlobalInstanceOptionsValidator(); + GlobalInstanceOptionsValidator validator = new(); - var results = validator.Validate(option as GlobalInstanceOptions); + var results = await validator.ValidateAsync(option as GlobalInstanceOptions); if (!results.IsValid) { @@ -143,7 +143,7 @@ public static class ServicesExtensions /// /// The to configure the service collection. /// The configured . - public static WebApplicationBuilder AddSonarrSupport(this WebApplicationBuilder builder) + public static Task AddSonarrSupport(this WebApplicationBuilder builder) { // builder.Serviceses.AddSingleton, OptionsMonitoSonarrInstanceOptionsns>>(); return builder.AddServicesWithOptions("Sonarr"); @@ -154,7 +154,7 @@ public static class ServicesExtensions /// /// The to configure the service collection. /// The configured . - public static WebApplicationBuilder AddLidarrSupport(this WebApplicationBuilder builder) + public static Task AddLidarrSupport(this WebApplicationBuilder builder) { return builder.AddServicesWithOptions("Lidarr"); } @@ -164,7 +164,7 @@ public static class ServicesExtensions /// /// The to configure the service collection. /// The configured . - public static WebApplicationBuilder AddReadarrSupport(this WebApplicationBuilder builder) + public static Task AddReadarrSupport(this WebApplicationBuilder builder) { return builder.AddServicesWithOptions("Readarr"); } diff --git a/UmlautAdaptarr/Validator/GlobalInstanceOptionsValidator.cs b/UmlautAdaptarr/Validator/GlobalInstanceOptionsValidator.cs index eca7e94..de6d087 100644 --- a/UmlautAdaptarr/Validator/GlobalInstanceOptionsValidator.cs +++ b/UmlautAdaptarr/Validator/GlobalInstanceOptionsValidator.cs @@ -6,6 +6,10 @@ namespace UmlautAdaptarr.Validator; public class GlobalInstanceOptionsValidator : AbstractValidator { + private readonly static HttpClient httpClient = new() { + Timeout = TimeSpan.FromSeconds(3) + }; + public GlobalInstanceOptionsValidator() { RuleFor(x => x.Enabled).NotNull(); @@ -14,12 +18,14 @@ public class GlobalInstanceOptionsValidator : AbstractValidator x.Host) .NotEmpty().WithMessage("Host is required when Enabled is true.") - .Must(BeAValidUrl).WithMessage("Host/Url must start with http:// or https:// and be a valid address.") - .Must(BeReachable) - .WithMessage("Host/Url is not reachable. Please check your Host or your UmlautAdaptrr Settings"); + .Must(BeAValidUrl).WithMessage("Host/Url must start with http:// or https:// and be a valid address."); RuleFor(x => x.ApiKey) .NotEmpty().WithMessage("ApiKey is required when Enabled is true."); + + RuleFor(x => x) + .MustAsync(BeReachable) + .WithMessage("Host/Url is not reachable. Please check your Host or your UmlautAdaptrr Settings"); }); } @@ -29,42 +35,22 @@ public class GlobalInstanceOptionsValidator : AbstractValidator BeReachable(GlobalInstanceOptions opts, CancellationToken cancellationToken) { var endTime = DateTime.Now.AddMinutes(3); var reachable = false; + var url = $"{opts.Host}/api?apikey={opts.ApiKey}"; while (DateTime.Now < endTime) { try { - // TODO use HttpClient here - var request = (HttpWebRequest)WebRequest.Create(url); - request.AllowAutoRedirect = false; - request.Timeout = 3000; - using var response = (HttpWebResponse)request.GetResponse(); + using var response = await httpClient.GetAsync(url, cancellationToken); reachable = response.StatusCode == HttpStatusCode.OK; - if (reachable) + if (response.IsSuccessStatusCode) { break; } - // If status is 301/302 (Found), follow the redirect manually - else if (response.StatusCode == HttpStatusCode.MovedPermanently || response.StatusCode == HttpStatusCode.Found) - { - var redirectUrl = response.Headers["Location"]; // Get the redirect URL - if (!string.IsNullOrEmpty(redirectUrl)) - { - // Create a new request for the redirected URL - var redirectRequest = (HttpWebRequest)WebRequest.Create(redirectUrl); - redirectRequest.Timeout = 3000; - using var redirectResponse = (HttpWebResponse)redirectRequest.GetResponse(); - reachable = redirectResponse.StatusCode == HttpStatusCode.OK; - if (reachable) - { - break; - } - } - } } catch { @@ -72,7 +58,7 @@ public class GlobalInstanceOptionsValidator : AbstractValidator Date: Mon, 21 Oct 2024 17:20:28 +0200 Subject: [PATCH 07/15] Add IpLeakTest environment variable to docker compose --- UmlautAdaptarr/appsettings.json | 2 ++ docker-compose.yml | 1 + 2 files changed, 3 insertions(+) diff --git a/UmlautAdaptarr/appsettings.json b/UmlautAdaptarr/appsettings.json index 0f31cc6..c1874b8 100644 --- a/UmlautAdaptarr/appsettings.json +++ b/UmlautAdaptarr/appsettings.json @@ -66,6 +66,8 @@ "ApiKey": "your_readarr_api_key" }, "IpLeakTest": { + // Docker Environment Variables: + // - IpLeakTest: false (set to true to enable) "Enabled": false } } diff --git a/docker-compose.yml b/docker-compose.yml index 7c97b17..52252cd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -23,6 +23,7 @@ services: - LIDARR__ENABLED=false - LIDARR__HOST=http://localhost:8686 - LIDARR__APIKEY=APIKEY + #- IpLeakTest=false # uncomment and set to true to enable IP leak test ### example for multiple instances of same type #- SONARR__0__NAME=NAME 1 (optional) #- SONARR__0__ENABLED=false From 29da77148468a7f4d3ce1b805cf5e84a354ce0de Mon Sep 17 00:00:00 2001 From: pcjones Date: Mon, 21 Oct 2024 23:32:18 +0200 Subject: [PATCH 08/15] Add more logging to reachable check --- .../Validator/GlobalInstanceOptionsValidator.cs | 12 ++++++++---- UmlautAdaptarr/appsettings.json | 2 +- docker-compose.yml | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/UmlautAdaptarr/Validator/GlobalInstanceOptionsValidator.cs b/UmlautAdaptarr/Validator/GlobalInstanceOptionsValidator.cs index de6d087..50c34dd 100644 --- a/UmlautAdaptarr/Validator/GlobalInstanceOptionsValidator.cs +++ b/UmlautAdaptarr/Validator/GlobalInstanceOptionsValidator.cs @@ -46,19 +46,23 @@ public class GlobalInstanceOptionsValidator : AbstractValidator Date: Mon, 21 Oct 2024 23:34:12 +0200 Subject: [PATCH 09/15] Fix missing semicolon --- UmlautAdaptarr/Validator/GlobalInstanceOptionsValidator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UmlautAdaptarr/Validator/GlobalInstanceOptionsValidator.cs b/UmlautAdaptarr/Validator/GlobalInstanceOptionsValidator.cs index 50c34dd..8c08027 100644 --- a/UmlautAdaptarr/Validator/GlobalInstanceOptionsValidator.cs +++ b/UmlautAdaptarr/Validator/GlobalInstanceOptionsValidator.cs @@ -53,7 +53,7 @@ public class GlobalInstanceOptionsValidator : AbstractValidator Date: Tue, 22 Oct 2024 10:33:37 +0200 Subject: [PATCH 10/15] Fix typo --- UmlautAdaptarr/Utilities/ServicesExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UmlautAdaptarr/Utilities/ServicesExtensions.cs b/UmlautAdaptarr/Utilities/ServicesExtensions.cs index 808906a..594859a 100644 --- a/UmlautAdaptarr/Utilities/ServicesExtensions.cs +++ b/UmlautAdaptarr/Utilities/ServicesExtensions.cs @@ -68,7 +68,7 @@ public static class ServicesExtensions Console.WriteLine(($"Property {failure.PropertyName } failed validation. Error was: {failure.ErrorMessage}")); } - throw new Exception("Please fix cour environment variables and then Start UmlautAdaptarr again"); + throw new Exception("Please fix your environment variables and then Start UmlautAdaptarr again"); } var instanceState = (bool)(typeof(TOptions).GetProperty("Enabled")?.GetValue(option, null) ?? false); From 03b50a24fdedfd16f5996a1a4b8dc10a9d3ec3c3 Mon Sep 17 00:00:00 2001 From: pcjones Date: Fri, 25 Oct 2024 13:26:43 +0200 Subject: [PATCH 11/15] Log content on error at ProcessContent --- UmlautAdaptarr/Controllers/SearchController.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/UmlautAdaptarr/Controllers/SearchController.cs b/UmlautAdaptarr/Controllers/SearchController.cs index 63f2f03..6744f83 100644 --- a/UmlautAdaptarr/Controllers/SearchController.cs +++ b/UmlautAdaptarr/Controllers/SearchController.cs @@ -1,12 +1,13 @@ using Microsoft.AspNetCore.Mvc; using System.Text; using UmlautAdaptarr.Models; +using UmlautAdaptarr.Providers; using UmlautAdaptarr.Services; using UmlautAdaptarr.Utilities; namespace UmlautAdaptarr.Controllers { - public abstract class SearchControllerBase(ProxyRequestService proxyRequestService, TitleMatchingService titleMatchingService) : ControllerBase + public abstract class SearchControllerBase(ProxyRequestService proxyRequestService, TitleMatchingService titleMatchingService, ILogger logger) : ControllerBase { // TODO evaluate if this should be set to true by default private readonly bool TODO_FORCE_TEXT_SEARCH_ORIGINAL_TITLE = true; @@ -110,7 +111,15 @@ namespace UmlautAdaptarr.Controllers private string ProcessContent(string content, SearchItem? searchItem) { - return titleMatchingService.RenameTitlesInContent(content, searchItem); + try + { + return titleMatchingService.RenameTitlesInContent(content, searchItem); + } + catch (Exception ex) + { + logger.LogError($"Error at ProcessContent: {ex.Message}{Environment.NewLine}Content:{Environment.NewLine}{content}"); + } + return null; } public async Task AggregateSearchResults( From 31ac409d41dafbf3d82a3155fd47af0c8bdc84b4 Mon Sep 17 00:00:00 2001 From: pcjones Date: Fri, 25 Oct 2024 13:37:50 +0200 Subject: [PATCH 12/15] Fix logger --- UmlautAdaptarr/Controllers/SearchController.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/UmlautAdaptarr/Controllers/SearchController.cs b/UmlautAdaptarr/Controllers/SearchController.cs index 6744f83..9961616 100644 --- a/UmlautAdaptarr/Controllers/SearchController.cs +++ b/UmlautAdaptarr/Controllers/SearchController.cs @@ -163,7 +163,8 @@ namespace UmlautAdaptarr.Controllers public class SearchController(ProxyRequestService proxyRequestService, TitleMatchingService titleMatchingService, - SearchItemLookupService searchItemLookupService) : SearchControllerBase(proxyRequestService, titleMatchingService) + SearchItemLookupService searchItemLookupService, + ILogger logger) : SearchControllerBase(proxyRequestService, titleMatchingService, logger) { public readonly string[] LIDARR_CATEGORY_IDS = ["3000", "3010", "3020", "3040", "3050"]; public readonly string[] READARR_CATEGORY_IDS = ["3030", "3130", "7000", "7010", "7020", "7030", "7100", "7110", "7120", "7130"]; From 6fc399131b1170f2d5f7b6dedae9cb64116d9d96 Mon Sep 17 00:00:00 2001 From: pcjones Date: Sat, 2 Nov 2024 15:46:52 +0100 Subject: [PATCH 13/15] Allow port in URL --- UmlautAdaptarr/Utilities/UrlUtilities.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/UmlautAdaptarr/Utilities/UrlUtilities.cs b/UmlautAdaptarr/Utilities/UrlUtilities.cs index 2d016ae..dd81425 100644 --- a/UmlautAdaptarr/Utilities/UrlUtilities.cs +++ b/UmlautAdaptarr/Utilities/UrlUtilities.cs @@ -5,7 +5,8 @@ namespace UmlautAdaptarr.Utilities { public partial class UrlUtilities { - [GeneratedRegex(@"^(?!http:\/\/)([a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)+.*)$")] + [GeneratedRegex(@"^(?!http:\/\/)([a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)+(:\d+)?(/.*)?)$")] + private static partial Regex UrlMatchingRegex(); public static bool IsValidDomain(string domain) { From c581233dbff0c740e73cac9a0577bb8228c5c9e5 Mon Sep 17 00:00:00 2001 From: pcjones Date: Sat, 2 Nov 2024 15:51:05 +0100 Subject: [PATCH 14/15] Bypass domain check for localhost --- UmlautAdaptarr/Controllers/CapsController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UmlautAdaptarr/Controllers/CapsController.cs b/UmlautAdaptarr/Controllers/CapsController.cs index 9dc8fc3..e8df172 100644 --- a/UmlautAdaptarr/Controllers/CapsController.cs +++ b/UmlautAdaptarr/Controllers/CapsController.cs @@ -13,7 +13,7 @@ namespace UmlautAdaptarr.Controllers [HttpGet] public async Task Caps([FromRoute] string options, [FromRoute] string domain, [FromQuery] string? apikey) { - if (!UrlUtilities.IsValidDomain(domain)) + if (!domain.StartsWith("localhost") && !UrlUtilities.IsValidDomain(domain)) { return NotFound($"{domain} is not a valid URL."); } From 17456c6f90c63238820688ee120c9c15d058e5ad Mon Sep 17 00:00:00 2001 From: pcjones Date: Fri, 8 Nov 2024 13:56:29 +0100 Subject: [PATCH 15/15] Clarify error message --- UmlautAdaptarr/Services/Factory/ArrApplicationFactory.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UmlautAdaptarr/Services/Factory/ArrApplicationFactory.cs b/UmlautAdaptarr/Services/Factory/ArrApplicationFactory.cs index 98f2b5c..dda33b9 100644 --- a/UmlautAdaptarr/Services/Factory/ArrApplicationFactory.cs +++ b/UmlautAdaptarr/Services/Factory/ArrApplicationFactory.cs @@ -52,7 +52,7 @@ namespace UmlautAdaptarr.Services.Factory } catch (Exception e) { - _logger.LogError("Error while Register ArrFactory. This might be a Config Problem", e.Message); + _logger.LogError("Error while registering ArrFactory. This is most likely a config problem, please check your environment variables.", e.Message); throw; } }