mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2026-04-21 22:25:03 -04:00
Fixed: (AlphaRatio) Use FL tokens only if canUseToken is true
Fixes #1811
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Http;
|
||||
using NzbDrone.Core.Annotations;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Indexers.Definitions.Gazelle;
|
||||
@@ -29,6 +30,11 @@ public class AlphaRatio : GazelleBase<AlphaRatioSettings>
|
||||
return new AlphaRatioRequestGenerator(Settings, Capabilities, _httpClient, _logger);
|
||||
}
|
||||
|
||||
public override IParseIndexerResponse GetParser()
|
||||
{
|
||||
return new AlphaRatioParser(Settings, Capabilities);
|
||||
}
|
||||
|
||||
protected override IndexerCapabilities SetCapabilities()
|
||||
{
|
||||
var caps = new IndexerCapabilities
|
||||
@@ -110,6 +116,29 @@ public class AlphaRatioRequestGenerator : GazelleRequestGenerator
|
||||
}
|
||||
}
|
||||
|
||||
public class AlphaRatioParser : GazelleParser
|
||||
{
|
||||
public AlphaRatioParser(AlphaRatioSettings settings, IndexerCapabilities capabilities)
|
||||
: base(settings, capabilities)
|
||||
{
|
||||
}
|
||||
|
||||
protected override string GetDownloadUrl(int torrentId, bool canUseToken)
|
||||
{
|
||||
var url = new HttpUri(Settings.BaseUrl)
|
||||
.CombinePath("/torrents.php")
|
||||
.AddQueryParam("action", "download")
|
||||
.AddQueryParam("id", torrentId);
|
||||
|
||||
if (Settings.UseFreeleechToken && canUseToken)
|
||||
{
|
||||
url = url.AddQueryParam("usetoken", "1");
|
||||
}
|
||||
|
||||
return url.FullUri;
|
||||
}
|
||||
}
|
||||
|
||||
public class AlphaRatioSettings : GazelleSettings
|
||||
{
|
||||
[FieldDefinition(6, Label = "Freeleech Only", Type = FieldType.Checkbox, HelpText = "Search freeleech torrents only")]
|
||||
|
||||
Reference in New Issue
Block a user