From d634670ad8a8244d4ab448bc688f1cbfd7a94909 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Thu, 18 May 2023 02:34:55 +0300 Subject: [PATCH] gazelle: don't use usetoken=0 when useTokens is not enabled See Prowlarr/Prowlarr#1668 --- src/Jackett.Common/Indexers/Abstract/GazelleTracker.cs | 6 +++--- src/Jackett.Common/Indexers/GazelleGamesAPI.cs | 2 +- src/Jackett.Common/Indexers/Orpheus.cs | 2 +- src/Jackett.Common/Indexers/Redacted.cs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Jackett.Common/Indexers/Abstract/GazelleTracker.cs b/src/Jackett.Common/Indexers/Abstract/GazelleTracker.cs index 557c2dffb..3c32908b9 100644 --- a/src/Jackett.Common/Indexers/Abstract/GazelleTracker.cs +++ b/src/Jackett.Common/Indexers/Abstract/GazelleTracker.cs @@ -27,13 +27,13 @@ namespace Jackett.Common.Indexers.Abstract protected virtual string LoginUrl => SiteLink + "login.php"; protected virtual string APIUrl => SiteLink + "ajax.php"; - protected virtual string DownloadUrl => SiteLink + "torrents.php?action=download&usetoken=" + (useTokens ? "1" : "0") + (usePassKey ? "&torrent_pass=" + configData.PassKey.Value : "") + (useAuthKey ? "&authkey=" + configData.AuthKey.Value : "") + "&id="; + protected virtual string DownloadUrl => SiteLink + "torrents.php?action=download" + (useTokens ? "&usetoken=1" : "") + (usePassKey ? "&torrent_pass=" + configData.PassKey.Value : "") + (useAuthKey ? "&authkey=" + configData.AuthKey.Value : "") + "&id="; protected virtual string DetailsUrl => SiteLink + "torrents.php?torrentid="; protected virtual string PosterUrl => SiteLink; protected virtual string AuthorizationName => "Authorization"; protected virtual string AuthorizationFormat => "{0}"; protected virtual int ApiKeyLength => 41; - protected virtual string FlipOptionalTokenString(string requestLink) => requestLink.Replace("usetoken=1", "usetoken=0"); + protected virtual string FlipOptionalTokenString(string requestLink) => requestLink.Replace("&usetoken=1", ""); protected bool useTokens; protected string cookie = ""; @@ -418,7 +418,7 @@ namespace Jackett.Common.Indexers.Abstract || html.Contains("This torrent is too large.") || html.Contains("You cannot use tokens here")) { - // download again with usetoken=0 + // download again without usetoken=1 var requestLinkNew = FlipOptionalTokenString(requestLink); content = await base.Download(new Uri(requestLinkNew), RequestType.GET, headers: headers); } diff --git a/src/Jackett.Common/Indexers/GazelleGamesAPI.cs b/src/Jackett.Common/Indexers/GazelleGamesAPI.cs index d428b4a00..6da4c2997 100644 --- a/src/Jackett.Common/Indexers/GazelleGamesAPI.cs +++ b/src/Jackett.Common/Indexers/GazelleGamesAPI.cs @@ -33,7 +33,7 @@ namespace Jackett.Common.Indexers protected override string APIUrl => SiteLink + "api.php"; protected override string AuthorizationName => "X-API-Key"; protected override int ApiKeyLength => 64; - protected override string FlipOptionalTokenString(string requestLink) => requestLink.Replace("usetoken=1", ""); + protected override string FlipOptionalTokenString(string requestLink) => requestLink.Replace("&usetoken=1", ""); public GazelleGamesApi(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, ICacheService cs) : base(configService: configService, diff --git a/src/Jackett.Common/Indexers/Orpheus.cs b/src/Jackett.Common/Indexers/Orpheus.cs index 789b3075c..bd36e207e 100644 --- a/src/Jackett.Common/Indexers/Orpheus.cs +++ b/src/Jackett.Common/Indexers/Orpheus.cs @@ -24,7 +24,7 @@ namespace Jackett.Common.Indexers protected override string DownloadUrl => SiteLink + "ajax.php?action=download" + (useTokens ? "&usetoken=1" : "") + "&id="; protected override string AuthorizationFormat => "token {0}"; protected override int ApiKeyLength => 118; - protected override string FlipOptionalTokenString(string requestLink) => requestLink.Replace("usetoken=1", ""); + protected override string FlipOptionalTokenString(string requestLink) => requestLink.Replace("&usetoken=1", ""); public Orpheus(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, ICacheService cs) : base(configService: configService, diff --git a/src/Jackett.Common/Indexers/Redacted.cs b/src/Jackett.Common/Indexers/Redacted.cs index 310634cf1..5facbb254 100644 --- a/src/Jackett.Common/Indexers/Redacted.cs +++ b/src/Jackett.Common/Indexers/Redacted.cs @@ -22,7 +22,7 @@ namespace Jackett.Common.Indexers public override TorznabCapabilities TorznabCaps => SetCapabilities(); - protected override string DownloadUrl => SiteLink + "ajax.php?action=download&usetoken=" + (useTokens ? "1" : "0") + "&id="; + protected override string DownloadUrl => SiteLink + "ajax.php?action=download" + (useTokens ? "&usetoken=1" : "") + "&id="; public Redacted(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, ICacheService cs) : base(configService: configService,