diff --git a/src/Jackett.Common/Helpers/CookieContainerExtensions.cs b/src/Jackett.Common/Helpers/CookieContainerExtensions.cs deleted file mode 100644 index 4dd62b4fa..000000000 --- a/src/Jackett.Common/Helpers/CookieContainerExtensions.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; -using System.Net; -using Newtonsoft.Json.Linq; -using NLog; - -namespace Jackett.Common.Helpers -{ - public static class CookieContainerExtensions - { - public static void FillFromJson(this CookieContainer cookies, Uri uri, JToken json, Logger logger) - { - if (json["cookies"] != null) - { - var cookieArray = (JArray)json["cookies"]; - foreach (string cookie in cookieArray) - { - var w = cookie.Split('='); - if (w.Length == 1) - { - cookies.Add(uri, new Cookie { Name = cookie.Trim() }); - } - else - { - cookies.Add(uri, new Cookie(w[0].Trim(), w[1].Trim())); - } - } - } - - if (json["cookie_header"] != null) - { - var cfh = (string)json["cookie_header"]; - var cookieHeaders = ((string)json["cookie_header"]).Split(';'); - foreach (var c in cookieHeaders) - { - try - { - cookies.SetCookies(uri, c); - } - catch (CookieException ex) - { - logger.Info("(Non-critical) Problem loading cookie {0}, {1}, {2}", uri, c, ex.Message); - } - } - } - } - - public static void DumpToJson(this CookieContainer cookies, string uri, JToken json) => DumpToJson(cookies, new Uri(uri), json); - - public static void DumpToJson(this CookieContainer cookies, Uri uri, JToken json) => json["cookie_header"] = cookies.GetCookieHeader(uri); - } -} diff --git a/src/Jackett.Common/Helpers/HttpClientExtensions.cs b/src/Jackett.Common/Helpers/HttpClientExtensions.cs deleted file mode 100644 index 344d91069..000000000 --- a/src/Jackett.Common/Helpers/HttpClientExtensions.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Net.Http; -using System.Threading.Tasks; - -namespace Jackett.Common.Helpers -{ - public static class HttpClientExtensions - { - public static async Task GetStringAsync(this HttpClient client, string uri, int retries) - { - Exception exception = null; - try - { - return await client.GetStringAsync(uri); - } - catch (Exception ex) - { - exception = ex; - } - if (retries > 0) - return await client.GetStringAsync(uri, --retries); - throw exception; - } - } -} diff --git a/src/Jackett.Common/Indexers/BroadcastTheNet.cs b/src/Jackett.Common/Indexers/BroadcastTheNet.cs index ad6b120d9..b1fb78c41 100644 --- a/src/Jackett.Common/Indexers/BroadcastTheNet.cs +++ b/src/Jackett.Common/Indexers/BroadcastTheNet.cs @@ -20,6 +20,7 @@ namespace Jackett.Common.Indexers // Docs at http://apidocs.broadcasthe.net/docs.php private readonly string APIBASE = "https://api.broadcasthe.net"; + // TODO: remove ConfigurationDataAPIKey class and use ConfigurationDataPasskey instead private new ConfigurationDataAPIKey configData { get => (ConfigurationDataAPIKey)base.configData; diff --git a/src/Jackett.Common/Indexers/PassThePopcorn.cs b/src/Jackett.Common/Indexers/PassThePopcorn.cs index 26730b7b8..7cf47ec16 100644 --- a/src/Jackett.Common/Indexers/PassThePopcorn.cs +++ b/src/Jackett.Common/Indexers/PassThePopcorn.cs @@ -20,6 +20,7 @@ namespace Jackett.Common.Indexers private static string SearchUrl => "https://passthepopcorn.me/torrents.php"; private string AuthKey { get; set; } + // TODO: merge ConfigurationDataAPILoginWithUserAndPasskeyAndFilter class with with ConfigurationDataUserPasskey private new ConfigurationDataAPILoginWithUserAndPasskeyAndFilter configData { get => (ConfigurationDataAPILoginWithUserAndPasskeyAndFilter)base.configData; diff --git a/src/Jackett.Common/Models/IndexerConfig/ConfigurationDataBasicLoginWithFilterAndPasskey.cs b/src/Jackett.Common/Models/IndexerConfig/ConfigurationDataBasicLoginWithFilterAndPasskey.cs deleted file mode 100644 index 813c27276..000000000 --- a/src/Jackett.Common/Models/IndexerConfig/ConfigurationDataBasicLoginWithFilterAndPasskey.cs +++ /dev/null @@ -1,25 +0,0 @@ -namespace Jackett.Common.Models.IndexerConfig -{ - public class ConfigurationDataBasicLoginWithFilterAndPasskey : ConfigurationData - { - public StringItem Username { get; private set; } - public StringItem Password { get; private set; } - public StringItem Passkey { get; private set; } - public DisplayItem FilterExample { get; private set; } - public StringItem FilterString { get; private set; } - - public ConfigurationDataBasicLoginWithFilterAndPasskey(string FilterInstructions) - { - Username = new StringItem { Name = "Username" }; - Password = new StringItem { Name = "Password" }; - Passkey = new StringItem { Name = "Passkey" }; - FilterExample = new DisplayItem(FilterInstructions) - { - Name = "" - }; - FilterString = new StringItem { Name = "Filters (optional)" }; - } - - - } -} diff --git a/src/Jackett.Common/Models/IndexerConfig/ConfigurationDataLoginLink.cs b/src/Jackett.Common/Models/IndexerConfig/ConfigurationDataLoginLink.cs deleted file mode 100644 index c5c959422..000000000 --- a/src/Jackett.Common/Models/IndexerConfig/ConfigurationDataLoginLink.cs +++ /dev/null @@ -1,16 +0,0 @@ -namespace Jackett.Common.Models.IndexerConfig -{ - public class ConfigurationDataLoginLink : ConfigurationData - { - public StringItem LoginLink { get; private set; } - public HiddenItem RSSKey { get; private set; } - public DisplayItem DisplayText { get; private set; } - - public ConfigurationDataLoginLink() - { - LoginLink = new StringItem { Name = "Login Link" }; - RSSKey = new HiddenItem { Name = "RSSKey" }; - DisplayText = new DisplayItem("") { Name = "" }; - } - } -} diff --git a/src/Jackett.Common/Models/IndexerConfig/ConfigurationDataLoginTokin.cs b/src/Jackett.Common/Models/IndexerConfig/ConfigurationDataLoginTokin.cs deleted file mode 100644 index 0b00006ef..000000000 --- a/src/Jackett.Common/Models/IndexerConfig/ConfigurationDataLoginTokin.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Globalization; -using Jackett.Common.Utils; - -namespace Jackett.Common.Models.IndexerConfig -{ - public class ConfigurationDataLoginTokin : ConfigurationDataBasicLogin - { - public HiddenItem ApiToken { get; private set; } - public HiddenItem LastTokenFetchDate { get; private set; } - - public DateTime LastTokenFetchDateTime - { - get => DateTimeUtil.UnixTimestampToDateTime(ParseUtil.CoerceDouble(LastTokenFetchDate.Value)); - set => LastTokenFetchDate.Value = DateTimeUtil.DateTimeToUnixTimestamp(value).ToString(CultureInfo.InvariantCulture); - } - - public ConfigurationDataLoginTokin() : base() - { - ApiToken = new HiddenItem { Name = "ApiToken" }; - LastTokenFetchDate = new HiddenItem { Name = "LastTokenFetchDate" }; - LastTokenFetchDateTime = DateTime.MinValue; - } - } -} diff --git a/src/Jackett.Common/Models/IndexerConfig/ISerializableConfig.cs b/src/Jackett.Common/Models/IndexerConfig/ISerializableConfig.cs deleted file mode 100644 index 09d114004..000000000 --- a/src/Jackett.Common/Models/IndexerConfig/ISerializableConfig.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Newtonsoft.Json.Linq; - -namespace Jackett.Common.Models.IndexerConfig -{ - public interface ISerializableConfig - { - JObject Serialize(); - ISerializableConfig Deserialize(JObject jobj); - } -} diff --git a/src/Jackett.Common/Utils/JsonContent.cs b/src/Jackett.Common/Utils/JsonContent.cs deleted file mode 100644 index 8866aea5c..000000000 --- a/src/Jackett.Common/Utils/JsonContent.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Net.Http; -using System.Text; -using Newtonsoft.Json; - -namespace Jackett.Common.Utils -{ - public class JsonContent : StringContent - { - public JsonContent(object value) - : this(value, Encoding.UTF8) => - Headers.ContentType.CharSet = "utf-8"; - - public JsonContent(object value, Encoding encoding) - : base( - JsonConvert.SerializeObject( - value, Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }), - encoding, "application/json") - { - } - } -}