New: (Cardigann) Bump minimum version to v10

pull/2140/head
Bogdan 4 months ago
parent 11864247eb
commit f95f67a7ca

@ -29,7 +29,7 @@ namespace NzbDrone.Core.IndexerVersions
/* Update Service will fall back if version # does not exist for an indexer per Ta */
private const string DEFINITION_BRANCH = "master";
private const int DEFINITION_VERSION = 9;
private const int DEFINITION_VERSION = 10;
// Used when moving yml to C#
private readonly List<string> _definitionBlocklist = new ()

@ -337,9 +337,11 @@ namespace NzbDrone.Core.Indexers.Definitions.Cardigann
variables[name] = selected.Key;
break;
case "info":
variables[name] = value;
break;
case "info_cookie":
case "info_flaresolverr":
case "info_useragent":
case "cardigannCaptcha":
// no-op
break;
default:
throw new NotSupportedException($"Type {setting.Type} is not supported.");

@ -60,7 +60,7 @@ namespace Prowlarr.Api.V1.Indexers
if (definition.Implementation == nameof(Cardigann))
{
var extraFields = definition.ExtraFields?.Select(MapField).ToList() ?? new List<Field>();
var extraFields = definition.ExtraFields?.Select(MapCardigannField).ToList() ?? new List<Field>();
resource.Fields.AddRange(extraFields);
@ -160,7 +160,7 @@ namespace Prowlarr.Api.V1.Indexers
};
}
private Field MapField(SettingsField setting, int order)
private Field MapCardigannField(SettingsField setting, int order)
{
var field = new Field
{
@ -185,6 +185,26 @@ namespace Prowlarr.Api.V1.Indexers
{
field.Value = bool.TryParse(setting.Default, out var value) && value;
}
else if (setting.Type is "info_cookie" or "info_flaresolverr" or "info_useragent")
{
field.Type = "info";
switch (setting.Type)
{
case "info_cookie":
field.Label = "How to get the Cookie";
field.Value = "<ol><li>Login to this tracker with your browser</li><li>Open the <b>DevTools</b> panel by pressing <b>F12</b></li><li>Select the <b>Network</b> tab</li><li>Click on the <b>Doc</b> button (Chrome Browser) or <b>HTML</b> button (FireFox)</li><li>Refresh the page by pressing <b>F5</b></li><li>Click on the first row entry</li><li>Select the <b>Headers</b> tab on the Right panel</li><li>Find <b>'cookie:'</b> in the <b>Request Headers</b> section</li><li><b>Select</b> and <b>Copy</b> the whole cookie string <i>(everything after 'cookie: ')</i> and <b>Paste</b> here.</li></ol>";
break;
case "info_flaresolverr":
field.Label = "FlareSolverr Info";
field.Value = "This site may use Cloudflare DDoS Protection, therefore Prowlarr requires <a href=\"https://wiki.servarr.com/prowlarr/faq#can-i-use-flaresolverr-indexers\" target=\"_blank\" rel=\"noreferrer\">FlareSolverr</a> to access it.";
break;
case "info_useragent":
field.Label = "How to get the User-Agent";
field.Value = "<ol><li>From the same place you fetched the cookie,</li><li>Find <b>'user-agent:'</b> in the <b>Request Headers</b> section</li><li><b>Select</b> and <b>Copy</b> the whole user-agent string <i>(everything after 'user-agent: ')</i> and <b>Paste</b> here.</li></ol>";
break;
}
}
else
{
field.Value = setting.Default;

Loading…
Cancel
Save