Abstracted & unified indexer config logic (logins are now saved), implemented indexer config migrations, fixed nCore implementation

This commit is contained in:
unknown
2015-08-03 15:38:45 -06:00
parent 5dc7ebaba5
commit 0a8d9d3447
54 changed files with 869 additions and 740 deletions

View File

@@ -14,6 +14,7 @@ using Jackett.Utils;
using NLog;
using Jackett.Services;
using Jackett.Utils.Clients;
using Jackett.Models.IndexerConfig;
namespace Jackett.Indexers
{
@@ -31,16 +32,12 @@ namespace Jackett.Indexers
caps: TorznabCapsUtil.CreateDefaultTorznabTVCaps(),
manager: i,
client: w,
logger: l)
logger: l,
configData: new ConfigurationDataBasicLogin())
{
webclient = w;
}
public Task<ConfigurationData> GetConfigurationForSetup()
{
return Task.FromResult<ConfigurationData>(new ConfigurationDataBasicLogin());
}
public async Task ApplyConfiguration(JToken configJson)
{
var incomingConfig = new ConfigurationDataBasicLogin();
@@ -54,13 +51,13 @@ namespace Jackett.Indexers
// Do the login
var response = await RequestLoginAndFollowRedirect(LoginUrl, pairs, string.Empty, true, SiteLink);
await ConfigureIfOK(response.Cookies, response.Content!=null && response.Content.Contains("logout.php?"), () =>
{
CQ dom = response.Content;
dom["#loginform > table"].Remove();
var errorMessage = dom["#loginform"].Text().Trim().Replace("\n\t", " ");
throw new ExceptionWithConfigData(errorMessage, (ConfigurationData)incomingConfig);
});
await ConfigureIfOK(response.Cookies, response.Content != null && response.Content.Contains("logout.php?"), () =>
{
CQ dom = response.Content;
dom["#loginform > table"].Remove();
var errorMessage = dom["#loginform"].Text().Trim().Replace("\n\t", " ");
throw new ExceptionWithConfigData(errorMessage, (ConfigurationData)incomingConfig);
});
}
void FillReleaseInfoFromJson(ReleaseInfo release, JObject r)