mirror of
https://github.com/Jackett/Jackett
synced 2025-02-24 15:21:06 +00:00
core: remove unused classes (#8012)
This commit is contained in:
parent
b2390bb954
commit
4741902ade
9 changed files with 2 additions and 173 deletions
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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<string> 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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)" };
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -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 = "" };
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace Jackett.Common.Models.IndexerConfig
|
||||
{
|
||||
public interface ISerializableConfig
|
||||
{
|
||||
JObject Serialize();
|
||||
ISerializableConfig Deserialize(JObject jobj);
|
||||
}
|
||||
}
|
|
@ -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")
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue