mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
#### Version - 2.5.3.21 - 6/9/2022
* Fix a bug in the streaming MediaFire downloader * Improve the reliability of MediaFire, and Manual downloaders * Improve logging around the Wabbajack CDN
This commit is contained in:
parent
2ea33bc211
commit
440de5e277
@ -1,5 +1,10 @@
|
||||
### Changelog
|
||||
|
||||
#### Version - 2.5.3.21 - 6/9/2022
|
||||
* Fix a bug in the streaming MediaFire downloader
|
||||
* Improve the reliability of MediaFire, and Manual downloaders
|
||||
* Improve logging around the Wabbajack CDN
|
||||
|
||||
#### Version - 2.5.3.20 - 6/8/2022
|
||||
* Improve reliability of MediaFire, Mega and GDrive downloaders
|
||||
|
||||
|
@ -111,7 +111,8 @@ public class MediaFireDownloader : ADownloader<DTOs.DownloadStates.MediaFire>, I
|
||||
StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var bodyData = await result.Content.ReadAsStringAsync((CancellationToken) token);
|
||||
await job.Report((int) job.Size, (CancellationToken) token);
|
||||
if (job != null)
|
||||
await job.Report((int) job.Size, (CancellationToken) token);
|
||||
var body = new HtmlDocument();
|
||||
body.LoadHtml(bodyData);
|
||||
var node = body.DocumentNode.DescendantsAndSelf().First(d => d.HasClass("input") && d.HasClass("popsok") &&
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
@ -11,13 +12,14 @@ using Wabbajack.DTOs;
|
||||
using Wabbajack.DTOs.DownloadStates;
|
||||
using Wabbajack.DTOs.Validation;
|
||||
using Wabbajack.Hashing.xxHash64;
|
||||
using Wabbajack.Networking.Http;
|
||||
using Wabbajack.Networking.Http.Interfaces;
|
||||
using Wabbajack.Paths;
|
||||
using Wabbajack.RateLimiter;
|
||||
|
||||
namespace Wabbajack.Downloaders.ModDB;
|
||||
|
||||
public class ModDBDownloader : ADownloader<DTOs.DownloadStates.ModDB>, IUrlDownloader
|
||||
public class ModDBDownloader : ADownloader<DTOs.DownloadStates.ModDB>, IUrlDownloader, IProxyable
|
||||
{
|
||||
private readonly IHttpDownloader _downloader;
|
||||
private readonly HttpClient _httpClient;
|
||||
@ -70,6 +72,29 @@ public class ModDBDownloader : ADownloader<DTOs.DownloadStates.ModDB>, IUrlDownl
|
||||
return ((DTOs.DownloadStates.ModDB) state).Url;
|
||||
}
|
||||
|
||||
public async Task<T> DownloadStream<T>(Archive archive, Func<Stream, Task<T>> fn, CancellationToken token)
|
||||
{
|
||||
var state = archive.State as DTOs.DownloadStates.ModDB;
|
||||
var url = (await GetDownloadUrls(state!)).First();
|
||||
try
|
||||
{
|
||||
var msg = new HttpRequestMessage
|
||||
{
|
||||
Method = HttpMethod.Get,
|
||||
RequestUri = new Uri(url)
|
||||
};
|
||||
using var response = await _httpClient.SendAsync(msg, token);
|
||||
HttpException.ThrowOnFailure(response);
|
||||
await using var stream = await response.Content.ReadAsStreamAsync(token);
|
||||
return await fn(stream);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "While downloading from ModDB");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public override async Task<Hash> Download(Archive archive, DTOs.DownloadStates.ModDB state,
|
||||
AbsolutePath destination, IJob job, CancellationToken token)
|
||||
{
|
||||
|
@ -8,6 +8,7 @@
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Wabbajack.Downloaders.Interfaces\Wabbajack.Downloaders.Interfaces.csproj" />
|
||||
<ProjectReference Include="..\Wabbajack.Networking.Http.Interfaces\Wabbajack.Networking.Http.Interfaces.csproj" />
|
||||
<ProjectReference Include="..\Wabbajack.Networking.Http\Wabbajack.Networking.Http.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
Loading…
Reference in New Issue
Block a user