Fixed: Set Token for PHD after re-auth

pull/30/head
Qstick 4 years ago
parent 31b13345c7
commit acbb6e3549

@ -77,6 +77,12 @@ namespace NzbDrone.Core.Indexers.Definitions.Avistaz
return false; return false;
} }
protected override void ModifyRequest(IndexerRequest request)
{
request.HttpRequest.Headers.Set("Authorization", $"Bearer {Settings.Token}");
base.ModifyRequest(request);
}
protected override async Task<ValidationFailure> TestConnection() protected override async Task<ValidationFailure> TestConnection()
{ {
try try

@ -25,7 +25,7 @@ namespace NzbDrone.Core.Indexers.Definitions.Avistaz
public int Seed { get; set; } public int Seed { get; set; }
[JsonProperty(PropertyName = "file_size")] [JsonProperty(PropertyName = "file_size")]
public int FileSize { get; set; } public long FileSize { get; set; }
[JsonProperty(PropertyName = "file_count")] [JsonProperty(PropertyName = "file_count")]
public int FileCount { get; set; } public int FileCount { get; set; }

@ -47,11 +47,6 @@ namespace NzbDrone.Core.Indexers.Definitions.Avistaz
} }
var jsonResponse = new HttpResponse<AvistazResponse>(indexerResponse.HttpResponse); var jsonResponse = new HttpResponse<AvistazResponse>(indexerResponse.HttpResponse);
if (jsonResponse.Resource.Status != "success" ||
jsonResponse.Resource.Status.IsNullOrWhiteSpace())
{
return torrentInfos;
}
foreach (var row in jsonResponse.Resource.Data) foreach (var row in jsonResponse.Resource.Data)
{ {

@ -409,6 +409,19 @@ namespace NzbDrone.Core.Indexers
return Task.CompletedTask; return Task.CompletedTask;
} }
protected virtual void ModifyRequest(IndexerRequest request)
{
request.HttpRequest.Cookies.Clear();
if (Cookies != null)
{
foreach (var cookie in Cookies)
{
request.HttpRequest.Cookies.Add(cookie.Key, cookie.Value);
}
}
}
protected virtual async Task<IndexerResponse> FetchIndexerResponse(IndexerRequest request) protected virtual async Task<IndexerResponse> FetchIndexerResponse(IndexerRequest request)
{ {
_logger.Debug("Downloading Feed " + request.HttpRequest.ToString(false)); _logger.Debug("Downloading Feed " + request.HttpRequest.ToString(false));
@ -448,15 +461,8 @@ namespace NzbDrone.Core.Indexers
_logger.Trace("Attempting to re-auth based on indexer search response"); _logger.Trace("Attempting to re-auth based on indexer search response");
await DoLogin(); await DoLogin();
request.HttpRequest.Cookies.Clear();
if (Cookies != null) ModifyRequest(request);
{
foreach (var cookie in Cookies)
{
request.HttpRequest.Cookies.Add(cookie.Key, cookie.Value);
}
}
response = await _httpClient.ExecuteAsync(request.HttpRequest); response = await _httpClient.ExecuteAsync(request.HttpRequest);
} }

Loading…
Cancel
Save