mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
LostFilm.tv: Perform logout before logging in to invalidate session and fix "error":1 response (#2083)
This commit is contained in:

committed by
flightlevel

parent
1d1259e8eb
commit
969c365a64
@@ -105,6 +105,9 @@ namespace Jackett.Indexers
|
|||||||
logger.Debug("Applying configuration");
|
logger.Debug("Applying configuration");
|
||||||
LoadValuesFromJson(configJson);
|
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>
|
var data = new Dictionary<string, string>
|
||||||
{
|
{
|
||||||
{ "act", "users" },
|
{ "act", "users" },
|
||||||
@@ -124,6 +127,30 @@ namespace Jackett.Indexers
|
|||||||
return IndexerConfigurationStatus.RequiresTesting;
|
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)
|
protected override async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
|
||||||
{
|
{
|
||||||
logger.Debug("PerformQuery: " + query.GetQueryString());
|
logger.Debug("PerformQuery: " + query.GetQueryString());
|
||||||
@@ -278,6 +305,7 @@ namespace Jackett.Indexers
|
|||||||
return releases;
|
return releases;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
#region Page parsing
|
#region Page parsing
|
||||||
|
|
||||||
private async Task<List<ReleaseInfo>> FetchNewReleases()
|
private async Task<List<ReleaseInfo>> FetchNewReleases()
|
||||||
|
Reference in New Issue
Block a user