Your ROOT_URL in app.ini is https://git.cloudchain.link/ but you are visiting https://dash.bss.nz/open-source-mirrors/Prowlarr/commit/cb2ed7daf9c64725ef7ce547cc5ce6c9c7312b9c?style=unified&whitespace=show-all
You should set ROOT_URL correctly, otherwise the web may not work correctly.
17 changed files with
59 additions and
49 deletions
@ -39,9 +39,9 @@ namespace NzbDrone.Core.Download.Clients.Pneumatic
_logger . Debug ( "Downloading NZB from: {0} to: {1}" , url , nzbFile ) ;
var nzbData = await indexer . Download ( url ) ;
var downloadResponse = await indexer . Download ( url ) ;
File . WriteAllBytes ( nzbFile , nzb Data) ;
await File . WriteAllBytesAsync ( nzbFile , downloadResponse . Data) ;
_logger . Debug ( "NZB Download succeeded, saved to: {0}" , nzbFile ) ;
@ -1,5 +1,4 @@
using System ;
using System.Diagnostics ;
using System.Threading.Tasks ;
using NLog ;
using NzbDrone.Common.Http ;
@ -74,9 +73,6 @@ namespace NzbDrone.Core.Download
GrabTrigger = source = = "Prowlarr" ? GrabTrigger . Manual : GrabTrigger . Api
} ;
var sw = new Stopwatch ( ) ;
sw . Start ( ) ;
string downloadClientId ;
try
{
@ -115,11 +111,6 @@ namespace NzbDrone.Core.Download
throw ;
}
finally
{
sw . Stop ( ) ;
grabEvent . ElapsedTime = sw . ElapsedMilliseconds ;
}
_logger . ProgressInfo ( "Report sent to {0}. {1}" , downloadClient . Definition . Name , downloadTitle ) ;
@ -153,16 +144,15 @@ namespace NzbDrone.Core.Download
GrabTrigger = source = = "Prowlarr" ? GrabTrigger . Manual : GrabTrigger . Api
} ;
var sw = new Stopwatch ( ) ;
sw . Start ( ) ;
byte [ ] downloadedBytes ;
try
{
downloadedBytes = await indexer . Download ( url ) ;
var downloadResponse = await indexer . Download ( url ) ;
downloadedBytes = downloadResponse . Data ;
_indexerStatusService . RecordSuccess ( indexerId ) ;
grabEvent . Successful = true ;
grabEvent . ElapsedTime = downloadResponse . ElapsedTime ;
}
catch ( ReleaseUnavailableException )
{
@ -184,11 +174,6 @@ namespace NzbDrone.Core.Download
_eventAggregator . PublishEvent ( grabEvent ) ;
throw ;
}
finally
{
sw . Stop ( ) ;
grabEvent . ElapsedTime = sw . ElapsedMilliseconds ;
}
_logger . Trace ( "Downloaded {0} bytes from {1}" , downloadedBytes . Length , link ) ;
_eventAggregator . PublishEvent ( grabEvent ) ;
@ -127,9 +127,8 @@ namespace NzbDrone.Core.Download
private async Task < string > DownloadFromWebUrl ( TorrentInfo release , IIndexer indexer , string torrentUrl )
{
byte [ ] torrentFile = null ;
torrentFile = await indexer . Download ( new Uri ( torrentUrl ) ) ;
var downloadResponse = await indexer . Download ( new Uri ( torrentUrl ) ) ;
var torrentFile = downloadResponse . Data ;
// handle magnet URLs
if ( torrentFile . Length > = 7
@ -41,12 +41,10 @@ namespace NzbDrone.Core.Download
var filename = StringUtil . CleanFileName ( release . Title ) + ".nzb" ;
byte [ ] nzbData ;
nzbData = await indexer . Download ( url ) ;
var downloadResponse = await indexer . Download ( url ) ;
_logger . Info ( "Adding report [{0}] to the queue." , release . Title ) ;
return AddFromNzbFile ( release , filename , nzb Data) ;
return AddFromNzbFile ( release , filename , downloadResponse. Data) ;
}
}
}
@ -205,7 +205,11 @@ namespace NzbDrone.Core.History
history . Data . Add ( "GrabMethod" , message . Redirect ? "Redirect" : "Proxy" ) ;
history . Data . Add ( "GrabTitle" , message . Title ) ;
history . Data . Add ( "Url" , message . Url ? ? string . Empty ) ;
history . Data . Add ( "ElapsedTime" , message . ElapsedTime . ToString ( ) ) ;
if ( message . ElapsedTime > 0 )
{
history . Data . Add ( "ElapsedTime" , message . ElapsedTime . ToString ( ) ) ;
}
if ( message . Release . InfoUrl . IsNotNullOrWhiteSpace ( ) )
{
@ -46,7 +46,7 @@ namespace NzbDrone.Core.Indexers.Definitions
return new BakaBTParser ( Settings , Capabilities . Categories ) ;
}
public override async Task < byte [ ] > Download ( Uri link )
public override async Task < IndexerDownloadResponse > Download ( Uri link )
{
var request = new HttpRequestBuilder ( link . ToString ( ) )
. SetCookies ( GetCookies ( ) ? ? new Dictionary < string , string > ( ) )
@ -82,9 +82,10 @@ public abstract class GazelleBase<TSettings> : TorrentIndexerBase<TSettings>
protected virtual bool CheckForLoginError ( HttpResponse response ) = > true ;
public override async Task < byte [ ] > Download ( Uri link )
public override async Task < IndexerDownloadResponse > Download ( Uri link )
{
var response = await base . Download ( link ) ;
var downloadResponse = await base . Download ( link ) ;
var response = downloadResponse . Data ;
if ( response . Length > = 1
& & response [ 0 ] ! = 'd' // simple test for torrent vs HTML content
@ -99,11 +100,11 @@ public abstract class GazelleBase<TSettings> : TorrentIndexerBase<TSettings>
// download again without usetoken=1
var requestLinkNew = link . ToString ( ) . Replace ( "&usetoken=1" , "" ) ;
r esponse = await base . Download ( new Uri ( requestLinkNew ) ) ;
downloadR esponse = await base . Download ( new Uri ( requestLinkNew ) ) ;
}
}
return r esponse;
return downloadR esponse;
}
protected override IDictionary < string , string > GetCookies ( )
@ -50,28 +50,33 @@ namespace NzbDrone.Core.Indexers.Headphones
}
}
public override async Task < byte [ ] > Download ( Uri link )
public override async Task < IndexerDownloadResponse > Download ( Uri link )
{
var requestBuilder = new HttpRequestBuilder ( link . AbsoluteUri ) ;
var downloadBytes = Array . Empty < byte > ( ) ;
var request = requestBuilder . Build ( ) ;
request . Credentials = new BasicNetworkCredential ( Settings . Username , Settings . Password ) ;
byte [ ] downloadBytes ;
long elapsedTime ;
try
{
var response = await _httpClient . ExecuteProxiedAsync ( request , Definition ) ;
downloadBytes = response . ResponseData ;
elapsedTime = response . ElapsedTime ;
}
catch ( Exception )
{
_indexerStatusService . RecordFailure ( Definition . Id ) ;
_logger . Error ( "Download failed" ) ;
throw ;
}
return downloadBytes ;
ValidateDownloadData ( downloadBytes ) ;
return new IndexerDownloadResponse ( downloadBytes , elapsedTime ) ;
}
private IndexerCapabilities SetCapabilities ( )
@ -59,7 +59,7 @@ public class MTeamTp : TorrentIndexerBase<MTeamTpSettings>
return new MTeamTpParser ( Settings , Capabilities . Categories , BuildApiUrl ( Settings ) ) ;
}
public override async Task < byte [ ] > Download ( Uri link )
public override async Task < IndexerDownloadResponse > Download ( Uri link )
{
var request = new HttpRequestBuilder ( link . ToString ( ) )
. SetHeader ( "x-api-key" , Settings . ApiKey )
@ -53,7 +53,7 @@ namespace NzbDrone.Core.Indexers.Definitions
return new MyAnonamouseParser ( Settings , Capabilities . Categories , _httpClient , _cacheManager , _logger ) ;
}
public override async Task < byte [ ] > Download ( Uri link )
public override async Task < IndexerDownloadResponse > Download ( Uri link )
{
if ( Settings . Freeleech )
{
@ -89,18 +89,20 @@ namespace NzbDrone.Core.Indexers.Definitions
return caps ;
}
public override async Task < byte [ ] > Download ( Uri link )
public override async Task < IndexerDownloadResponse > Download ( Uri link )
{
var request = new HttpRequestBuilder ( link . AbsoluteUri )
. SetHeader ( "Authorization" , $"token {Settings.Apikey}" )
. Build ( ) ;
var downloadBytes = Array . Empty < byte > ( ) ;
byte [ ] downloadBytes ;
long elapsedTime ;
try
{
var response = await _httpClient . ExecuteProxiedAsync ( request , Definition ) ;
downloadBytes = response . ResponseData ;
elapsedTime = response . ElapsedTime ;
if ( downloadBytes . Length > = 1
& & downloadBytes [ 0 ] ! = 'd' // simple test for torrent vs HTML content
@ -124,11 +126,12 @@ namespace NzbDrone.Core.Indexers.Definitions
{
_indexerStatusService . RecordFailure ( Definition . Id ) ;
_logger . Error ( "Download failed" ) ;
throw ;
}
ValidateDownloadData ( downloadBytes ) ;
return downloadBytes ;
return new IndexerDownloadResponse ( downloadBytes , elapsedTime ) ;
}
}
@ -51,7 +51,7 @@ namespace NzbDrone.Core.Indexers.Definitions
return new RuTrackerParser ( Settings , Capabilities . Categories ) ;
}
public override async Task < byte [ ] > Download ( Uri link )
public override async Task < IndexerDownloadResponse > Download ( Uri link )
{
if ( Settings . UseMagnetLinks & & link . PathAndQuery . Contains ( "viewtopic.php?t=" ) )
{
@ -82,7 +82,7 @@ public class Uniotaku : TorrentIndexerBase<UniotakuSettings>
return ! httpResponse . GetCookies ( ) . ContainsKey ( "uid" ) | | ! httpResponse . GetCookies ( ) . ContainsKey ( "pass" ) ;
}
public override async Task < byte [ ] > Download ( Uri link )
public override async Task < IndexerDownloadResponse > Download ( Uri link )
{
var request = new HttpRequestBuilder ( link . ToString ( ) )
. SetCookies ( GetCookies ( ) ? ? new Dictionary < string , string > ( ) )
@ -224,7 +224,7 @@ namespace NzbDrone.Core.Indexers
return FetchReleases ( g = > SetCookieFunctions ( g ) . GetSearchRequests ( searchCriteria ) , searchCriteria ) ;
}
public override async Task < byte [ ] > Download ( Uri link )
public override async Task < IndexerDownloadResponse > Download ( Uri link )
{
Cookies = GetCookies ( ) ;
@ -233,7 +233,7 @@ namespace NzbDrone.Core.Indexers
if ( request . Url . Scheme = = "magnet" )
{
ValidateMagnet ( request . Url . FullUri ) ;
return Encoding . UTF8 . GetBytes ( request . Url . FullUri ) ;
return new IndexerDownloadResponse ( Encoding . UTF8 . GetBytes ( request . Url . FullUri ) ) ;
}
if ( request . RateLimit < RateLimit )
@ -244,6 +244,7 @@ namespace NzbDrone.Core.Indexers
request . AllowAutoRedirect = false ;
byte [ ] fileData ;
long elapsedTime ;
try
{
@ -283,6 +284,7 @@ namespace NzbDrone.Core.Indexers
}
fileData = response . ResponseData ;
elapsedTime = response . ElapsedTime ;
_logger . Debug ( "Downloaded for release finished ({0} bytes from {1})" , fileData . Length , link . AbsoluteUri ) ;
}
@ -320,7 +322,7 @@ namespace NzbDrone.Core.Indexers
ValidateDownloadData ( fileData ) ;
return fileData ;
return new IndexerDownloadResponse ( fileData , elapsedTime ) ;
}
protected virtual Task < HttpRequest > GetDownloadRequest ( Uri link )
@ -28,7 +28,7 @@ namespace NzbDrone.Core.Indexers
Task < IndexerPageableQueryResult > Fetch ( BookSearchCriteria searchCriteria ) ;
Task < IndexerPageableQueryResult > Fetch ( BasicSearchCriteria searchCriteria ) ;
Task < byte [ ] > Download ( Uri link ) ;
Task < IndexerDownloadResponse > Download ( Uri link ) ;
bool IsObsolete ( ) ;
IndexerCapabilities GetCapabilities ( ) ;
@ -97,7 +97,7 @@ namespace NzbDrone.Core.Indexers
public abstract Task < IndexerPageableQueryResult > Fetch ( TvSearchCriteria searchCriteria ) ;
public abstract Task < IndexerPageableQueryResult > Fetch ( BookSearchCriteria searchCriteria ) ;
public abstract Task < IndexerPageableQueryResult > Fetch ( BasicSearchCriteria searchCriteria ) ;
public abstract Task < byte [ ] > Download ( Uri link ) ;
public abstract Task < IndexerDownloadResponse > Download ( Uri link ) ;
public abstract IndexerCapabilities GetCapabilities ( ) ;
@ -0,0 +1,13 @@
namespace NzbDrone.Core.Indexers ;
public class IndexerDownloadResponse
{
public byte [ ] Data { get ; private set ; }
public long ElapsedTime { get ; private set ; }
public IndexerDownloadResponse ( byte [ ] data , long elapsedTime = 0 )
{
Data = data ;
ElapsedTime = elapsedTime ;
}
}