Fixed: Check only enabled Jackett indexers for '/all' endpoint

(cherry picked from commit ae3dd5730e05c5229e7f7092f15c33859524863b)

Closes #2730
pull/2736/head
Bogdan 1 year ago
parent 52221c7cf4
commit b49d2312ab

@ -38,6 +38,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
_definition = new IndexerDefinition _definition = new IndexerDefinition
{ {
Name = "Indexer", Name = "Indexer",
EnableRss = true,
ConfigContract = "TorznabSettings", ConfigContract = "TorznabSettings",
Settings = torznabSettings Settings = torznabSettings
}; };

@ -8,6 +8,7 @@ using NzbDrone.Core.ThingiProvider.Events;
namespace NzbDrone.Core.HealthCheck.Checks namespace NzbDrone.Core.HealthCheck.Checks
{ {
[CheckOn(typeof(ProviderAddedEvent<IIndexer>))]
[CheckOn(typeof(ProviderUpdatedEvent<IIndexer>))] [CheckOn(typeof(ProviderUpdatedEvent<IIndexer>))]
[CheckOn(typeof(ProviderDeletedEvent<IIndexer>))] [CheckOn(typeof(ProviderDeletedEvent<IIndexer>))]
[CheckOn(typeof(ProviderStatusChangedEvent<IIndexer>))] [CheckOn(typeof(ProviderStatusChangedEvent<IIndexer>))]
@ -23,12 +24,15 @@ namespace NzbDrone.Core.HealthCheck.Checks
public override HealthCheck Check() public override HealthCheck Check()
{ {
var jackettAllProviders = _providerFactory.All().Where( var jackettAllProviders = _providerFactory.All()
i => i.ConfigContract.Equals("TorznabSettings") && .Where(
((i.Settings as TorznabSettings).BaseUrl.Contains("/torznab/all/api", StringComparison.InvariantCultureIgnoreCase) || i => i.Enable &&
(i.Settings as TorznabSettings).BaseUrl.Contains("/api/v2.0/indexers/all/results/torznab", StringComparison.InvariantCultureIgnoreCase) || i.ConfigContract.Equals("TorznabSettings") &&
(i.Settings as TorznabSettings).ApiPath.Contains("/torznab/all/api", StringComparison.InvariantCultureIgnoreCase) || (((TorznabSettings)i.Settings).BaseUrl.Contains("/torznab/all/api", StringComparison.InvariantCultureIgnoreCase) ||
(i.Settings as TorznabSettings).ApiPath.Contains("/api/v2.0/indexers/all/results/torznab", StringComparison.InvariantCultureIgnoreCase))); ((TorznabSettings)i.Settings).BaseUrl.Contains("/api/v2.0/indexers/all/results/torznab", StringComparison.InvariantCultureIgnoreCase) ||
((TorznabSettings)i.Settings).ApiPath.Contains("/torznab/all/api", StringComparison.InvariantCultureIgnoreCase) ||
((TorznabSettings)i.Settings).ApiPath.Contains("/api/v2.0/indexers/all/results/torznab", StringComparison.InvariantCultureIgnoreCase)))
.ToArray();
if (jackettAllProviders.Empty()) if (jackettAllProviders.Empty())
{ {
@ -37,8 +41,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
return new HealthCheck(GetType(), return new HealthCheck(GetType(),
HealthCheckResult.Warning, HealthCheckResult.Warning,
string.Format(_localizationService.GetLocalizedString("IndexerJackettAll"), string.Format(_localizationService.GetLocalizedString("IndexerJackettAll"), string.Join(", ", jackettAllProviders.Select(i => i.Name))),
string.Join(", ", jackettAllProviders.Select(i => i.Name))),
"#jackett-all-endpoint-used"); "#jackett-all-endpoint-used");
} }
} }

Loading…
Cancel
Save