mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-04 10:02:40 +01:00
Replaced Url with BaseUrl in most indexers.
This commit is contained in:
parent
2dbf095fd5
commit
7b0e40d5d0
@ -20,7 +20,7 @@ public void Setup()
|
||||
Subject.Definition = new IndexerDefinition()
|
||||
{
|
||||
Name = "IPTorrents",
|
||||
Settings = new IPTorrentsSettings() { Url = "http://fake.com/" }
|
||||
Settings = new IPTorrentsSettings() { BaseUrl = "http://fake.com/" }
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ public void SetUp()
|
||||
{
|
||||
_settings = new NewznabSettings()
|
||||
{
|
||||
Url = "http://indxer.local"
|
||||
BaseUrl = "http://indxer.local"
|
||||
};
|
||||
|
||||
_caps = ReadAllText("Files/Indexers/Newznab/newznab_caps.xml");
|
||||
|
@ -26,7 +26,7 @@ public void Setup()
|
||||
Name = "Newznab",
|
||||
Settings = new NewznabSettings()
|
||||
{
|
||||
Url = "http://indexer.local/",
|
||||
BaseUrl = "http://indexer.local/",
|
||||
Categories = new int[] { 1 }
|
||||
}
|
||||
};
|
||||
|
@ -20,10 +20,10 @@ public void SetUp()
|
||||
{
|
||||
Subject.Settings = new NewznabSettings()
|
||||
{
|
||||
Url = "http://127.0.0.1:1234/",
|
||||
Categories = new [] { 1, 2 },
|
||||
AnimeCategories = new [] { 3, 4 },
|
||||
ApiKey = "abcd",
|
||||
BaseUrl = "http://127.0.0.1:1234/",
|
||||
Categories = new [] { 1, 2 },
|
||||
AnimeCategories = new [] { 3, 4 },
|
||||
ApiKey = "abcd",
|
||||
};
|
||||
|
||||
_singleEpisodeSearchCriteria = new SingleEpisodeSearchCriteria
|
||||
@ -84,7 +84,7 @@ public void should_use_only_anime_categories_for_anime_search()
|
||||
|
||||
page.Url.FullUri.Should().Contain("&cat=3,4&");
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void should_use_mode_search_for_anime()
|
||||
{
|
||||
|
@ -15,12 +15,12 @@ public void requires_apikey(string url)
|
||||
var setting = new NewznabSettings()
|
||||
{
|
||||
ApiKey = "",
|
||||
Url = url
|
||||
BaseUrl = url
|
||||
};
|
||||
|
||||
|
||||
setting.Validate().IsValid.Should().BeFalse();
|
||||
setting.Validate().Errors.Should().Contain(c => c.PropertyName == "ApiKey");
|
||||
setting.Validate().Errors.Should().Contain(c => c.PropertyName == nameof(NewznabSettings.ApiKey));
|
||||
|
||||
}
|
||||
|
||||
@ -32,13 +32,13 @@ public void invalid_url_should_not_apikey(string url)
|
||||
var setting = new NewznabSettings
|
||||
{
|
||||
ApiKey = "",
|
||||
Url = url
|
||||
BaseUrl = url
|
||||
};
|
||||
|
||||
|
||||
setting.Validate().IsValid.Should().BeFalse();
|
||||
setting.Validate().Errors.Should().NotContain(c => c.PropertyName == "ApiKey");
|
||||
setting.Validate().Errors.Should().Contain(c => c.PropertyName == "Url");
|
||||
setting.Validate().Errors.Should().NotContain(c => c.PropertyName == nameof(NewznabSettings.ApiKey));
|
||||
setting.Validate().Errors.Should().Contain(c => c.PropertyName == nameof(NewznabSettings.BaseUrl));
|
||||
|
||||
}
|
||||
|
||||
@ -49,11 +49,11 @@ public void doesnt_requires_apikey(string url)
|
||||
var setting = new NewznabSettings()
|
||||
{
|
||||
ApiKey = "",
|
||||
Url = url
|
||||
BaseUrl = url
|
||||
};
|
||||
|
||||
|
||||
setting.Validate().IsValid.Should().BeTrue();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,17 @@
|
||||
using System;
|
||||
using NzbDrone.Core.Indexers;
|
||||
using NzbDrone.Core.ThingiProvider;
|
||||
using NzbDrone.Core.Validation;
|
||||
|
||||
namespace NzbDrone.Core.Test.IndexerTests
|
||||
{
|
||||
public class TestIndexerSettings : IProviderConfig
|
||||
public class TestIndexerSettings : IIndexerSettings
|
||||
{
|
||||
public NzbDroneValidationResult Validate()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public string BaseUrl { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ public void Setup()
|
||||
Name = "Torznab",
|
||||
Settings = new TorznabSettings()
|
||||
{
|
||||
Url = "http://indexer.local/",
|
||||
BaseUrl = "http://indexer.local/",
|
||||
Categories = new int[] { 1 }
|
||||
}
|
||||
};
|
||||
@ -44,7 +44,7 @@ public void should_parse_recent_feed_from_torznab_hdaccess_net()
|
||||
Mocker.GetMock<IHttpClient>()
|
||||
.Setup(o => o.Execute(It.Is<HttpRequest>(v => v.Method == HttpMethod.GET)))
|
||||
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), recentFeed));
|
||||
|
||||
|
||||
var releases = Subject.FetchRecent();
|
||||
|
||||
releases.Should().HaveCount(5);
|
||||
|
@ -0,0 +1,58 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using FluentMigrator;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Common.Serializer;
|
||||
using NzbDrone.Core.Datastore.Migration.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Datastore.Migration
|
||||
{
|
||||
[Migration(113)]
|
||||
public class consolidate_indexer_baseurl : NzbDroneMigrationBase
|
||||
{
|
||||
protected override void MainDbUpgrade()
|
||||
{
|
||||
Execute.WithConnection(RenameUrlToBaseUrl);
|
||||
}
|
||||
|
||||
private void RenameUrlToBaseUrl(IDbConnection conn, IDbTransaction tran)
|
||||
{
|
||||
using (var cmd = conn.CreateCommand())
|
||||
{
|
||||
cmd.Transaction = tran;
|
||||
cmd.CommandText = "SELECT Id, Settings FROM Indexers WHERE ConfigContract IN ('NewznabSettings', 'TorznabSettings', 'IPTorrentsSettings', 'OmgwtfnzbsSettings')";
|
||||
|
||||
using (var reader = cmd.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
var id = reader.GetInt32(0);
|
||||
var settings = reader.GetString(1);
|
||||
|
||||
if (settings.IsNotNullOrWhiteSpace())
|
||||
{
|
||||
var jsonObject = Json.Deserialize<JObject>(settings);
|
||||
|
||||
if (jsonObject.Property("url") != null)
|
||||
{
|
||||
jsonObject.AddFirst(new JProperty("baseUrl", jsonObject["url"]));
|
||||
jsonObject.Remove("url");
|
||||
settings = jsonObject.ToJson();
|
||||
|
||||
using (var updateCmd = conn.CreateCommand())
|
||||
{
|
||||
updateCmd.Transaction = tran;
|
||||
updateCmd.CommandText = "UPDATE Indexers SET Settings = ? WHERE Id = ?";
|
||||
updateCmd.AddParameter(settings);
|
||||
updateCmd.AddParameter(id);
|
||||
updateCmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -23,7 +23,7 @@ public BitMeTvSettingsValidator()
|
||||
}
|
||||
}
|
||||
|
||||
public class BitMeTvSettings : IProviderConfig
|
||||
public class BitMeTvSettings : IIndexerSettings
|
||||
{
|
||||
private static readonly BitMeTvSettingsValidator Validator = new BitMeTvSettingsValidator();
|
||||
|
||||
@ -49,4 +49,4 @@ public NzbDroneValidationResult Validate()
|
||||
return new NzbDroneValidationResult(Validator.Validate(this));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ public BroadcastheNetSettingsValidator()
|
||||
}
|
||||
}
|
||||
|
||||
public class BroadcastheNetSettings : IProviderConfig
|
||||
public class BroadcastheNetSettings : IIndexerSettings
|
||||
{
|
||||
private static readonly BroadcastheNetSettingsValidator Validator = new BroadcastheNetSettingsValidator();
|
||||
|
||||
|
@ -13,7 +13,7 @@ public FanzubSettingsValidator()
|
||||
}
|
||||
}
|
||||
|
||||
public class FanzubSettings : IProviderConfig
|
||||
public class FanzubSettings : IIndexerSettings
|
||||
{
|
||||
private static readonly FanzubSettingsValidator Validator = new FanzubSettingsValidator();
|
||||
|
||||
|
@ -14,7 +14,7 @@ public HDBitsSettingsValidator()
|
||||
}
|
||||
}
|
||||
|
||||
public class HDBitsSettings : IProviderConfig
|
||||
public class HDBitsSettings : IIndexerSettings
|
||||
{
|
||||
private static readonly HDBitsSettingsValidator Validator = new HDBitsSettingsValidator();
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
namespace NzbDrone.Core.Indexers
|
||||
{
|
||||
public abstract class HttpIndexerBase<TSettings> : IndexerBase<TSettings>
|
||||
where TSettings : IProviderConfig, new()
|
||||
where TSettings : IIndexerSettings, new()
|
||||
{
|
||||
protected const int MaxNumResultsPerQuery = 1000;
|
||||
|
||||
|
13
src/NzbDrone.Core/Indexers/IIndexerSettings.cs
Normal file
13
src/NzbDrone.Core/Indexers/IIndexerSettings.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using NzbDrone.Core.ThingiProvider;
|
||||
|
||||
namespace NzbDrone.Core.Indexers
|
||||
{
|
||||
public interface IIndexerSettings : IProviderConfig
|
||||
{
|
||||
string BaseUrl { get; set; }
|
||||
}
|
||||
}
|
@ -7,7 +7,7 @@ namespace NzbDrone.Core.Indexers.IPTorrents
|
||||
public class IPTorrentsRequestGenerator : IIndexerRequestGenerator
|
||||
{
|
||||
public IPTorrentsSettings Settings { get; set; }
|
||||
|
||||
|
||||
public virtual IndexerPageableRequestChain GetRecentRequests()
|
||||
{
|
||||
var pageableRequests = new IndexerPageableRequestChain();
|
||||
@ -44,7 +44,7 @@ public virtual IndexerPageableRequestChain GetSearchRequests(SpecialEpisodeSearc
|
||||
|
||||
private IEnumerable<IndexerRequest> GetRssRequests()
|
||||
{
|
||||
yield return new IndexerRequest(Settings.Url, HttpAccept.Rss);
|
||||
yield return new IndexerRequest(Settings.BaseUrl, HttpAccept.Rss);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,17 +11,17 @@ public class IPTorrentsSettingsValidator : AbstractValidator<IPTorrentsSettings>
|
||||
{
|
||||
public IPTorrentsSettingsValidator()
|
||||
{
|
||||
RuleFor(c => c.Url).ValidRootUrl();
|
||||
RuleFor(c => c.BaseUrl).ValidRootUrl();
|
||||
|
||||
RuleFor(c => c.Url).Matches(@"/rss\?.+$");
|
||||
RuleFor(c => c.BaseUrl).Matches(@"/rss\?.+$");
|
||||
|
||||
RuleFor(c => c.Url).Matches(@"/rss\?.+;download(?:;|$)")
|
||||
RuleFor(c => c.BaseUrl).Matches(@"/rss\?.+;download(?:;|$)")
|
||||
.WithMessage("Use Direct Download Url (;download)")
|
||||
.When(v => v.Url.IsNotNullOrWhiteSpace() && Regex.IsMatch(v.Url, @"/rss\?.+$"));
|
||||
.When(v => v.BaseUrl.IsNotNullOrWhiteSpace() && Regex.IsMatch(v.BaseUrl, @"/rss\?.+$"));
|
||||
}
|
||||
}
|
||||
|
||||
public class IPTorrentsSettings : IProviderConfig
|
||||
public class IPTorrentsSettings : IIndexerSettings
|
||||
{
|
||||
private static readonly IPTorrentsSettingsValidator Validator = new IPTorrentsSettingsValidator();
|
||||
|
||||
@ -30,7 +30,7 @@ public IPTorrentsSettings()
|
||||
}
|
||||
|
||||
[FieldDefinition(0, Label = "Feed URL", HelpText = "The full RSS feed url generated by IPTorrents, using only the categories you selected (HD, SD, x264, etc ...)")]
|
||||
public string Url { get; set; }
|
||||
public string BaseUrl { get; set; }
|
||||
|
||||
public NzbDroneValidationResult Validate()
|
||||
{
|
||||
|
@ -13,7 +13,7 @@
|
||||
namespace NzbDrone.Core.Indexers
|
||||
{
|
||||
public abstract class IndexerBase<TSettings> : IIndexer
|
||||
where TSettings : IProviderConfig, new()
|
||||
where TSettings : IIndexerSettings, new()
|
||||
{
|
||||
protected readonly IIndexerStatusService _indexerStatusService;
|
||||
protected readonly IConfigService _configService;
|
||||
|
@ -78,7 +78,7 @@ private IndexerDefinition GetDefinition(string name, NewznabSettings settings)
|
||||
|
||||
private NewznabSettings GetSettings(string url, params int[] categories)
|
||||
{
|
||||
var settings = new NewznabSettings { Url = url };
|
||||
var settings = new NewznabSettings { BaseUrl = url };
|
||||
|
||||
if (categories.Any())
|
||||
{
|
||||
|
@ -41,7 +41,7 @@ private NewznabCapabilities FetchCapabilities(NewznabSettings indexerSettings)
|
||||
{
|
||||
var capabilities = new NewznabCapabilities();
|
||||
|
||||
var url = string.Format("{0}/api?t=caps", indexerSettings.Url.TrimEnd('/'));
|
||||
var url = string.Format("{0}/api?t=caps", indexerSettings.BaseUrl.TrimEnd('/'));
|
||||
|
||||
if (indexerSettings.ApiKey.IsNotNullOrWhiteSpace())
|
||||
{
|
||||
@ -58,7 +58,7 @@ private NewznabCapabilities FetchCapabilities(NewznabSettings indexerSettings)
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Debug(ex, "Failed to get newznab api capabilities from {0}", indexerSettings.Url);
|
||||
_logger.Debug(ex, "Failed to get newznab api capabilities from {0}", indexerSettings.BaseUrl);
|
||||
throw;
|
||||
}
|
||||
|
||||
@ -68,14 +68,14 @@ private NewznabCapabilities FetchCapabilities(NewznabSettings indexerSettings)
|
||||
}
|
||||
catch (XmlException ex)
|
||||
{
|
||||
_logger.Debug(ex, "Failed to parse newznab api capabilities for {0}.", indexerSettings.Url);
|
||||
_logger.Debug(ex, "Failed to parse newznab api capabilities for {0}.", indexerSettings.BaseUrl);
|
||||
|
||||
ex.WithData(response);
|
||||
throw;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex, "Failed to determine newznab api capabilities for {0}, using the defaults instead till Sonarr restarts.", indexerSettings.Url);
|
||||
_logger.Error(ex, "Failed to determine newznab api capabilities for {0}, using the defaults instead till Sonarr restarts.", indexerSettings.BaseUrl);
|
||||
}
|
||||
|
||||
return capabilities;
|
||||
|
@ -249,7 +249,7 @@ private IEnumerable<IndexerRequest> GetPagedRequests(int maxPages, IEnumerable<i
|
||||
|
||||
var categoriesQuery = string.Join(",", categories.Distinct());
|
||||
|
||||
var baseUrl = string.Format("{0}/api?t={1}&cat={2}&extended=1{3}", Settings.Url.TrimEnd('/'), searchType, categoriesQuery, Settings.AdditionalParameters);
|
||||
var baseUrl = string.Format("{0}/api?t={1}&cat={2}&extended=1{3}", Settings.BaseUrl.TrimEnd('/'), searchType, categoriesQuery, Settings.AdditionalParameters);
|
||||
|
||||
if (Settings.ApiKey.IsNotNullOrWhiteSpace())
|
||||
{
|
||||
|
@ -25,12 +25,12 @@ public class NewznabSettingsValidator : AbstractValidator<NewznabSettings>
|
||||
|
||||
private static bool ShouldHaveApiKey(NewznabSettings settings)
|
||||
{
|
||||
if (settings.Url == null)
|
||||
if (settings.BaseUrl == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return ApiKeyWhiteList.Any(c => settings.Url.ToLowerInvariant().Contains(c));
|
||||
return ApiKeyWhiteList.Any(c => settings.BaseUrl.ToLowerInvariant().Contains(c));
|
||||
}
|
||||
|
||||
private static readonly Regex AdditionalParametersRegex = new Regex(@"(&.+?\=.+?)+", RegexOptions.Compiled);
|
||||
@ -47,14 +47,14 @@ public NewznabSettingsValidator()
|
||||
return null;
|
||||
});
|
||||
|
||||
RuleFor(c => c.Url).ValidRootUrl();
|
||||
RuleFor(c => c.BaseUrl).ValidRootUrl();
|
||||
RuleFor(c => c.ApiKey).NotEmpty().When(ShouldHaveApiKey);
|
||||
RuleFor(c => c.AdditionalParameters).Matches(AdditionalParametersRegex)
|
||||
.When(c => !c.AdditionalParameters.IsNullOrWhiteSpace());
|
||||
}
|
||||
}
|
||||
|
||||
public class NewznabSettings : IProviderConfig
|
||||
public class NewznabSettings : IIndexerSettings
|
||||
{
|
||||
private static readonly NewznabSettingsValidator Validator = new NewznabSettingsValidator();
|
||||
|
||||
@ -65,7 +65,7 @@ public NewznabSettings()
|
||||
}
|
||||
|
||||
[FieldDefinition(0, Label = "URL")]
|
||||
public string Url { get; set; }
|
||||
public string BaseUrl { get; set; }
|
||||
|
||||
[FieldDefinition(1, Label = "API Key")]
|
||||
public string ApiKey { get; set; }
|
||||
@ -84,4 +84,4 @@ public virtual NzbDroneValidationResult Validate()
|
||||
return new NzbDroneValidationResult(Validator.Validate(this));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ public NyaaSettingsValidator()
|
||||
}
|
||||
}
|
||||
|
||||
public class NyaaSettings : IProviderConfig
|
||||
public class NyaaSettings : IIndexerSettings
|
||||
{
|
||||
private static readonly NyaaSettingsValidator Validator = new NyaaSettingsValidator();
|
||||
|
||||
@ -35,4 +35,4 @@ public NzbDroneValidationResult Validate()
|
||||
return new NzbDroneValidationResult(Validator.Validate(this));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ public OmgwtfnzbsSettingsValidator()
|
||||
}
|
||||
}
|
||||
|
||||
public class OmgwtfnzbsSettings : IProviderConfig
|
||||
public class OmgwtfnzbsSettings : IIndexerSettings
|
||||
{
|
||||
private static readonly OmgwtfnzbsSettingsValidator Validator = new OmgwtfnzbsSettingsValidator();
|
||||
|
||||
@ -24,6 +24,9 @@ public OmgwtfnzbsSettings()
|
||||
Delay = 30;
|
||||
}
|
||||
|
||||
// Unused since Omg has a hardcoded url.
|
||||
public string BaseUrl { get; set; }
|
||||
|
||||
[FieldDefinition(0, Label = "Username")]
|
||||
public string Username { get; set; }
|
||||
|
||||
|
@ -13,7 +13,7 @@ public RarbgSettingsValidator()
|
||||
}
|
||||
}
|
||||
|
||||
public class RarbgSettings : IProviderConfig
|
||||
public class RarbgSettings : IIndexerSettings
|
||||
{
|
||||
private static readonly RarbgSettingsValidator Validator = new RarbgSettingsValidator();
|
||||
|
||||
@ -28,7 +28,7 @@ public RarbgSettings()
|
||||
|
||||
[FieldDefinition(1, Type = FieldType.Checkbox, Label = "Ranked Only", HelpText = "Only include ranked results.")]
|
||||
public bool RankedOnly { get; set; }
|
||||
|
||||
|
||||
[FieldDefinition(2, Type = FieldType.Captcha, Label = "CAPTCHA Token", HelpText = "CAPTCHA Clearance token used to handle CloudFlare Anti-DDOS measures on shared-ip VPNs.")]
|
||||
public string CaptchaToken { get; set; }
|
||||
|
||||
@ -37,4 +37,4 @@ public NzbDroneValidationResult Validate()
|
||||
return new NzbDroneValidationResult(Validator.Validate(this));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ public TorrentRssIndexerSettingsValidator()
|
||||
}
|
||||
}
|
||||
|
||||
public class TorrentRssIndexerSettings : IProviderConfig
|
||||
public class TorrentRssIndexerSettings : IIndexerSettings
|
||||
{
|
||||
private static readonly TorrentRssIndexerSettingsValidator validator = new TorrentRssIndexerSettingsValidator();
|
||||
|
||||
@ -37,4 +37,4 @@ public NzbDroneValidationResult Validate()
|
||||
return new NzbDroneValidationResult(validator.Validate(this));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ public TorrentleechSettingsValidator()
|
||||
}
|
||||
}
|
||||
|
||||
public class TorrentleechSettings : IProviderConfig
|
||||
public class TorrentleechSettings : IIndexerSettings
|
||||
{
|
||||
private static readonly TorrentleechSettingsValidator Validator = new TorrentleechSettingsValidator();
|
||||
|
||||
@ -34,4 +34,4 @@ public NzbDroneValidationResult Validate()
|
||||
return new NzbDroneValidationResult(Validator.Validate(this));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ private IndexerDefinition GetDefinition(string name, TorznabSettings settings)
|
||||
|
||||
private TorznabSettings GetSettings(string url, params int[] categories)
|
||||
{
|
||||
var settings = new TorznabSettings { Url = url };
|
||||
var settings = new TorznabSettings { BaseUrl = url };
|
||||
|
||||
if (categories.Any())
|
||||
{
|
||||
|
@ -17,12 +17,12 @@ public class TorznabSettingsValidator : AbstractValidator<TorznabSettings>
|
||||
|
||||
private static bool ShouldHaveApiKey(TorznabSettings settings)
|
||||
{
|
||||
if (settings.Url == null)
|
||||
if (settings.BaseUrl == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return ApiKeyWhiteList.Any(c => settings.Url.ToLowerInvariant().Contains(c));
|
||||
return ApiKeyWhiteList.Any(c => settings.BaseUrl.ToLowerInvariant().Contains(c));
|
||||
}
|
||||
|
||||
private static readonly Regex AdditionalParametersRegex = new Regex(@"(&.+?\=.+?)+", RegexOptions.Compiled);
|
||||
@ -39,7 +39,7 @@ public TorznabSettingsValidator()
|
||||
return null;
|
||||
});
|
||||
|
||||
RuleFor(c => c.Url).ValidRootUrl();
|
||||
RuleFor(c => c.BaseUrl).ValidRootUrl();
|
||||
RuleFor(c => c.ApiKey).NotEmpty().When(ShouldHaveApiKey);
|
||||
RuleFor(c => c.AdditionalParameters).Matches(AdditionalParametersRegex)
|
||||
.When(c => !c.AdditionalParameters.IsNullOrWhiteSpace());
|
||||
@ -55,4 +55,4 @@ public override NzbDroneValidationResult Validate()
|
||||
return new NzbDroneValidationResult(Validator.Validate(this));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -250,6 +250,7 @@
|
||||
<Compile Include="Datastore\Migration\069_quality_proper.cs" />
|
||||
<Compile Include="Datastore\Migration\070_delay_profile.cs" />
|
||||
<Compile Include="Datastore\Migration\102_add_language_to_episodeFiles_history_and_blacklist.cs" />
|
||||
<Compile Include="Datastore\Migration\113_consolidate_indexer_baseurl.cs" />
|
||||
<Compile Include="Datastore\Migration\112_added_regex_to_scenemapping.cs" />
|
||||
<Compile Include="Datastore\Migration\110_fix_extra_files_config.cs" />
|
||||
<Compile Include="Datastore\Migration\109_import_extra_files.cs" />
|
||||
@ -628,6 +629,7 @@
|
||||
<Compile Include="Indexers\HDBits\HDBitsSettings.cs" />
|
||||
<Compile Include="Indexers\IIndexer.cs" />
|
||||
<Compile Include="Indexers\IIndexerRequestGenerator.cs" />
|
||||
<Compile Include="Indexers\IIndexerSettings.cs" />
|
||||
<Compile Include="Indexers\IndexerBase.cs" />
|
||||
<Compile Include="Indexers\IndexerDefinition.cs" />
|
||||
<Compile Include="Indexers\IndexerFactory.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user