mirror of
https://github.com/Jackett/Jackett
synced 2025-01-02 21:26:08 +00:00
LostFilm.tv: Perform logout before logging in to invalidate session and fix "error":1 response (#2083)
This commit is contained in:
parent
1d1259e8eb
commit
969c365a64
1 changed files with 28 additions and 0 deletions
|
@ -105,6 +105,9 @@ namespace Jackett.Indexers
|
|||
logger.Debug("Applying configuration");
|
||||
LoadValuesFromJson(configJson);
|
||||
|
||||
// Performing Logout is required to invalidate previous session otherwise the `{"error":1,"result":"ok"}` will be returned.
|
||||
await Logout();
|
||||
|
||||
var data = new Dictionary<string, string>
|
||||
{
|
||||
{ "act", "users" },
|
||||
|
@ -124,6 +127,30 @@ namespace Jackett.Indexers
|
|||
return IndexerConfigurationStatus.RequiresTesting;
|
||||
}
|
||||
|
||||
private async Task<Boolean> Logout()
|
||||
{
|
||||
logger.Info("Performing logout");
|
||||
|
||||
var data = new Dictionary<string, string>
|
||||
{
|
||||
{ "act", "users" },
|
||||
{ "type", "logout" }
|
||||
};
|
||||
|
||||
var response = await PostDataWithCookies(url: ApiUrl, data: data);
|
||||
logger.Debug("Logout result: " + response.Content);
|
||||
|
||||
var isOK = response.Status == System.Net.HttpStatusCode.OK;
|
||||
if (!isOK)
|
||||
{
|
||||
logger.Error("Logout failed with response: " + response.Content);
|
||||
}
|
||||
|
||||
return isOK;
|
||||
}
|
||||
|
||||
#region Query
|
||||
|
||||
protected override async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
|
||||
{
|
||||
logger.Debug("PerformQuery: " + query.GetQueryString());
|
||||
|
@ -278,6 +305,7 @@ namespace Jackett.Indexers
|
|||
return releases;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region Page parsing
|
||||
|
||||
private async Task<List<ReleaseInfo>> FetchNewReleases()
|
||||
|
|
Loading…
Reference in a new issue