mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
assorted: remove configuration data with RSS (#14270)
This commit is contained in:
@@ -39,9 +39,9 @@ namespace Jackett.Common.Indexers
|
|||||||
private static readonly Regex _DateRegex = new Regex("Dodano: (\\d{2}\\/\\d{2}\\/\\d{4})", RegexOptions.Compiled);
|
private static readonly Regex _DateRegex = new Regex("Dodano: (\\d{2}\\/\\d{2}\\/\\d{4})", RegexOptions.Compiled);
|
||||||
private static readonly Regex _SeedsRegex = new Regex("Seedów: (\\d+)", RegexOptions.Compiled);
|
private static readonly Regex _SeedsRegex = new Regex("Seedów: (\\d+)", RegexOptions.Compiled);
|
||||||
private static readonly Regex _LeechersRegex = new Regex("Leecherów: (\\d+)", RegexOptions.Compiled);
|
private static readonly Regex _LeechersRegex = new Regex("Leecherów: (\\d+)", RegexOptions.Compiled);
|
||||||
private new ConfigurationDataBasicLoginWithRSSAndDisplay configData
|
private new ConfigurationDataBasicLogin configData
|
||||||
{
|
{
|
||||||
get => (ConfigurationDataBasicLoginWithRSSAndDisplay)base.configData;
|
get => (ConfigurationDataBasicLogin)base.configData;
|
||||||
set => base.configData = value;
|
set => base.configData = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ namespace Jackett.Common.Indexers
|
|||||||
logger: l,
|
logger: l,
|
||||||
p: ps,
|
p: ps,
|
||||||
cacheService: cs,
|
cacheService: cs,
|
||||||
configData: new ConfigurationDataBasicLoginWithRSSAndDisplay())
|
configData: new ConfigurationDataBasicLogin())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -34,9 +34,9 @@ namespace Jackett.Common.Indexers
|
|||||||
private string LoginUrl => SiteLink + "takelogin.php";
|
private string LoginUrl => SiteLink + "takelogin.php";
|
||||||
private string CaptchaUrl => SiteLink + "simpleCaptcha.php?numImages=1";
|
private string CaptchaUrl => SiteLink + "simpleCaptcha.php?numImages=1";
|
||||||
|
|
||||||
private new ConfigurationDataBasicLoginWithRSSAndDisplay configData
|
private new ConfigurationDataBasicLogin configData
|
||||||
{
|
{
|
||||||
get => (ConfigurationDataBasicLoginWithRSSAndDisplay)base.configData;
|
get => (ConfigurationDataBasicLogin)base.configData;
|
||||||
set => base.configData = value;
|
set => base.configData = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ namespace Jackett.Common.Indexers
|
|||||||
logger: l,
|
logger: l,
|
||||||
p: ps,
|
p: ps,
|
||||||
cacheService: cs,
|
cacheService: cs,
|
||||||
configData: new ConfigurationDataBasicLoginWithRSSAndDisplay("Only the results from the first search result page are shown, adjust your profile settings to show the maximum."))
|
configData: new ConfigurationDataBasicLogin("Only the results from the first search result page are shown, adjust your profile settings to show the maximum."))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,8 +98,8 @@ namespace Jackett.Common.Indexers
|
|||||||
|
|
||||||
var result2 = await RequestLoginAndFollowRedirect(LoginUrl, pairs, result1.Cookies, true, null, null, true);
|
var result2 = await RequestLoginAndFollowRedirect(LoginUrl, pairs, result1.Cookies, true, null, null, true);
|
||||||
|
|
||||||
await ConfigureIfOK(result2.Cookies, result2.ContentString.Contains("logout.php"), () =>
|
await ConfigureIfOK(result2.Cookies, result2.ContentString.Contains("logout.php"), () => throw new ExceptionWithConfigData("Login Failed", configData));
|
||||||
throw new ExceptionWithConfigData("Login Failed", configData));
|
|
||||||
return IndexerConfigurationStatus.RequiresTesting;
|
return IndexerConfigurationStatus.RequiresTesting;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -32,7 +32,6 @@ namespace Jackett.Common.Indexers
|
|||||||
private string SearchUrl => SiteLink + "search";
|
private string SearchUrl => SiteLink + "search";
|
||||||
private string TorrentsUrl => SiteLink + "torrents";
|
private string TorrentsUrl => SiteLink + "torrents";
|
||||||
private string ShowUrl => SiteLink + "show";
|
private string ShowUrl => SiteLink + "show";
|
||||||
private string RSSProfile => SiteLink + "rss_feeds";
|
|
||||||
|
|
||||||
private new ConfigurationDataShazbat configData => (ConfigurationDataShazbat)base.configData;
|
private new ConfigurationDataShazbat configData => (ConfigurationDataShazbat)base.configData;
|
||||||
|
|
||||||
@@ -87,16 +86,6 @@ namespace Jackett.Common.Indexers
|
|||||||
throw new ExceptionWithConfigData("The username and password entered do not match.", configData);
|
throw new ExceptionWithConfigData("The username and password entered do not match.", configData);
|
||||||
});
|
});
|
||||||
|
|
||||||
var rssProfile = await RequestWithCookiesAndRetryAsync(RSSProfile);
|
|
||||||
var parser = new HtmlParser();
|
|
||||||
var rssDom = parser.ParseDocument(rssProfile.ContentString);
|
|
||||||
|
|
||||||
configData.RSSKey.Value = rssDom.QuerySelector(".col-sm-9:nth-of-type(1)")?.TextContent.Trim();
|
|
||||||
if (string.IsNullOrWhiteSpace(configData.RSSKey.Value))
|
|
||||||
throw new ExceptionWithConfigData("Failed to find RSS key.", configData);
|
|
||||||
|
|
||||||
SaveConfig();
|
|
||||||
|
|
||||||
return IndexerConfigurationStatus.RequiresTesting;
|
return IndexerConfigurationStatus.RequiresTesting;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -36,9 +36,9 @@ namespace Jackett.Common.Indexers
|
|||||||
{"Content-Type", "application/json"}
|
{"Content-Type", "application/json"}
|
||||||
};
|
};
|
||||||
|
|
||||||
private new ConfigurationDataBasicLoginWithRSSAndDisplay configData
|
private new ConfigurationDataBasicLogin configData
|
||||||
{
|
{
|
||||||
get => (ConfigurationDataBasicLoginWithRSSAndDisplay)base.configData;
|
get => (ConfigurationDataBasicLogin)base.configData;
|
||||||
set => base.configData = value;
|
set => base.configData = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ namespace Jackett.Common.Indexers
|
|||||||
logger: l,
|
logger: l,
|
||||||
p: ps,
|
p: ps,
|
||||||
cacheService: cs,
|
cacheService: cs,
|
||||||
configData: new ConfigurationDataBasicLoginWithRSSAndDisplay())
|
configData: new ConfigurationDataBasicLogin())
|
||||||
{
|
{
|
||||||
configData.AddDynamic("token", new HiddenStringConfigurationItem("token"));
|
configData.AddDynamic("token", new HiddenStringConfigurationItem("token"));
|
||||||
configData.AddDynamic("passkey", new HiddenStringConfigurationItem("passkey"));
|
configData.AddDynamic("passkey", new HiddenStringConfigurationItem("passkey"));
|
||||||
|
@@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
|
|||||||
namespace Jackett.Common.Models.IndexerConfig.Bespoke
|
namespace Jackett.Common.Models.IndexerConfig.Bespoke
|
||||||
{
|
{
|
||||||
[ExcludeFromCodeCoverage]
|
[ExcludeFromCodeCoverage]
|
||||||
internal class ConfigurationDataShazbat : ConfigurationDataBasicLoginWithRSS
|
internal class ConfigurationDataShazbat : ConfigurationDataBasicLogin
|
||||||
{
|
{
|
||||||
public SingleSelectConfigurationItem ShowPagesFetchLimit { get; private set; }
|
public SingleSelectConfigurationItem ShowPagesFetchLimit { get; private set; }
|
||||||
|
|
||||||
|
@@ -1,16 +0,0 @@
|
|||||||
namespace Jackett.Common.Models.IndexerConfig
|
|
||||||
{
|
|
||||||
public class ConfigurationDataBasicLoginWithRSS : ConfigurationData
|
|
||||||
{
|
|
||||||
public StringConfigurationItem Username { get; private set; }
|
|
||||||
public StringConfigurationItem Password { get; private set; }
|
|
||||||
public HiddenStringConfigurationItem RSSKey { get; private set; }
|
|
||||||
|
|
||||||
public ConfigurationDataBasicLoginWithRSS()
|
|
||||||
{
|
|
||||||
Username = new StringConfigurationItem("Username");
|
|
||||||
Password = new StringConfigurationItem("Password");
|
|
||||||
RSSKey = new HiddenStringConfigurationItem("RSSKey");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,18 +0,0 @@
|
|||||||
namespace Jackett.Common.Models.IndexerConfig
|
|
||||||
{
|
|
||||||
public class ConfigurationDataBasicLoginWithRSSAndDisplay : ConfigurationData
|
|
||||||
{
|
|
||||||
public StringConfigurationItem Username { get; private set; }
|
|
||||||
public StringConfigurationItem Password { get; private set; }
|
|
||||||
public HiddenStringConfigurationItem RSSKey { get; private set; }
|
|
||||||
public DisplayInfoConfigurationItem Instructions { get; private set; }
|
|
||||||
|
|
||||||
public ConfigurationDataBasicLoginWithRSSAndDisplay(string instructionMessageOptional = null)
|
|
||||||
{
|
|
||||||
Username = new StringConfigurationItem("Username");
|
|
||||||
Password = new StringConfigurationItem("Password");
|
|
||||||
RSSKey = new HiddenStringConfigurationItem("RSSKey");
|
|
||||||
Instructions = new DisplayInfoConfigurationItem("", instructionMessageOptional);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Reference in New Issue
Block a user