Fixed: Authentication issues with Cardigann definitions having captcha

This mostly reverts 68b895d2ad where the cache key was changed to something more specific to avoid another issue with shared settings, but sadly this resulted in a new instance of CardigannRequestGenerator with null `landingResultDocument` failing the login.

Fixes #2139
pull/2130/head
Bogdan 7 months ago
parent f95f67a7ca
commit 76c288a6e4

@ -4,10 +4,8 @@ using System.Linq;
using System.Threading.Tasks;
using FluentValidation.Results;
using NLog;
using NzbDrone.Common;
using NzbDrone.Common.Cache;
using NzbDrone.Common.Http;
using NzbDrone.Common.Serializer;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.IndexerSearch.Definitions;
using NzbDrone.Core.IndexerVersions;
@ -24,7 +22,7 @@ namespace NzbDrone.Core.Indexers.Definitions.Cardigann
private readonly ICached<CardigannRequestGenerator> _generatorCache;
public override string Name => "Cardigann";
public override string[] IndexerUrls => new string[] { "" };
public override string[] IndexerUrls => new[] { "" };
public override string Description => "";
public override IndexerPrivacy Privacy => IndexerPrivacy.Private;
@ -49,8 +47,7 @@ namespace NzbDrone.Core.Indexers.Definitions.Cardigann
public override IIndexerRequestGenerator GetRequestGenerator()
{
var cacheKey = $"{Settings.DefinitionFile}.{HashUtil.ComputeSha256Hash(Settings.ToJson())}";
var generator = _generatorCache.Get(cacheKey, () =>
var generator = _generatorCache.Get(Settings.DefinitionFile, () =>
new CardigannRequestGenerator(_configService,
_definitionService.GetCachedDefinition(Settings.DefinitionFile),
_logger,
@ -61,10 +58,11 @@ namespace NzbDrone.Core.Indexers.Definitions.Cardigann
Settings = Settings
});
generator = (CardigannRequestGenerator)SetCookieFunctions(generator);
generator.Definition = Definition;
generator.Settings = Settings;
generator = (CardigannRequestGenerator)SetCookieFunctions(generator);
_generatorCache.ClearExpired();
return generator;

@ -1178,14 +1178,14 @@ namespace NzbDrone.Core.Indexers.Definitions.Cardigann
if (method == HttpMethod.Get && searchUrls.Contains(searchUrl))
{
_logger.Trace("Skip duplicated request {0}", searchUrl);
_logger.Trace("Skip duplicated request for {0}: {1}", Definition.Name, searchUrl);
continue;
}
searchUrls.Add(searchUrl);
_logger.Debug($"Adding request: {searchUrl}");
_logger.Debug("Adding request for {0}: {1}", Definition.Name, searchUrl);
var requestBuilder = new HttpRequestBuilder(searchUrl)
{

Loading…
Cancel
Save