Fixed: Persist Cookies from test on Indexer creation to avoid re-auth

cookie-persist
Qstick 4 years ago
parent c6b6daaf80
commit e43c650d45

@ -223,6 +223,11 @@ namespace NzbDrone.Core.Indexers.Cardigann
} }
} }
public override IDictionary<string, string> GrabCookies()
{
return ((CardigannRequestGenerator)GetRequestGenerator()).Cookies;
}
public override object RequestAction(string action, IDictionary<string, string> query) public override object RequestAction(string action, IDictionary<string, string> query)
{ {
if (action == "checkCaptcha") if (action == "checkCaptcha")

@ -1,4 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using NzbDrone.Core.IndexerSearch.Definitions; using NzbDrone.Core.IndexerSearch.Definitions;
@ -28,6 +29,8 @@ namespace NzbDrone.Core.Indexers
Task<byte[]> Download(Uri link); Task<byte[]> Download(Uri link);
IDictionary<string, string> GrabCookies();
IndexerCapabilities GetCapabilities(); IndexerCapabilities GetCapabilities();
} }
} }

@ -125,5 +125,10 @@ namespace NzbDrone.Core.Indexers
{ {
return Definition.Name; return Definition.Name;
} }
public virtual IDictionary<string, string> GrabCookies()
{
return null;
}
} }
} }

@ -267,7 +267,13 @@ namespace NzbDrone.Core.Indexers
MapCardigannDefinition(definition); MapCardigannDefinition(definition);
} }
return base.Create(definition); var newDef = base.Create(definition);
provider.Definition = newDef;
_indexerStatusService.UpdateCookies(newDef.Id, provider.GrabCookies(), DateTime.Now + TimeSpan.FromDays(30));
return newDef;
} }
public override void Update(IndexerDefinition definition) public override void Update(IndexerDefinition definition)

Loading…
Cancel
Save