diff --git a/src/Jackett.Common/Indexers/Abstract/GazelleTracker.cs b/src/Jackett.Common/Indexers/Abstract/GazelleTracker.cs index 684c4b851..43a4382dd 100644 --- a/src/Jackett.Common/Indexers/Abstract/GazelleTracker.cs +++ b/src/Jackett.Common/Indexers/Abstract/GazelleTracker.cs @@ -15,6 +15,7 @@ using System.Text; using System.Threading.Tasks; using System.Web; using System.Net; +using static Jackett.Models.IndexerConfig.ConfigurationData; namespace Jackett.Indexers.Abstract { @@ -22,8 +23,10 @@ namespace Jackett.Indexers.Abstract { protected string LoginUrl { get { return SiteLink + "login.php"; } } protected string APIUrl { get { return SiteLink + "ajax.php"; } } - protected string DownloadUrl { get { return SiteLink + "torrents.php?action=download&id="; } } + protected string DownloadUrl { get { return SiteLink + "torrents.php?action=download&usetoken=" + (useTokens ? "1" : "0") + "&id="; } } protected string DetailsUrl { get { return SiteLink + "torrents.php?torrentid="; } } + protected bool supportsFreeleechTokens; + protected bool useTokens = false; new ConfigurationDataBasicLogin configData { @@ -31,7 +34,7 @@ namespace Jackett.Indexers.Abstract set { base.configData = value; } } - public GazelleTracker(IIndexerConfigurationService configService, Utils.Clients.WebClient webClient, Logger logger, IProtectionService protectionService, string name, string desc, string link) + public GazelleTracker(IIndexerConfigurationService configService, Utils.Clients.WebClient webClient, Logger logger, IProtectionService protectionService, string name, string desc, string link, bool supportsFreeleechTokens) : base(name: name, description: desc, link: link, @@ -42,12 +45,27 @@ namespace Jackett.Indexers.Abstract p: protectionService, configData: new ConfigurationDataBasicLogin()) { - Encoding = Encoding.UTF8; + Encoding = Encoding.UTF8; + this.supportsFreeleechTokens = supportsFreeleechTokens; + + if (supportsFreeleechTokens) + { + var useTokenItem = new BoolItem { Value = false }; + useTokenItem.Name = "Use Freeleech Tokens when available"; + configData.AddDynamic("usetoken", useTokenItem); + } } public override async Task ApplyConfiguration(JToken configJson) { LoadValuesFromJson(configJson); + + var useTokenItem = (BoolItem)configData.GetDynamic("usetoken"); + if (useTokenItem != null) + { + useTokens = useTokenItem.Value; + } + var pairs = new Dictionary { { "username", configData.Username.Value }, { "password", configData.Password.Value }, diff --git a/src/Jackett.Common/Indexers/AlphaRatio.cs b/src/Jackett.Common/Indexers/AlphaRatio.cs index 618aea7a4..06c94e4b8 100644 --- a/src/Jackett.Common/Indexers/AlphaRatio.cs +++ b/src/Jackett.Common/Indexers/AlphaRatio.cs @@ -15,7 +15,8 @@ namespace Jackett.Indexers configService: configService, logger: logger, protectionService: protectionService, - webClient: webClient + webClient: webClient, + supportsFreeleechTokens: true ) { Language = "en-us"; diff --git a/src/Jackett.Common/Indexers/Apollo.cs b/src/Jackett.Common/Indexers/Apollo.cs index fe8d1422b..706ee555b 100644 --- a/src/Jackett.Common/Indexers/Apollo.cs +++ b/src/Jackett.Common/Indexers/Apollo.cs @@ -16,7 +16,8 @@ namespace Jackett.Indexers configService: configService, logger: logger, protectionService: protectionService, - webClient: webClient + webClient: webClient, + supportsFreeleechTokens: true ) { Language = "en-us"; diff --git a/src/Jackett.Common/Indexers/BrokenStones.cs b/src/Jackett.Common/Indexers/BrokenStones.cs index 8b8cab9f4..acace0b7a 100644 --- a/src/Jackett.Common/Indexers/BrokenStones.cs +++ b/src/Jackett.Common/Indexers/BrokenStones.cs @@ -15,7 +15,8 @@ namespace Jackett.Indexers configService: configService, logger: logger, protectionService: protectionService, - webClient: webClient + webClient: webClient, + supportsFreeleechTokens: true ) { Language = "en-us"; diff --git a/src/Jackett.Common/Indexers/HDForever.cs b/src/Jackett.Common/Indexers/HDForever.cs index f56810594..84f1d1336 100644 --- a/src/Jackett.Common/Indexers/HDForever.cs +++ b/src/Jackett.Common/Indexers/HDForever.cs @@ -15,7 +15,8 @@ namespace Jackett.Indexers configService: configService, logger: logger, protectionService: protectionService, - webClient: webClient + webClient: webClient, + supportsFreeleechTokens: true ) { Language = "fr-fr"; diff --git a/src/Jackett.Common/Indexers/HDOnly.cs b/src/Jackett.Common/Indexers/HDOnly.cs index b8a7bb563..d0da28262 100644 --- a/src/Jackett.Common/Indexers/HDOnly.cs +++ b/src/Jackett.Common/Indexers/HDOnly.cs @@ -17,7 +17,8 @@ namespace Jackett.Indexers configService: configService, logger: logger, protectionService: protectionService, - webClient: webClient + webClient: webClient, + supportsFreeleechTokens: true // not verified ) { Language = "fr-fr"; diff --git a/src/Jackett.Common/Indexers/Redacted.cs b/src/Jackett.Common/Indexers/Redacted.cs index f0f98f1da..77367b2c1 100644 --- a/src/Jackett.Common/Indexers/Redacted.cs +++ b/src/Jackett.Common/Indexers/Redacted.cs @@ -16,7 +16,8 @@ namespace Jackett.Indexers configService: configService, logger: logger, protectionService: protectionService, - webClient: webClient + webClient: webClient, + supportsFreeleechTokens: true ) { Language = "en-us"; diff --git a/src/Jackett.Common/Indexers/Synthesiz3r.cs b/src/Jackett.Common/Indexers/Synthesiz3r.cs index 9ddeec568..19149b0bf 100644 --- a/src/Jackett.Common/Indexers/Synthesiz3r.cs +++ b/src/Jackett.Common/Indexers/Synthesiz3r.cs @@ -16,7 +16,8 @@ namespace Jackett.Indexers configService: configService, logger: logger, protectionService: protectionService, - webClient: webClient + webClient: webClient, + supportsFreeleechTokens: true ) { Language = "en-us"; diff --git a/src/Jackett.Common/Indexers/cgpeers.cs b/src/Jackett.Common/Indexers/cgpeers.cs index 343d84f56..d8712de7e 100644 --- a/src/Jackett.Common/Indexers/cgpeers.cs +++ b/src/Jackett.Common/Indexers/cgpeers.cs @@ -15,7 +15,8 @@ namespace Jackett.Indexers configService: configService, logger: logger, protectionService: protectionService, - webClient: webClient + webClient: webClient, + supportsFreeleechTokens: true ) { Language = "en-us"; diff --git a/src/Jackett.Common/Indexers/notwhatcd.cs b/src/Jackett.Common/Indexers/notwhatcd.cs index d9f7e753e..a4b654296 100644 --- a/src/Jackett.Common/Indexers/notwhatcd.cs +++ b/src/Jackett.Common/Indexers/notwhatcd.cs @@ -16,7 +16,8 @@ namespace Jackett.Indexers configService: configService, logger: logger, protectionService: protectionService, - webClient: webClient + webClient: webClient, + supportsFreeleechTokens: true ) { Language = "en-us";