mirror of
https://github.com/Jackett/Jackett
synced 2025-01-01 12:46:23 +00:00
[ShizaProject] Implement auto re-auth on cookie expire (#10429)
This commit is contained in:
parent
dda3f033aa
commit
a820b318b2
1 changed files with 4 additions and 5 deletions
|
@ -69,7 +69,7 @@ namespace Jackett.Common.Indexers
|
|||
var result = await RequestLoginAndFollowRedirect(
|
||||
LoginUrl,
|
||||
data,
|
||||
CookieHeader,
|
||||
null,
|
||||
returnCookiesFromFirstCall: true
|
||||
);
|
||||
|
||||
|
@ -93,6 +93,8 @@ namespace Jackett.Common.Indexers
|
|||
|
||||
// If the search string is empty use the latest releases
|
||||
protected override async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query) {
|
||||
await EnsureAuthorized();
|
||||
|
||||
WebResult result;
|
||||
if (query.IsTest || string.IsNullOrWhiteSpace(query.SearchTerm)) {
|
||||
result = await RequestWithCookiesAndRetryAsync(SiteLink);
|
||||
|
@ -106,7 +108,6 @@ namespace Jackett.Common.Indexers
|
|||
}
|
||||
|
||||
const string ReleaseLinksSelector = "article.grid-card > a.card-box";
|
||||
|
||||
var releases = new List<ReleaseInfo>();
|
||||
|
||||
try
|
||||
|
@ -191,9 +192,7 @@ namespace Jackett.Common.Indexers
|
|||
|
||||
// Appending id to differentiate between different quality versions
|
||||
private bool IsAuthorized(WebResult result) {
|
||||
var parser = new HtmlParser();
|
||||
var document = parser.ParseDocument(result.ContentString);
|
||||
return document.QuerySelector("div.profile-menu > a").Attributes["href"].Value.EndsWith("/logout");
|
||||
return result.ContentString.Contains("/logout");
|
||||
}
|
||||
|
||||
private static long getReleaseSize(IElement tr)
|
||||
|
|
Loading…
Reference in a new issue