diff --git a/FilterLists.sln.DotSettings b/FilterLists.sln.DotSettings index d9356d8bd..b68d8a19e 100644 --- a/FilterLists.sln.DotSettings +++ b/FilterLists.sln.DotSettings @@ -1,7 +1,4 @@ - + ExplicitlyExcluded True @@ -183,6 +180,11 @@ </TypePattern> </Patterns> False + True + True + True + True + True True True True diff --git a/src/FilterLists.Agent/Infrastructure/Web/EntityUrlValidator.cs b/src/FilterLists.Agent/Infrastructure/Web/EntityUrlValidator.cs index ec3738a69..02175f32f 100644 --- a/src/FilterLists.Agent/Infrastructure/Web/EntityUrlValidator.cs +++ b/src/FilterLists.Agent/Infrastructure/Web/EntityUrlValidator.cs @@ -3,7 +3,9 @@ using System.Net.Http.Headers; using System.Threading; using System.Threading.Tasks; +using FilterLists.Agent.AppSettings; using FilterLists.Agent.Core.Urls; +using Microsoft.Extensions.Options; namespace FilterLists.Agent.Infrastructure.Web { @@ -11,10 +13,10 @@ public class EntityUrlValidator : IEntityUrlValidator { private readonly HttpClient _httpClient; - public EntityUrlValidator(HttpClient httpClient) + public EntityUrlValidator(HttpClient httpClient, IOptions filterListsApiOptions) { httpClient.Timeout = TimeSpan.FromSeconds(90); - var header = new ProductHeaderValue("FilterLists.Agent"); + var header = new ProductHeaderValue(filterListsApiOptions.Value.ClientUserAgent); var userAgent = new ProductInfoHeaderValue(header); httpClient.DefaultRequestHeaders.UserAgent.Add(userAgent); _httpClient = httpClient; diff --git a/src/FilterLists.Agent/Infrastructure/Web/ListRepository.cs b/src/FilterLists.Agent/Infrastructure/Web/ListRepository.cs index d9d95675a..5af6b3f43 100644 --- a/src/FilterLists.Agent/Infrastructure/Web/ListRepository.cs +++ b/src/FilterLists.Agent/Infrastructure/Web/ListRepository.cs @@ -5,8 +5,10 @@ using System.Net.Http.Headers; using System.Threading; using System.Threading.Tasks; +using FilterLists.Agent.AppSettings; using FilterLists.Agent.Core.Lists; using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; namespace FilterLists.Agent.Infrastructure.Web { @@ -15,10 +17,11 @@ public class ListRepository : IListRepository private readonly HttpClient _httpClient; private readonly ILogger _logger; - public ListRepository(HttpClient httpClient, ILogger logger) + public ListRepository(HttpClient httpClient, ILogger logger, + IOptions filterListsApiOptions) { httpClient.Timeout = TimeSpan.FromSeconds(90); - var header = new ProductHeaderValue("FilterLists.Agent"); + var header = new ProductHeaderValue(filterListsApiOptions.Value.ClientUserAgent); var userAgent = new ProductInfoHeaderValue(header); httpClient.DefaultRequestHeaders.UserAgent.Add(userAgent); _httpClient = httpClient;