From 93e10c8877fd753387972904ce7695afde737b7f Mon Sep 17 00:00:00 2001 From: Garfield69 Date: Mon, 31 Jan 2022 14:07:49 +1300 Subject: [PATCH] Revert "eraiRaws: use cookie method #12902" This reverts commit f1f694b7076016f5b6afb88cc476cfb6dc60d35f. --- src/Jackett.Common/Indexers/EraiRaws.cs | 32 +++++++++---------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/src/Jackett.Common/Indexers/EraiRaws.cs b/src/Jackett.Common/Indexers/EraiRaws.cs index ee58dab05..03124e3d2 100644 --- a/src/Jackett.Common/Indexers/EraiRaws.cs +++ b/src/Jackett.Common/Indexers/EraiRaws.cs @@ -10,13 +10,13 @@ using Jackett.Common.Models.IndexerConfig; using Jackett.Common.Services.Interfaces; using Newtonsoft.Json.Linq; using NLog; +using static Jackett.Common.Models.IndexerConfig.ConfigurationData; namespace Jackett.Common.Indexers { public class EraiRaws : BaseWebIndexer { const string RSS_PATH = "feed/?type=magnet"; - private new ConfigurationDataCookie configData => (ConfigurationDataCookie)base.configData; public override string[] AlternativeSiteLinks { get; protected set; } = { "https://www.erai-raws.info/", @@ -47,7 +47,7 @@ namespace Jackett.Common.Indexers logger: l, p: ps, cacheService: cs, - configData: new ConfigurationDataCookie()) + configData: new ConfigurationData()) { Encoding = Encoding.UTF8; Language = "en-US"; @@ -56,14 +56,14 @@ namespace Jackett.Common.Indexers // Add note that download stats are not available configData.AddDynamic( "download-stats-unavailable", - new ConfigurationDataCookie.DisplayInfoConfigurationItem("", "

Please note that the following stats are not available for this indexer. Default values are used instead.

") + new DisplayInfoConfigurationItem("", "

Please note that the following stats are not available for this indexer. Default values are used instead.

") ); // Config item for title detail parsing - configData.AddDynamic("title-detail-parsing", new ConfigurationDataCookie.BoolConfigurationItem("Enable Title Detail Parsing")); + configData.AddDynamic("title-detail-parsing", new BoolConfigurationItem("Enable Title Detail Parsing")); configData.AddDynamic( "title-detail-parsing-help", - new ConfigurationDataCookie.DisplayInfoConfigurationItem("", "Title Detail Parsing will attempt to determine the season and episode number from the release names and reformat them as a suffix in the format S1E1. If successful, this should provide better matching in applications such as Sonarr.") + new DisplayInfoConfigurationItem("", "Title Detail Parsing will attempt to determine the season and episode number from the release names and reformat them as a suffix in the format S1E1. If successful, this should provide better matching in applications such as Sonarr.") ); // Configure the category mappings @@ -72,7 +72,7 @@ namespace Jackett.Common.Indexers private TitleParser titleParser = new TitleParser(); - private bool IsTitleDetailParsingEnabled => ((ConfigurationDataCookie.BoolConfigurationItem)configData.GetDynamic("title-detail-parsing")).Value; + private bool IsTitleDetailParsingEnabled => ((BoolConfigurationItem)configData.GetDynamic("title-detail-parsing")).Value; public string RssFeedUri { @@ -85,22 +85,12 @@ namespace Jackett.Common.Indexers public override async Task ApplyConfiguration(JToken configJson) { LoadValuesFromJson(configJson); - CookieHeader = configData.Cookie.Value; - try - { - var releases = await PerformQuery(new TorznabQuery()); - if (!releases.Any()) - throw new Exception("Found 0 results in the tracker"); + var releases = await PerformQuery(new TorznabQuery()); - IsConfigured = true; - SaveConfig(); - return IndexerConfigurationStatus.Completed; - } - catch (Exception e) - { - IsConfigured = false; - throw new Exception("Your cookie did not work: " + e.Message); - } + await ConfigureIfOK(string.Empty, releases.Any(), () => + throw new Exception("Could not find releases from this URL")); + + return IndexerConfigurationStatus.Completed; } protected override async Task> PerformQuery(TorznabQuery query)