mirror of https://github.com/Jackett/Jackett
Make site link configurable for all indexers
This commit is contained in:
parent
8a9648d347
commit
f99e104755
|
@ -301,7 +301,7 @@ function displayIndexerSetup(id, link) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
populateSetupForm(id, data.name, data.config, data.caps, link);
|
populateSetupForm(id, data.name, data.config, data.caps, link, data.alternativesitelinks);
|
||||||
|
|
||||||
}).fail(function () {
|
}).fail(function () {
|
||||||
doNotify("Request to Jackett server failed", "danger", "glyphicon glyphicon-alert");
|
doNotify("Request to Jackett server failed", "danger", "glyphicon glyphicon-alert");
|
||||||
|
@ -378,11 +378,18 @@ function populateConfigItems(configForm, config) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function newConfigModal(title, config, caps, link) {
|
function newConfigModal(title, config, caps, link, alternativesitelinks) {
|
||||||
var configTemplate = Handlebars.compile($("#jackett-config-setup-modal").html());
|
var configTemplate = Handlebars.compile($("#jackett-config-setup-modal").html());
|
||||||
var configForm = $(configTemplate({ title: title, caps: caps, link:link }));
|
var configForm = $(configTemplate({ title: title, caps: caps, link:link }));
|
||||||
$("#modals").append(configForm);
|
$("#modals").append(configForm);
|
||||||
populateConfigItems(configForm, config);
|
populateConfigItems(configForm, config);
|
||||||
|
|
||||||
|
if (alternativesitelinks.length >= 1) {
|
||||||
|
var AlternativeSiteLinksTemplate = Handlebars.compile($("#setup-item-alternativesitelinks").html());
|
||||||
|
var template = $(AlternativeSiteLinksTemplate({ "alternativesitelinks": alternativesitelinks }));
|
||||||
|
configForm.find("div[data-id='sitelink']").after(template);
|
||||||
|
}
|
||||||
|
|
||||||
return configForm;
|
return configForm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -427,8 +434,8 @@ function getConfigModalJson(configForm) {
|
||||||
return configJson;
|
return configJson;
|
||||||
}
|
}
|
||||||
|
|
||||||
function populateSetupForm(indexerId, name, config, caps, link) {
|
function populateSetupForm(indexerId, name, config, caps, link, alternativesitelinks) {
|
||||||
var configForm = newConfigModal(name, config, caps, link);
|
var configForm = newConfigModal(name, config, caps, link, alternativesitelinks);
|
||||||
var $goButton = configForm.find(".setup-indexer-go");
|
var $goButton = configForm.find(".setup-indexer-go");
|
||||||
$goButton.click(function () {
|
$goButton.click(function () {
|
||||||
var data = { indexer: indexerId, name: name };
|
var data = { indexer: indexerId, name: name };
|
||||||
|
|
|
@ -175,6 +175,16 @@
|
||||||
<input class="form-control" type="text" value="{{{value}}}" />
|
<input class="form-control" type="text" value="{{{value}}}" />
|
||||||
</div>
|
</div>
|
||||||
</script>
|
</script>
|
||||||
|
<script id="setup-item-alternativesitelinks" type="text/x-handlebars-template">
|
||||||
|
<div class="setup-item-alternativesitelinks alert alert-info" role="alert">
|
||||||
|
This indexer has multiple known URLs which you can change above:
|
||||||
|
<ul>
|
||||||
|
{{#each alternativesitelinks}}
|
||||||
|
<li>{{this}}</li>
|
||||||
|
{{/each}}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<script id="configured-indexer-table" type="text/x-handlebars-template">
|
<script id="configured-indexer-table" type="text/x-handlebars-template">
|
||||||
|
|
|
@ -161,6 +161,7 @@ namespace Jackett.Controllers
|
||||||
jsonReply["config"] = config.ToJson(null);
|
jsonReply["config"] = config.ToJson(null);
|
||||||
jsonReply["caps"] = indexer.TorznabCaps.CapsToJson();
|
jsonReply["caps"] = indexer.TorznabCaps.CapsToJson();
|
||||||
jsonReply["name"] = indexer.DisplayName;
|
jsonReply["name"] = indexer.DisplayName;
|
||||||
|
jsonReply["alternativesitelinks"] = JToken.FromObject(indexer.AlternativeSiteLinks);
|
||||||
jsonReply["result"] = "success";
|
jsonReply["result"] = "success";
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|
|
@ -103,7 +103,7 @@ namespace Jackett.Indexers
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
// Retrieve config values set by Jackett's user
|
// Retrieve config values set by Jackett's user
|
||||||
ConfigData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
|
|
||||||
// Check & Validate Config
|
// Check & Validate Config
|
||||||
validateConfig();
|
validateConfig();
|
||||||
|
|
|
@ -53,7 +53,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
var loginPage = await RequestStringWithCookies(LoginUrl, string.Empty);
|
var loginPage = await RequestStringWithCookies(LoginUrl, string.Empty);
|
||||||
var token = new Regex("<meta name=\"_token\" content=\"(.*?)\">").Match(loginPage.Content).Groups[1].ToString();
|
var token = new Regex("<meta name=\"_token\" content=\"(.*?)\">").Match(loginPage.Content).Groups[1].ToString();
|
||||||
var pairs = new Dictionary<string, string> {
|
var pairs = new Dictionary<string, string> {
|
||||||
|
|
|
@ -46,7 +46,7 @@ namespace Jackett.Indexers.Abstract
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
var pairs = new Dictionary<string, string> {
|
var pairs = new Dictionary<string, string> {
|
||||||
{ "username", configData.Username.Value },
|
{ "username", configData.Username.Value },
|
||||||
{ "password", configData.Password.Value },
|
{ "password", configData.Password.Value },
|
||||||
|
|
|
@ -67,7 +67,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
var pairs = new Dictionary<string, string> {
|
var pairs = new Dictionary<string, string> {
|
||||||
{ "username", configData.Username.Value },
|
{ "username", configData.Username.Value },
|
||||||
{ "password", configData.Password.Value },
|
{ "password", configData.Password.Value },
|
||||||
|
|
|
@ -75,7 +75,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
|
|
||||||
var pairs = new Dictionary<string, string>
|
var pairs = new Dictionary<string, string>
|
||||||
{
|
{
|
||||||
|
|
|
@ -74,7 +74,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
|
|
||||||
lock (cache)
|
lock (cache)
|
||||||
{
|
{
|
||||||
|
|
|
@ -69,7 +69,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
var pairs = new Dictionary<string, string> {
|
var pairs = new Dictionary<string, string> {
|
||||||
{ "username", configData.Username.Value },
|
{ "username", configData.Username.Value },
|
||||||
{ "password", configData.Password.Value },
|
{ "password", configData.Password.Value },
|
||||||
|
|
|
@ -62,8 +62,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
if (configJson != null)
|
LoadValuesFromJson(configJson);
|
||||||
configData.LoadValuesFromJson(configJson);
|
|
||||||
var pairs = new Dictionary<string, string> {
|
var pairs = new Dictionary<string, string> {
|
||||||
{ "username", configData.Username.Value },
|
{ "username", configData.Username.Value },
|
||||||
{ "password", configData.Password.Value },
|
{ "password", configData.Password.Value },
|
||||||
|
|
|
@ -69,7 +69,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
|
|
||||||
var pairs = new Dictionary<string, string>
|
var pairs = new Dictionary<string, string>
|
||||||
{
|
{
|
||||||
|
|
|
@ -47,7 +47,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
|
|
||||||
var loginForm = await webclient.GetString(new Utils.Clients.WebRequest()
|
var loginForm = await webclient.GetString(new Utils.Clients.WebRequest()
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,12 +12,15 @@ using Jackett.Utils.Clients;
|
||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Jackett.Models.IndexerConfig;
|
using Jackett.Models.IndexerConfig;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
namespace Jackett.Indexers
|
namespace Jackett.Indexers
|
||||||
{
|
{
|
||||||
public abstract class BaseIndexer
|
public abstract class BaseIndexer
|
||||||
{
|
{
|
||||||
public string SiteLink { get; protected set; }
|
public string SiteLink { get; protected set; }
|
||||||
|
public string DefaultSiteLink { get; protected set; }
|
||||||
|
public string[] AlternativeSiteLinks { get; protected set; } = new string[] { };
|
||||||
public string DisplayDescription { get; protected set; }
|
public string DisplayDescription { get; protected set; }
|
||||||
public string DisplayName { get; protected set; }
|
public string DisplayName { get; protected set; }
|
||||||
public string Language { get; protected set; }
|
public string Language { get; protected set; }
|
||||||
|
@ -66,8 +69,10 @@ namespace Jackett.Indexers
|
||||||
DisplayName = name;
|
DisplayName = name;
|
||||||
DisplayDescription = description;
|
DisplayDescription = description;
|
||||||
SiteLink = link;
|
SiteLink = link;
|
||||||
|
DefaultSiteLink = link;
|
||||||
this.downloadUrlBase = downloadBase;
|
this.downloadUrlBase = downloadBase;
|
||||||
this.configData = configData;
|
this.configData = configData;
|
||||||
|
LoadValuesFromJson(null);
|
||||||
|
|
||||||
if (caps == null)
|
if (caps == null)
|
||||||
caps = TorznabUtil.CreateDefaultTorznabTVCaps();
|
caps = TorznabUtil.CreateDefaultTorznabTVCaps();
|
||||||
|
@ -290,11 +295,33 @@ namespace Jackett.Indexers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void LoadValuesFromJson(JToken jsonConfig, bool useProtectionService = false)
|
||||||
|
{
|
||||||
|
IProtectionService ps = null;
|
||||||
|
if (useProtectionService)
|
||||||
|
ps = protectionService;
|
||||||
|
configData.LoadValuesFromJson(jsonConfig, ps);
|
||||||
|
if (string.IsNullOrWhiteSpace(configData.SiteLink.Value))
|
||||||
|
{
|
||||||
|
configData.SiteLink.Value = DefaultSiteLink;
|
||||||
|
}
|
||||||
|
if (!configData.SiteLink.Value.EndsWith("/"))
|
||||||
|
configData.SiteLink.Value += "/";
|
||||||
|
|
||||||
|
var match = Regex.Match(configData.SiteLink.Value, "^https?:\\/\\/[\\w\\-\\/\\.]+$");
|
||||||
|
if (!match.Success)
|
||||||
|
{
|
||||||
|
throw new Exception(string.Format("\"{0}\" is not a valid URL.", configData.SiteLink.Value));
|
||||||
|
}
|
||||||
|
|
||||||
|
SiteLink = configData.SiteLink.Value;
|
||||||
|
}
|
||||||
|
|
||||||
public virtual void LoadFromSavedConfiguration(JToken jsonConfig)
|
public virtual void LoadFromSavedConfiguration(JToken jsonConfig)
|
||||||
{
|
{
|
||||||
if (jsonConfig is JArray)
|
if (jsonConfig is JArray)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(jsonConfig, protectionService);
|
LoadValuesFromJson(jsonConfig, true);
|
||||||
IsConfigured = true;
|
IsConfigured = true;
|
||||||
}
|
}
|
||||||
// read and upgrade old settings file format
|
// read and upgrade old settings file format
|
||||||
|
|
|
@ -93,7 +93,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
|
|
||||||
var pairs1 = new Dictionary<string, string>
|
var pairs1 = new Dictionary<string, string>
|
||||||
{
|
{
|
||||||
|
|
|
@ -86,7 +86,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
|
|
||||||
var result = await RequestStringWithCookies(configData.LoginLink.Value);
|
var result = await RequestStringWithCookies(configData.LoginLink.Value);
|
||||||
await ConfigureIfOK(result.Cookies, result.Content != null && result.Content.Contains("Welcome Back"), () =>
|
await ConfigureIfOK(result.Cookies, result.Content != null && result.Content.Contains("Welcome Back"), () =>
|
||||||
|
|
|
@ -84,7 +84,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
|
|
||||||
var pairs = new Dictionary<string, string>
|
var pairs = new Dictionary<string, string>
|
||||||
{
|
{
|
||||||
|
|
|
@ -59,7 +59,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
|
|
||||||
var pairs = new Dictionary<string, string> {
|
var pairs = new Dictionary<string, string> {
|
||||||
{ "username", configData.Username.Value },
|
{ "username", configData.Username.Value },
|
||||||
|
|
|
@ -63,7 +63,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
|
|
||||||
var pairs = new Dictionary<string, string> {
|
var pairs = new Dictionary<string, string> {
|
||||||
{ "username", configData.Username.Value },
|
{ "username", configData.Username.Value },
|
||||||
|
|
|
@ -22,15 +22,14 @@ namespace Jackett.Indexers
|
||||||
{
|
{
|
||||||
public class BitSoup : BaseIndexer, IIndexer
|
public class BitSoup : BaseIndexer, IIndexer
|
||||||
{
|
{
|
||||||
private string UseLink { get { return (this.configData.AlternateLink.Value != null && this.configData.AlternateLink.Value != "" ? this.configData.AlternateLink.Value : SiteLink); } }
|
private string BrowseUrl { get { return SiteLink + "browse.php"; } }
|
||||||
private string BrowseUrl { get { return UseLink + "browse.php"; } }
|
private string LoginUrl { get { return SiteLink + "takelogin.php"; } }
|
||||||
private string LoginUrl { get { return UseLink + "takelogin.php"; } }
|
private string LoginReferer { get { return SiteLink + "login.php"; } }
|
||||||
private string LoginReferer { get { return UseLink + "login.php"; } }
|
public new string[] AlternativeSiteLinks { get; protected set; } = new string[] { "https://www.bitsoup.me/", "https://www.bitsoup.org/" };
|
||||||
private List<String> KnownURLs = new List<String> { "https://www.bitsoup.me/", "https://www.bitsoup.org/" };
|
|
||||||
|
|
||||||
new ConfigurationDataBasicLoginWithAlternateLink configData
|
new ConfigurationDataBasicLogin configData
|
||||||
{
|
{
|
||||||
get { return (ConfigurationDataBasicLoginWithAlternateLink)base.configData; }
|
get { return (ConfigurationDataBasicLogin)base.configData; }
|
||||||
set { base.configData = value; }
|
set { base.configData = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,15 +42,11 @@ namespace Jackett.Indexers
|
||||||
client: wc,
|
client: wc,
|
||||||
logger: l,
|
logger: l,
|
||||||
p: ps,
|
p: ps,
|
||||||
configData: new ConfigurationDataBasicLoginWithAlternateLink())
|
configData: new ConfigurationDataBasicLogin())
|
||||||
{
|
{
|
||||||
Encoding = Encoding.UTF8;
|
Encoding = Encoding.UTF8;
|
||||||
Language = "en-us";
|
Language = "en-us";
|
||||||
|
|
||||||
this.configData.Instructions.Value = this.DisplayName + " has multiple URLs. The default (" + this.SiteLink + ") can be changed by entering a new value in the box below.";
|
|
||||||
this.configData.Instructions.Value += "The following are some known URLs for " + this.DisplayName;
|
|
||||||
this.configData.Instructions.Value += "<ul><li>" + String.Join("</li><li>", this.KnownURLs.ToArray()) + "</li></ul>";
|
|
||||||
|
|
||||||
//AddCategoryMapping("624", TorznabCatType.Console);
|
//AddCategoryMapping("624", TorznabCatType.Console);
|
||||||
//AddCategoryMapping("307", TorznabCatType.ConsoleNDS);
|
//AddCategoryMapping("307", TorznabCatType.ConsoleNDS);
|
||||||
//AddCategoryMapping("308", TorznabCatType.ConsolePSP);
|
//AddCategoryMapping("308", TorznabCatType.ConsolePSP);
|
||||||
|
@ -148,28 +143,14 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
if (configData.AlternateLink.Value != null && configData.AlternateLink.Value != "")
|
|
||||||
{
|
|
||||||
if (!configData.AlternateLink.Value.EndsWith("/"))
|
|
||||||
{
|
|
||||||
configData.AlternateLink.Value = null;
|
|
||||||
throw new Exception("AlternateLink must end with a slash.");
|
|
||||||
}
|
|
||||||
var match = Regex.Match(configData.AlternateLink.Value, "^https?:\\/\\/(?:[\\w]+\\.)+(?:[a-zA-Z]+)\\/$");
|
|
||||||
if (!match.Success)
|
|
||||||
{
|
|
||||||
configData.AlternateLink.Value = null;
|
|
||||||
throw new Exception("AlternateLink must be a valid url.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var pairs = new Dictionary<string, string> {
|
var pairs = new Dictionary<string, string> {
|
||||||
{ "username", configData.Username.Value },
|
{ "username", configData.Username.Value },
|
||||||
{ "password", configData.Password.Value },
|
{ "password", configData.Password.Value },
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var loginPage = await RequestStringWithCookies(UseLink, string.Empty);
|
var loginPage = await RequestStringWithCookies(SiteLink, string.Empty);
|
||||||
|
|
||||||
var result = await RequestLoginAndFollowRedirect(LoginUrl, pairs, loginPage.Cookies, true, null, LoginReferer, true);
|
var result = await RequestLoginAndFollowRedirect(LoginUrl, pairs, loginPage.Cookies, true, null, LoginReferer, true);
|
||||||
await ConfigureIfOK(result.Cookies, result.Content != null && result.Content.Contains("logout.php"), () =>
|
await ConfigureIfOK(result.Cookies, result.Content != null && result.Content.Contains("logout.php"), () =>
|
||||||
|
@ -221,9 +202,9 @@ namespace Jackett.Indexers
|
||||||
var release = new ReleaseInfo();
|
var release = new ReleaseInfo();
|
||||||
|
|
||||||
release.Title = row.Cq().Find("td:eq(1) a").First().Text().Trim();
|
release.Title = row.Cq().Find("td:eq(1) a").First().Text().Trim();
|
||||||
release.Comments = new Uri(UseLink + row.Cq().Find("td:eq(1) a").First().Attr("href"));
|
release.Comments = new Uri(SiteLink + row.Cq().Find("td:eq(1) a").First().Attr("href"));
|
||||||
|
|
||||||
release.Link = new Uri(UseLink + row.Cq().Find("td:eq(2) a").First().Attr("href"));
|
release.Link = new Uri(SiteLink + row.Cq().Find("td:eq(2) a").First().Attr("href"));
|
||||||
release.Guid = release.Link;
|
release.Guid = release.Link;
|
||||||
release.Description = release.Title;
|
release.Description = release.Title;
|
||||||
var cat = row.Cq().Find("td:eq(0) a").First().Attr("href").Substring(15);
|
var cat = row.Cq().Find("td:eq(0) a").First().Attr("href").Substring(15);
|
||||||
|
|
|
@ -47,7 +47,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
|
|
||||||
IsConfigured = false;
|
IsConfigured = false;
|
||||||
try
|
try
|
||||||
|
|
|
@ -185,10 +185,10 @@ namespace Jackett.Indexers
|
||||||
// init missing mandatory attributes
|
// init missing mandatory attributes
|
||||||
DisplayName = Definition.Name;
|
DisplayName = Definition.Name;
|
||||||
DisplayDescription = Definition.Description;
|
DisplayDescription = Definition.Description;
|
||||||
SiteLink = Definition.Links[0]; // TODO: implement alternative links
|
DefaultSiteLink = Definition.Links[0]; // TODO: implement alternative links
|
||||||
Encoding = Encoding.GetEncoding(Definition.Encoding);
|
Encoding = Encoding.GetEncoding(Definition.Encoding);
|
||||||
if (!SiteLink.EndsWith("/"))
|
if (!DefaultSiteLink.EndsWith("/"))
|
||||||
SiteLink += "/";
|
DefaultSiteLink += "/";
|
||||||
Language = Definition.Language;
|
Language = Definition.Language;
|
||||||
TorznabCaps = new TorznabCapabilities();
|
TorznabCaps = new TorznabCapabilities();
|
||||||
|
|
||||||
|
@ -208,8 +208,8 @@ namespace Jackett.Indexers
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
AddCategoryMapping(Category.Key, TorznabCatType.GetCatByName(Category.Value));
|
AddCategoryMapping(Category.Key, TorznabCatType.GetCatByName(Category.Value));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
LoadValuesFromJson(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Dictionary<string, object> getTemplateVariablesFromConfigData()
|
protected Dictionary<string, object> getTemplateVariablesFromConfigData()
|
||||||
|
|
|
@ -126,7 +126,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
var pairs = new Dictionary<string, string> {
|
var pairs = new Dictionary<string, string> {
|
||||||
{ "username", configData.Username.Value },
|
{ "username", configData.Username.Value },
|
||||||
{ "password", configData.Password.Value },
|
{ "password", configData.Password.Value },
|
||||||
|
|
|
@ -57,7 +57,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
var pairs = new Dictionary<string, string> {
|
var pairs = new Dictionary<string, string> {
|
||||||
{ "nickname", configData.Username.Value },
|
{ "nickname", configData.Username.Value },
|
||||||
{ "password", configData.Password.Value },
|
{ "password", configData.Password.Value },
|
||||||
|
|
|
@ -101,7 +101,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
var pairs = new Dictionary<string, string> {
|
var pairs = new Dictionary<string, string> {
|
||||||
{ "returnto" , "/" },
|
{ "returnto" , "/" },
|
||||||
{ "username", configData.Username.Value },
|
{ "username", configData.Username.Value },
|
||||||
|
|
|
@ -72,7 +72,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
var pairs = new Dictionary<string, string> {
|
var pairs = new Dictionary<string, string> {
|
||||||
{ "username", configData.Username.Value },
|
{ "username", configData.Username.Value },
|
||||||
{ "password", configData.Password.Value }
|
{ "password", configData.Password.Value }
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
var pairs = new Dictionary<string, string> {
|
var pairs = new Dictionary<string, string> {
|
||||||
{ "username", configData.Username.Value },
|
{ "username", configData.Username.Value },
|
||||||
{ "password", configData.Password.Value }
|
{ "password", configData.Password.Value }
|
||||||
|
|
|
@ -53,8 +53,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
if (configJson != null)
|
LoadValuesFromJson(configJson);
|
||||||
configData.LoadValuesFromJson(configJson);
|
|
||||||
|
|
||||||
var pairs = new Dictionary<string, string> {
|
var pairs = new Dictionary<string, string> {
|
||||||
{ "username", configData.Username.Value },
|
{ "username", configData.Username.Value },
|
||||||
|
|
|
@ -91,7 +91,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
var loginPage = await RequestStringWithCookies(LoginUrl, string.Empty);
|
var loginPage = await RequestStringWithCookies(LoginUrl, string.Empty);
|
||||||
|
|
||||||
var pairs = new Dictionary<string, string> {
|
var pairs = new Dictionary<string, string> {
|
||||||
|
|
|
@ -77,6 +77,7 @@ namespace Jackett.Indexers
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
var stdResult = new ConfigurationDataBasicLogin();
|
var stdResult = new ConfigurationDataBasicLogin();
|
||||||
|
stdResult.SiteLink.Value = configData.SiteLink.Value;
|
||||||
stdResult.Username.Value = configData.Username.Value;
|
stdResult.Username.Value = configData.Username.Value;
|
||||||
stdResult.Password.Value = configData.Password.Value;
|
stdResult.Password.Value = configData.Password.Value;
|
||||||
stdResult.CookieHeader.Value = loginPage.Cookies;
|
stdResult.CookieHeader.Value = loginPage.Cookies;
|
||||||
|
@ -86,7 +87,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
var pairs = new Dictionary<string, string> {
|
var pairs = new Dictionary<string, string> {
|
||||||
{ "username", configData.Username.Value },
|
{ "username", configData.Username.Value },
|
||||||
{ "password", configData.Password.Value },
|
{ "password", configData.Password.Value },
|
||||||
|
|
|
@ -83,7 +83,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
|
|
||||||
var pairs = new Dictionary<string, string> {
|
var pairs = new Dictionary<string, string> {
|
||||||
{ "username", configData.Username.Value },
|
{ "username", configData.Username.Value },
|
||||||
|
|
|
@ -104,7 +104,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
var pairs = new Dictionary<string, string> {
|
var pairs = new Dictionary<string, string> {
|
||||||
{ "returnto" , "/" },
|
{ "returnto" , "/" },
|
||||||
{ "username", configData.Username.Value },
|
{ "username", configData.Username.Value },
|
||||||
|
|
|
@ -76,7 +76,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
|
|
||||||
var loginPage = await RequestStringWithCookies(LoginUrl, string.Empty);
|
var loginPage = await RequestStringWithCookies(LoginUrl, string.Empty);
|
||||||
|
|
||||||
|
|
|
@ -21,15 +21,14 @@ namespace Jackett.Indexers
|
||||||
{
|
{
|
||||||
public class HDTorrents : BaseIndexer, IIndexer
|
public class HDTorrents : BaseIndexer, IIndexer
|
||||||
{
|
{
|
||||||
private string UseLink { get { return (!String.IsNullOrEmpty(this.configData.AlternateLink.Value) ? this.configData.AlternateLink.Value : SiteLink); } }
|
private string SearchUrl { get { return SiteLink + "torrents.php?"; } }
|
||||||
private string SearchUrl { get { return UseLink + "torrents.php?"; } }
|
private string LoginUrl { get { return SiteLink + "login.php"; } }
|
||||||
private string LoginUrl { get { return UseLink + "login.php"; } }
|
|
||||||
private const int MAXPAGES = 3;
|
private const int MAXPAGES = 3;
|
||||||
private List<String> KnownURLs = new List<String> { "https://hdts.ru/", "https://hd-torrents.org/", "https://hd-torrents.net/", "https://hd-torrents.me/" };
|
public new string[] AlternativeSiteLinks { get; protected set; } = new string[] { "https://hdts.ru/", "https://hd-torrents.org/", "https://hd-torrents.net/", "https://hd-torrents.me/" };
|
||||||
|
|
||||||
new ConfigurationDataBasicLoginWithAlternateLink configData
|
new ConfigurationDataBasicLogin configData
|
||||||
{
|
{
|
||||||
get { return (ConfigurationDataBasicLoginWithAlternateLink)base.configData; }
|
get { return (ConfigurationDataBasicLogin)base.configData; }
|
||||||
set { base.configData = value; }
|
set { base.configData = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,15 +40,11 @@ namespace Jackett.Indexers
|
||||||
client: w,
|
client: w,
|
||||||
logger: l,
|
logger: l,
|
||||||
p: ps,
|
p: ps,
|
||||||
configData: new ConfigurationDataBasicLoginWithAlternateLink())
|
configData: new ConfigurationDataBasicLogin())
|
||||||
{
|
{
|
||||||
Encoding = Encoding.GetEncoding("UTF-8");
|
Encoding = Encoding.GetEncoding("UTF-8");
|
||||||
Language = "en-us";
|
Language = "en-us";
|
||||||
|
|
||||||
this.configData.Instructions.Value = this.DisplayName + " has multiple URLs. The default (" + this.SiteLink + ") can be changed by entering a new value in the box below.";
|
|
||||||
this.configData.Instructions.Value += "The following are some known URLs for " + this.DisplayName;
|
|
||||||
this.configData.Instructions.Value += "<ul><li>" + String.Join("</li><li>", this.KnownURLs.ToArray()) + "</li></ul>";
|
|
||||||
|
|
||||||
TorznabCaps.Categories.Clear();
|
TorznabCaps.Categories.Clear();
|
||||||
|
|
||||||
AddCategoryMapping("1", TorznabCatType.MoviesHD);// Movie/Blu-Ray
|
AddCategoryMapping("1", TorznabCatType.MoviesHD);// Movie/Blu-Ray
|
||||||
|
@ -76,9 +71,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
if (!string.IsNullOrWhiteSpace(configData.AlternateLink.Value) && !configData.AlternateLink.Value.EndsWith("/"))
|
|
||||||
configData.AlternateLink.Value += "/";
|
|
||||||
|
|
||||||
var loginPage = await RequestStringWithCookies(LoginUrl, string.Empty);
|
var loginPage = await RequestStringWithCookies(LoginUrl, string.Empty);
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
var pairs = new Dictionary<string, string> {
|
var pairs = new Dictionary<string, string> {
|
||||||
{ "username", configData.Username.Value },
|
{ "username", configData.Username.Value },
|
||||||
{ "password", configData.Password.Value }
|
{ "password", configData.Password.Value }
|
||||||
|
|
|
@ -84,7 +84,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
var pairs = new Dictionary<string, string> {
|
var pairs = new Dictionary<string, string> {
|
||||||
{ "username", configData.Username.Value },
|
{ "username", configData.Username.Value },
|
||||||
{ "password", configData.Password.Value },
|
{ "password", configData.Password.Value },
|
||||||
|
|
|
@ -98,7 +98,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
|
|
||||||
// reset cookies, if we send expired cookies for a new session their code seems to get confused
|
// reset cookies, if we send expired cookies for a new session their code seems to get confused
|
||||||
// Due to the session not getting initiated correctly it will result in errors like this:
|
// Due to the session not getting initiated correctly it will result in errors like this:
|
||||||
|
|
|
@ -13,6 +13,7 @@ namespace Jackett.Indexers
|
||||||
public interface IIndexer
|
public interface IIndexer
|
||||||
{
|
{
|
||||||
string SiteLink { get; }
|
string SiteLink { get; }
|
||||||
|
string[] AlternativeSiteLinks { get; }
|
||||||
|
|
||||||
string DisplayName { get; }
|
string DisplayName { get; }
|
||||||
string DisplayDescription { get; }
|
string DisplayDescription { get; }
|
||||||
|
@ -23,9 +24,9 @@ namespace Jackett.Indexers
|
||||||
TorznabCapabilities TorznabCaps { get; }
|
TorznabCapabilities TorznabCaps { get; }
|
||||||
|
|
||||||
// Whether this indexer has been configured, verified and saved in the past and has the settings required for functioning
|
// Whether this indexer has been configured, verified and saved in the past and has the settings required for functioning
|
||||||
bool IsConfigured { get; }
|
bool IsConfigured { get; }
|
||||||
|
|
||||||
// Retrieved for starting setup for the indexer via web API
|
// Retrieved for starting setup for the indexer via web API
|
||||||
Task<ConfigurationData> GetConfigurationForSetup();
|
Task<ConfigurationData> GetConfigurationForSetup();
|
||||||
|
|
||||||
// Called when web API wants to apply setup configuration via web API, usually this is where login and storing cookie happens
|
// Called when web API wants to apply setup configuration via web API, usually this is where login and storing cookie happens
|
||||||
|
|
|
@ -74,7 +74,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
var pairs = new Dictionary<string, string> {
|
var pairs = new Dictionary<string, string> {
|
||||||
{ "username", configData.Username.Value },
|
{ "username", configData.Username.Value },
|
||||||
{ "password", configData.Password.Value },
|
{ "password", configData.Password.Value },
|
||||||
|
|
|
@ -21,15 +21,14 @@ namespace Jackett.Indexers
|
||||||
{
|
{
|
||||||
public class IPTorrents : BaseIndexer, IIndexer
|
public class IPTorrents : BaseIndexer, IIndexer
|
||||||
{
|
{
|
||||||
private string UseLink { get { return (!String.IsNullOrEmpty(this.configData.AlternateLink.Value) ? this.configData.AlternateLink.Value : SiteLink); } }
|
string LoginUrl { get { return SiteLink + "login.php"; } }
|
||||||
string LoginUrl { get { return UseLink + "login.php"; } }
|
string TakeLoginUrl { get { return SiteLink + "take_login.php"; } }
|
||||||
string TakeLoginUrl { get { return UseLink + "take_login.php"; } }
|
private string BrowseUrl { get { return SiteLink + "t"; } }
|
||||||
private string BrowseUrl { get { return UseLink + "t"; } }
|
public new string[] AlternativeSiteLinks { get; protected set; } = new string[] { "https://ipt-update.com/", "https://iptorrents.com/", "https://iptorrents.eu/", "https://nemo.iptorrents.com/", "https://ipt.rocks/" };
|
||||||
private List<String> KnownURLs = new List<String> { "https://ipt-update.com/", "https://iptorrents.com/", "https://iptorrents.eu", "https://nemo.iptorrents.com/", "https://ipt.rocks/" };
|
|
||||||
|
|
||||||
new ConfigurationDataRecaptchaLoginWithAlternateLink configData
|
new ConfigurationDataRecaptchaLogin configData
|
||||||
{
|
{
|
||||||
get { return (ConfigurationDataRecaptchaLoginWithAlternateLink)base.configData; }
|
get { return (ConfigurationDataRecaptchaLogin)base.configData; }
|
||||||
set { base.configData = value; }
|
set { base.configData = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,15 +41,11 @@ namespace Jackett.Indexers
|
||||||
client: wc,
|
client: wc,
|
||||||
logger: l,
|
logger: l,
|
||||||
p: ps,
|
p: ps,
|
||||||
configData: new ConfigurationDataRecaptchaLoginWithAlternateLink())
|
configData: new ConfigurationDataRecaptchaLogin())
|
||||||
{
|
{
|
||||||
Encoding = Encoding.GetEncoding("UTF-8");
|
Encoding = Encoding.GetEncoding("UTF-8");
|
||||||
Language = "en-us";
|
Language = "en-us";
|
||||||
|
|
||||||
this.configData.Instructions.Value = this.DisplayName + " has multiple URLs. The default (" + this.SiteLink + ") can be changed by entering a new value in the box below.";
|
|
||||||
this.configData.Instructions.Value += "The following are some known URLs for " + this.DisplayName;
|
|
||||||
this.configData.Instructions.Value += "<ul><li>" + String.Join("</li><li>", this.KnownURLs.ToArray()) + "</li></ul>";
|
|
||||||
|
|
||||||
AddCategoryMapping(72, TorznabCatType.Movies);
|
AddCategoryMapping(72, TorznabCatType.Movies);
|
||||||
AddCategoryMapping(77, TorznabCatType.MoviesSD);
|
AddCategoryMapping(77, TorznabCatType.MoviesSD);
|
||||||
AddCategoryMapping(89, TorznabCatType.MoviesSD);
|
AddCategoryMapping(89, TorznabCatType.MoviesSD);
|
||||||
|
@ -110,19 +105,21 @@ namespace Jackett.Indexers
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var result = new ConfigurationDataBasicLoginWithAlternateLink();
|
var result = new ConfigurationDataBasicLogin();
|
||||||
|
result.SiteLink.Value = configData.SiteLink.Value;
|
||||||
result.Instructions.Value = configData.Instructions.Value;
|
result.Instructions.Value = configData.Instructions.Value;
|
||||||
result.Username.Value = configData.Username.Value;
|
result.Username.Value = configData.Username.Value;
|
||||||
result.Password.Value = configData.Password.Value;
|
result.Password.Value = configData.Password.Value;
|
||||||
result.CookieHeader.Value = loginPage.Cookies;
|
result.CookieHeader.Value = loginPage.Cookies;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
var pairs = new Dictionary<string, string> {
|
var pairs = new Dictionary<string, string> {
|
||||||
{ "username", configData.Username.Value },
|
{ "username", configData.Username.Value },
|
||||||
{ "password", configData.Password.Value },
|
{ "password", configData.Password.Value },
|
||||||
|
@ -155,7 +152,7 @@ namespace Jackett.Indexers
|
||||||
{
|
{
|
||||||
Url = TakeLoginUrl,
|
Url = TakeLoginUrl,
|
||||||
Type = RequestType.POST,
|
Type = RequestType.POST,
|
||||||
Referer = UseLink,
|
Referer = SiteLink,
|
||||||
Encoding = Encoding,
|
Encoding = Encoding,
|
||||||
PostData = pairs
|
PostData = pairs
|
||||||
};
|
};
|
||||||
|
@ -218,7 +215,7 @@ namespace Jackett.Indexers
|
||||||
}
|
}
|
||||||
|
|
||||||
release.Description = release.Title;
|
release.Description = release.Title;
|
||||||
release.Guid = new Uri(UseLink + qTitleLink.Attr("href").Substring(1));
|
release.Guid = new Uri(SiteLink + qTitleLink.Attr("href").Substring(1));
|
||||||
release.Comments = release.Guid;
|
release.Comments = release.Guid;
|
||||||
|
|
||||||
var descString = qRow.Find(".t_ctime").Text();
|
var descString = qRow.Find(".t_ctime").Text();
|
||||||
|
@ -227,7 +224,7 @@ namespace Jackett.Indexers
|
||||||
release.PublishDate = DateTimeUtil.FromTimeAgo(dateString);
|
release.PublishDate = DateTimeUtil.FromTimeAgo(dateString);
|
||||||
|
|
||||||
var qLink = row.ChildElements.ElementAt(3).Cq().Children("a");
|
var qLink = row.ChildElements.ElementAt(3).Cq().Children("a");
|
||||||
release.Link = new Uri(UseLink + HttpUtility.UrlEncode(qLink.Attr("href").TrimStart('/')));
|
release.Link = new Uri(SiteLink + HttpUtility.UrlEncode(qLink.Attr("href").TrimStart('/')));
|
||||||
|
|
||||||
var sizeStr = row.ChildElements.ElementAt(5).Cq().Text();
|
var sizeStr = row.ChildElements.ElementAt(5).Cq().Text();
|
||||||
release.Size = ReleaseInfo.GetBytes(sizeStr);
|
release.Size = ReleaseInfo.GetBytes(sizeStr);
|
||||||
|
|
|
@ -72,8 +72,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
if (configJson != null)
|
LoadValuesFromJson(configJson);
|
||||||
configData.LoadValuesFromJson(configJson);
|
|
||||||
|
|
||||||
var pairs = new Dictionary<string, string> {
|
var pairs = new Dictionary<string, string> {
|
||||||
{ "username", configData.Username.Value },
|
{ "username", configData.Username.Value },
|
||||||
|
|
|
@ -46,7 +46,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
ConfigData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
var pairs = new Dictionary<string, string> {
|
var pairs = new Dictionary<string, string> {
|
||||||
{ "username", ConfigData.Username.Value },
|
{ "username", ConfigData.Username.Value },
|
||||||
{ "password", ConfigData.Password.Value },
|
{ "password", ConfigData.Password.Value },
|
||||||
|
|
|
@ -132,7 +132,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
var pairs = new Dictionary<string, string> {
|
var pairs = new Dictionary<string, string> {
|
||||||
{ "email", configData.Username.Value },
|
{ "email", configData.Username.Value },
|
||||||
{ "password", configData.Password.Value },
|
{ "password", configData.Password.Value },
|
||||||
|
|
|
@ -76,7 +76,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
|
|
||||||
if (configData.Hungarian.Value == false && configData.English.Value == false)
|
if (configData.Hungarian.Value == false && configData.English.Value == false)
|
||||||
throw new ExceptionWithConfigData("Please select atleast one language.", configData);
|
throw new ExceptionWithConfigData("Please select atleast one language.", configData);
|
||||||
|
|
|
@ -96,7 +96,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
|
|
||||||
var pairs = new Dictionary<string, string>
|
var pairs = new Dictionary<string, string>
|
||||||
{
|
{
|
||||||
|
|
|
@ -72,7 +72,7 @@ namespace Jackett.Indexers
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
// Retrieve config values set by Jackett's user
|
// Retrieve config values set by Jackett's user
|
||||||
ConfigData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
|
|
||||||
// Check & Validate Config
|
// Check & Validate Config
|
||||||
ValidateConfig();
|
ValidateConfig();
|
||||||
|
|
|
@ -58,7 +58,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
|
|
||||||
await DoLogin();
|
await DoLogin();
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
|
|
||||||
var result1 = await RequestStringWithCookies(CaptchaUrl);
|
var result1 = await RequestStringWithCookies(CaptchaUrl);
|
||||||
var json1 = JObject.Parse(result1.Content);
|
var json1 = JObject.Parse(result1.Content);
|
||||||
|
|
|
@ -173,7 +173,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
|
|
||||||
var loginPage = await RequestStringWithCookies(LoginUrl, string.Empty);
|
var loginPage = await RequestStringWithCookies(LoginUrl, string.Empty);
|
||||||
|
|
||||||
|
|
|
@ -187,7 +187,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
|
|
||||||
var pairs = new Dictionary<string, string> {
|
var pairs = new Dictionary<string, string> {
|
||||||
{ "username", configData.Username.Value },
|
{ "username", configData.Username.Value },
|
||||||
|
|
|
@ -92,7 +92,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
|
|
||||||
var pairs = new Dictionary<string, string> {
|
var pairs = new Dictionary<string, string> {
|
||||||
{ "username", configData.Username.Value },
|
{ "username", configData.Username.Value },
|
||||||
|
|
|
@ -93,7 +93,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
var pairs = new Dictionary<string, string>
|
var pairs = new Dictionary<string, string>
|
||||||
{
|
{
|
||||||
{ "username", configData.Username.Value },
|
{ "username", configData.Username.Value },
|
||||||
|
|
|
@ -99,6 +99,7 @@ namespace Jackett.Indexers
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var stdResult = new ConfigurationDataBasicLogin();
|
var stdResult = new ConfigurationDataBasicLogin();
|
||||||
|
stdResult.SiteLink.Value = configData.SiteLink.Value;
|
||||||
stdResult.Username.Value = configData.Username.Value;
|
stdResult.Username.Value = configData.Username.Value;
|
||||||
stdResult.Password.Value = configData.Password.Value;
|
stdResult.Password.Value = configData.Password.Value;
|
||||||
stdResult.CookieHeader.Value = loginPage.Cookies;
|
stdResult.CookieHeader.Value = loginPage.Cookies;
|
||||||
|
@ -108,7 +109,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
var pairs = new Dictionary<string, string> {
|
var pairs = new Dictionary<string, string> {
|
||||||
{ "username", configData.Username.Value },
|
{ "username", configData.Username.Value },
|
||||||
{ "password", configData.Password.Value },
|
{ "password", configData.Password.Value },
|
||||||
|
|
|
@ -54,7 +54,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
var pairs = new Dictionary<string, string> {
|
var pairs = new Dictionary<string, string> {
|
||||||
{ "referer", "login"},
|
{ "referer", "login"},
|
||||||
{ "query", ""},
|
{ "query", ""},
|
||||||
|
|
|
@ -74,7 +74,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
|
|
||||||
await DoLogin();
|
await DoLogin();
|
||||||
|
|
||||||
|
|
|
@ -108,7 +108,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
var pairs = new Dictionary<string, string> {
|
var pairs = new Dictionary<string, string> {
|
||||||
{ "username", configData.Username.Value },
|
{ "username", configData.Username.Value },
|
||||||
{ "password", configData.Password.Value }
|
{ "password", configData.Password.Value }
|
||||||
|
|
|
@ -46,7 +46,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
|
|
||||||
var pairs = new Dictionary<string, string>
|
var pairs = new Dictionary<string, string>
|
||||||
{
|
{
|
||||||
|
|
|
@ -57,7 +57,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
|
|
||||||
await DoLogin();
|
await DoLogin();
|
||||||
|
|
||||||
|
|
|
@ -75,8 +75,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
if(configJson != null)
|
LoadValuesFromJson(configJson);
|
||||||
configData.LoadValuesFromJson(configJson);
|
|
||||||
var pairs = new Dictionary<string, string> {
|
var pairs = new Dictionary<string, string> {
|
||||||
{ "username", configData.Username.Value },
|
{ "username", configData.Username.Value },
|
||||||
{ "password", configData.Password.Value },
|
{ "password", configData.Password.Value },
|
||||||
|
|
|
@ -21,11 +21,10 @@ namespace Jackett.Indexers
|
||||||
{
|
{
|
||||||
public class TorrentDay : BaseIndexer, IIndexer
|
public class TorrentDay : BaseIndexer, IIndexer
|
||||||
{
|
{
|
||||||
private string UseLink { get { return (!String.IsNullOrEmpty(this.configData.AlternateLink.Value) ? this.configData.AlternateLink.Value : SiteLink); } }
|
private string StartPageUrl { get { return SiteLink + "login.php"; } }
|
||||||
private string StartPageUrl { get { return UseLink + "login.php"; } }
|
private string LoginUrl { get { return SiteLink + "tak3login.php"; } }
|
||||||
private string LoginUrl { get { return UseLink + "tak3login.php"; } }
|
private string SearchUrl { get { return SiteLink + "browse.php"; } }
|
||||||
private string SearchUrl { get { return UseLink + "browse.php"; } }
|
public new string[] AlternativeSiteLinks { get; protected set; } = new string[] {
|
||||||
private List<String> KnownURLs = new List<String> {
|
|
||||||
"https://tdonline.org/",
|
"https://tdonline.org/",
|
||||||
"https://secure.torrentday.com/",
|
"https://secure.torrentday.com/",
|
||||||
"https://torrentday.eu/",
|
"https://torrentday.eu/",
|
||||||
|
@ -39,9 +38,9 @@ namespace Jackett.Indexers
|
||||||
"https://www.td.af/",
|
"https://www.td.af/",
|
||||||
};
|
};
|
||||||
|
|
||||||
new ConfigurationDataRecaptchaLoginWithAlternateLink configData
|
new ConfigurationDataRecaptchaLogin configData
|
||||||
{
|
{
|
||||||
get { return (ConfigurationDataRecaptchaLoginWithAlternateLink)base.configData; }
|
get { return (ConfigurationDataRecaptchaLogin)base.configData; }
|
||||||
set { base.configData = value; }
|
set { base.configData = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,15 +53,11 @@ namespace Jackett.Indexers
|
||||||
client: wc,
|
client: wc,
|
||||||
logger: l,
|
logger: l,
|
||||||
p: ps,
|
p: ps,
|
||||||
configData: new ConfigurationDataRecaptchaLoginWithAlternateLink())
|
configData: new ConfigurationDataRecaptchaLogin())
|
||||||
{
|
{
|
||||||
Encoding = Encoding.GetEncoding("UTF-8");
|
Encoding = Encoding.GetEncoding("UTF-8");
|
||||||
Language = "en-us";
|
Language = "en-us";
|
||||||
|
|
||||||
this.configData.Instructions.Value = this.DisplayName + " has multiple URLs. The default (" + this.SiteLink + ") can be changed by entering a new value in the box below.";
|
|
||||||
this.configData.Instructions.Value += "The following are some known URLs for " + this.DisplayName;
|
|
||||||
this.configData.Instructions.Value += "<ul><li>" + String.Join("</li><li>", this.KnownURLs.ToArray()) + "</li></ul>";
|
|
||||||
|
|
||||||
AddCategoryMapping(29, TorznabCatType.TVAnime); // Anime
|
AddCategoryMapping(29, TorznabCatType.TVAnime); // Anime
|
||||||
AddCategoryMapping(28, TorznabCatType.PC); // Appz/Packs
|
AddCategoryMapping(28, TorznabCatType.PC); // Appz/Packs
|
||||||
AddCategoryMapping(42, TorznabCatType.AudioAudiobook); // Audio Books
|
AddCategoryMapping(42, TorznabCatType.AudioAudiobook); // Audio Books
|
||||||
|
@ -125,7 +120,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
var pairs = new Dictionary<string, string> {
|
var pairs = new Dictionary<string, string> {
|
||||||
{ "username", configData.Username.Value },
|
{ "username", configData.Username.Value },
|
||||||
{ "password", configData.Password.Value },
|
{ "password", configData.Password.Value },
|
||||||
|
@ -155,7 +150,7 @@ namespace Jackett.Indexers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var result = await RequestLoginAndFollowRedirect(LoginUrl, pairs, configData.CookieHeader.Value, true, UseLink, LoginUrl);
|
var result = await RequestLoginAndFollowRedirect(LoginUrl, pairs, configData.CookieHeader.Value, true, SiteLink, LoginUrl);
|
||||||
await ConfigureIfOK(result.Cookies, result.Content != null && result.Content.Contains("logout.php"), () =>
|
await ConfigureIfOK(result.Cookies, result.Content != null && result.Content.Contains("logout.php"), () =>
|
||||||
{
|
{
|
||||||
CQ dom = result.Content;
|
CQ dom = result.Content;
|
||||||
|
@ -223,9 +218,9 @@ namespace Jackett.Indexers
|
||||||
release.MinimumSeedTime = 172800;
|
release.MinimumSeedTime = 172800;
|
||||||
release.Title = qRow.Find(".torrentName").Text();
|
release.Title = qRow.Find(".torrentName").Text();
|
||||||
release.Description = release.Title;
|
release.Description = release.Title;
|
||||||
release.Guid = new Uri(UseLink + qRow.Find(".torrentName").Attr("href"));
|
release.Guid = new Uri(SiteLink + qRow.Find(".torrentName").Attr("href"));
|
||||||
release.Comments = release.Guid;
|
release.Comments = release.Guid;
|
||||||
release.Link = new Uri(UseLink + qRow.Find(".dlLinksInfo > a").Attr("href"));
|
release.Link = new Uri(SiteLink + qRow.Find(".dlLinksInfo > a").Attr("href"));
|
||||||
|
|
||||||
var sizeStr = qRow.Find(".sizeInfo").Text();
|
var sizeStr = qRow.Find(".sizeInfo").Text();
|
||||||
release.Size = ReleaseInfo.GetBytes(sizeStr);
|
release.Size = ReleaseInfo.GetBytes(sizeStr);
|
||||||
|
|
|
@ -111,7 +111,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
|
|
||||||
var pairs = new Dictionary<string, string>
|
var pairs = new Dictionary<string, string>
|
||||||
{
|
{
|
||||||
|
|
|
@ -95,7 +95,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
await DoLogin();
|
await DoLogin();
|
||||||
return IndexerConfigurationStatus.RequiresTesting;
|
return IndexerConfigurationStatus.RequiresTesting;
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
|
|
||||||
var pairs = new Dictionary<string, string>
|
var pairs = new Dictionary<string, string>
|
||||||
{
|
{
|
||||||
|
|
|
@ -77,7 +77,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
|
|
||||||
var pairs = new Dictionary<string, string> {
|
var pairs = new Dictionary<string, string> {
|
||||||
{ "username", configData.Username.Value },
|
{ "username", configData.Username.Value },
|
||||||
|
|
|
@ -94,7 +94,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
|
|
||||||
var result1 = await RequestStringWithCookies(CaptchaUrl);
|
var result1 = await RequestStringWithCookies(CaptchaUrl);
|
||||||
var json1 = JObject.Parse(result1.Content);
|
var json1 = JObject.Parse(result1.Content);
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
|
|
||||||
var pairs = new Dictionary<string, string>
|
var pairs = new Dictionary<string, string>
|
||||||
{
|
{
|
||||||
|
|
|
@ -44,7 +44,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
await DoLogin();
|
await DoLogin();
|
||||||
return IndexerConfigurationStatus.RequiresTesting;
|
return IndexerConfigurationStatus.RequiresTesting;
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,7 @@ namespace Jackett.Indexers
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
// Retrieve config values set by Jackett's user
|
// Retrieve config values set by Jackett's user
|
||||||
ConfigData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
|
|
||||||
// Check & Validate Config
|
// Check & Validate Config
|
||||||
validateConfig();
|
validateConfig();
|
||||||
|
|
|
@ -126,7 +126,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
var pairs = new Dictionary<string, string>
|
var pairs = new Dictionary<string, string>
|
||||||
{
|
{
|
||||||
{"username", configData.Username.Value},
|
{"username", configData.Username.Value},
|
||||||
|
|
|
@ -114,7 +114,7 @@ namespace Jackett.Indexers
|
||||||
IsConfigured = false;
|
IsConfigured = false;
|
||||||
|
|
||||||
// Retrieve config values set by Jackett's user
|
// Retrieve config values set by Jackett's user
|
||||||
ConfigData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
|
|
||||||
// Check & Validate Config
|
// Check & Validate Config
|
||||||
ValidateConfig();
|
ValidateConfig();
|
||||||
|
|
|
@ -62,7 +62,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
|
|
||||||
var pairs = new Dictionary<string, string>
|
var pairs = new Dictionary<string, string>
|
||||||
{
|
{
|
||||||
|
|
|
@ -68,7 +68,7 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
LoadValuesFromJson(configJson);
|
||||||
var pairs = new Dictionary<string, string> {
|
var pairs = new Dictionary<string, string> {
|
||||||
{ "username", configData.Username.Value },
|
{ "username", configData.Username.Value },
|
||||||
{ "password", configData.Password.Value },
|
{ "password", configData.Password.Value },
|
||||||
|
|
|
@ -237,8 +237,6 @@
|
||||||
<Compile Include="Models\IndexerConfig\ConfigurationDataAPIKey.cs" />
|
<Compile Include="Models\IndexerConfig\ConfigurationDataAPIKey.cs" />
|
||||||
<Compile Include="Models\IndexerConfig\ConfigurationDataLoginLink.cs" />
|
<Compile Include="Models\IndexerConfig\ConfigurationDataLoginLink.cs" />
|
||||||
<Compile Include="Models\IndexerConfig\ConfigurationDataBasicLoginWithRSSAndDisplay.cs" />
|
<Compile Include="Models\IndexerConfig\ConfigurationDataBasicLoginWithRSSAndDisplay.cs" />
|
||||||
<Compile Include="Models\IndexerConfig\ConfigurationDataBasicLoginWithAlternateLink.cs" />
|
|
||||||
<Compile Include="Models\IndexerConfig\ConfigurationDataRecaptchaLoginWithAlternateLink.cs" />
|
|
||||||
<Compile Include="Models\ManualSearchResult.cs" />
|
<Compile Include="Models\ManualSearchResult.cs" />
|
||||||
<Compile Include="Indexers\TVChaosUK.cs" />
|
<Compile Include="Indexers\TVChaosUK.cs" />
|
||||||
<Compile Include="Indexers\NCore.cs" />
|
<Compile Include="Indexers\NCore.cs" />
|
||||||
|
|
|
@ -27,6 +27,7 @@ namespace Jackett.Models.IndexerConfig
|
||||||
|
|
||||||
public HiddenItem CookieHeader { get; private set; } = new HiddenItem { Name = "CookieHeader" };
|
public HiddenItem CookieHeader { get; private set; } = new HiddenItem { Name = "CookieHeader" };
|
||||||
public HiddenItem LastError { get; private set; } = new HiddenItem { Name = "LastError" };
|
public HiddenItem LastError { get; private set; } = new HiddenItem { Name = "LastError" };
|
||||||
|
public StringItem SiteLink { get; private set; } = new StringItem { Name = "Site Link" };
|
||||||
|
|
||||||
public ConfigurationData()
|
public ConfigurationData()
|
||||||
{
|
{
|
||||||
|
@ -44,6 +45,14 @@ namespace Jackett.Models.IndexerConfig
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var arr = (JArray)json;
|
var arr = (JArray)json;
|
||||||
|
|
||||||
|
// transistion from alternatelink to sitelink
|
||||||
|
var alternatelinkItem = arr.FirstOrDefault(f => f.Value<string>("id") == "alternatelink");
|
||||||
|
if (alternatelinkItem != null && !string.IsNullOrEmpty(alternatelinkItem.Value<string>("value")))
|
||||||
|
{
|
||||||
|
//SiteLink.Value = alternatelinkItem.Value<string>("value");
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var item in GetItems(forDisplay: false))
|
foreach (var item in GetItems(forDisplay: false))
|
||||||
{
|
{
|
||||||
var arrItem = arr.FirstOrDefault(f => f.Value<string>("id") == item.ID);
|
var arrItem = arr.FirstOrDefault(f => f.Value<string>("id") == item.ID);
|
||||||
|
@ -64,7 +73,8 @@ namespace Jackett.Models.IndexerConfig
|
||||||
if (ps != null)
|
if (ps != null)
|
||||||
sItem.Value = ps.UnProtect(newValue);
|
sItem.Value = ps.UnProtect(newValue);
|
||||||
}
|
}
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
sItem.Value = newValue;
|
sItem.Value = newValue;
|
||||||
}
|
}
|
||||||
|
@ -131,19 +141,23 @@ namespace Jackett.Models.IndexerConfig
|
||||||
|
|
||||||
Item[] GetItems(bool forDisplay)
|
Item[] GetItems(bool forDisplay)
|
||||||
{
|
{
|
||||||
var properties = GetType()
|
List<Item> properties = GetType()
|
||||||
.GetProperties()
|
.GetProperties()
|
||||||
.Where(p => p.CanRead)
|
.Where(p => p.CanRead)
|
||||||
.Where(p => p.PropertyType.IsSubclassOf(typeof(Item)))
|
.Where(p => p.PropertyType.IsSubclassOf(typeof(Item)))
|
||||||
.Select(p => (Item)p.GetValue(this));
|
.Select(p => (Item)p.GetValue(this)).ToList();
|
||||||
|
|
||||||
|
// remove/insert Site Link manualy to make sure it shows up first
|
||||||
|
properties.Remove(SiteLink);
|
||||||
|
properties.Insert(0, SiteLink);
|
||||||
|
|
||||||
properties = properties.Concat(dynamics.Values).ToArray();
|
properties.AddRange(dynamics.Values);
|
||||||
|
|
||||||
if (!forDisplay)
|
if (!forDisplay)
|
||||||
{
|
{
|
||||||
properties = properties
|
properties = properties
|
||||||
.Where(p => p.ItemType == ItemType.HiddenData || p.ItemType == ItemType.InputBool || p.ItemType == ItemType.InputString || p.ItemType == ItemType.Recaptcha || p.ItemType == ItemType.DisplayInfo)
|
.Where(p => p.ItemType == ItemType.HiddenData || p.ItemType == ItemType.InputBool || p.ItemType == ItemType.InputString || p.ItemType == ItemType.Recaptcha || p.ItemType == ItemType.DisplayInfo)
|
||||||
.ToArray();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
return properties.ToArray();
|
return properties.ToArray();
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
using Newtonsoft.Json.Linq;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Jackett.Models.IndexerConfig
|
|
||||||
{
|
|
||||||
public class ConfigurationDataBasicLoginWithAlternateLink : ConfigurationData
|
|
||||||
{
|
|
||||||
public StringItem Username { get; private set; }
|
|
||||||
public StringItem Password { get; private set; }
|
|
||||||
public DisplayItem Instructions { get; private set; }
|
|
||||||
public StringItem AlternateLink { get; set; }
|
|
||||||
|
|
||||||
public ConfigurationDataBasicLoginWithAlternateLink(string instructionMessageOptional = null)
|
|
||||||
{
|
|
||||||
Username = new StringItem { Name = "Username" };
|
|
||||||
Password = new StringItem { Name = "Password" };
|
|
||||||
Instructions = new DisplayItem(instructionMessageOptional) { Name = "" };
|
|
||||||
AlternateLink = new StringItem { Name = "Alternate Link" };
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,29 +0,0 @@
|
||||||
using Newtonsoft.Json.Linq;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Jackett.Models.IndexerConfig
|
|
||||||
{
|
|
||||||
public class ConfigurationDataRecaptchaLoginWithAlternateLink : ConfigurationData
|
|
||||||
{
|
|
||||||
public StringItem Username { get; private set; }
|
|
||||||
public StringItem Password { get; private set; }
|
|
||||||
public DisplayItem Instructions { get; private set; }
|
|
||||||
public StringItem AlternateLink { get; set; }
|
|
||||||
public RecaptchaItem Captcha { get; private set; }
|
|
||||||
|
|
||||||
public ConfigurationDataRecaptchaLoginWithAlternateLink(string instructionMessageOptional = null)
|
|
||||||
{
|
|
||||||
Username = new StringItem { Name = "Username" };
|
|
||||||
Password = new StringItem { Name = "Password" };
|
|
||||||
Instructions = new DisplayItem(instructionMessageOptional) { Name = "" };
|
|
||||||
AlternateLink = new StringItem { Name = "Alternate Link" };
|
|
||||||
Captcha = new RecaptchaItem() { Name = "Recaptcha" };
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue