Fix issues with mirrored files

This commit is contained in:
halgari 2020-08-25 22:03:43 -06:00
parent 496a35a605
commit c5d56c27a8
13 changed files with 27 additions and 16 deletions

View File

@ -1,6 +1,9 @@
### Changelog
#### Version - 2.2.1.6 - 8/21/2020
#### Version - 2.2.1.7 - 8/25/2020
* HOTFIX - Fix 404 errors with mirrors
#### Version - 2.2.1.6 - 8/24/2020
* HOTFIX - Make LoversLab auto-update work again
* HOTFIX - Fix for "End of Stream before End of Limit" symptom on BSA extraction

View File

@ -6,8 +6,8 @@
<AssemblyName>wabbajack-cli</AssemblyName>
<Company>Wabbajack</Company>
<Platforms>x64</Platforms>
<AssemblyVersion>2.2.1.6</AssemblyVersion>
<FileVersion>2.2.1.6</FileVersion>
<AssemblyVersion>2.2.1.7</AssemblyVersion>
<FileVersion>2.2.1.7</FileVersion>
<Copyright>Copyright © 2019-2020</Copyright>
<Description>An automated ModList installer</Description>
<PublishReadyToRun>true</PublishReadyToRun>

View File

@ -4,8 +4,8 @@
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UseWPF>true</UseWPF>
<AssemblyVersion>2.2.1.6</AssemblyVersion>
<FileVersion>2.2.1.6</FileVersion>
<AssemblyVersion>2.2.1.7</AssemblyVersion>
<FileVersion>2.2.1.7</FileVersion>
<Copyright>Copyright © 2019-2020</Copyright>
<Description>Wabbajack Application Launcher</Description>
<PublishReadyToRun>true</PublishReadyToRun>

View File

@ -246,7 +246,7 @@ namespace Wabbajack.Lib
try
{
var result =
await client.GetStringAsync($"{Consts.WabbajackBuildServerUri}/mirror/{archiveHash.ToHex()}");
await client.GetStringAsync($"{Consts.WabbajackBuildServerUri}mirror/{archiveHash.ToHex()}");
return new Uri(result);
}
catch (HttpException ex)

View File

@ -195,7 +195,7 @@ namespace Wabbajack.Lib.Downloaders
if (headerVar != null)
long.TryParse(headerVar, out headerContentSize);
}
if (a.Size != 0 && headerContentSize != 0 && a.Size != headerContentSize)
{
Utils.Log($"Bad Header Content sizes {a.Size} vs {headerContentSize}");
@ -248,8 +248,9 @@ namespace Wabbajack.Lib.Downloaders
foreach (var newFile in files.OrderBy(f => nl.Distance(a.Name.ToLowerInvariant(), f.Name.ToLowerInvariant())))
{
/*
var existing = await downloadResolver(newFile);
if (existing != default) return (newFile, new TempFile());
if (existing != default) return (newFile, new TempFile());*/
var tmp = new TempFile();
await DownloadDispatcher.PrepareAll(new[] {newFile.State});

View File

@ -1,4 +1,5 @@
using System;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Dapper;
using Wabbajack.Lib;
@ -30,7 +31,8 @@ namespace Wabbajack.BuildServer.Test
Assert.Equal(subject, result);
var report = await _client.GetJsonAsync<MetricResult[]>(MakeURL($"metrics/report/{action}"));
using var response = await _client.GetAsync(MakeURL($"metrics/report/{action}"));
Assert.Equal(TimeSpan.FromHours(1), response.Headers.CacheControl.MaxAge);
// we'll just make sure this doesn't error, with limited data that's about all we can do atm
}

View File

@ -165,6 +165,7 @@ namespace Wabbajack.BuildServer.Controllers
[HttpGet]
[Route("status/{Name}.json")]
[ResponseCache(Duration = 60 * 5)]
public async Task<IActionResult> HandleGetListJson(string Name)
{
return Ok((await DetailedStatus(Name)).ToJson());

View File

@ -40,6 +40,7 @@ namespace Wabbajack.BuildServer.Controllers
[HttpGet]
[Route("report/{subject}")]
[ResponseCache(Duration = 60 * 60)]
public async Task<IActionResult> MetricsReport(string subject)
{
var results = (await _sql.MetricsReport(subject))

View File

@ -23,6 +23,7 @@ namespace Wabbajack.BuildServer.Controllers
private AppSettings _settings;
private QuickSync _quickSync;
private Task<BunnyCdnFtpInfo> _creds;
private Task<BunnyCdnFtpInfo> _mirrorCreds;
public ModUpgrade(ILogger<ModUpgrade> logger, SqlService sql, DiscordWebHook discord, QuickSync quickSync, AppSettings settings)
{
@ -32,6 +33,7 @@ namespace Wabbajack.BuildServer.Controllers
_settings = settings;
_quickSync = quickSync;
_creds = BunnyCdnFtpInfo.GetCreds(StorageSpace.Patches);
_mirrorCreds = BunnyCdnFtpInfo.GetCreds(StorageSpace.Mirrors);
}
[HttpPost]
@ -152,7 +154,7 @@ namespace Wabbajack.BuildServer.Controllers
public async Task<IActionResult> HaveHash(string hashAsHex)
{
var result = await _sql.HaveMirror(Hash.FromHex(hashAsHex));
if (result) return Ok($"https://{(await _creds).Username}.b-cdn.net/{hashAsHex}");
if (result) return Ok($"https://{(await _mirrorCreds).Username}.b-cdn.net/{hashAsHex}");
return NotFound("Not Mirrored");
}

View File

@ -80,7 +80,7 @@ namespace Wabbajack.Server.DataLayer
{
await using var conn = await Open();
return await conn.QueryFirstOrDefaultAsync<Hash>("SELECT Hash FROM dbo.MirroredFiles WHERE Hash = @Hash",
return await conn.QueryFirstOrDefaultAsync<Hash>("SELECT Hash FROM dbo.MirroredArchives WHERE Hash = @Hash",
new {Hash = hash}) != default;
}
}

View File

@ -142,7 +142,8 @@ namespace Wabbajack.Server
headers.Add("Access-Control-Allow-Methods", "POST, GET");
headers.Add("Access-Control-Allow-Headers", "Accept, Origin, Content-type");
headers.Add("X-ResponseTime-Ms", stopWatch.ElapsedMilliseconds.ToString());
headers.Add("Cache-Control", "no-cache");
if (!headers.ContainsKey("Cache-Control"))
headers.Add("Cache-Control", "no-cache");
return Task.CompletedTask;
});
await next(context);

View File

@ -3,8 +3,8 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AssemblyVersion>2.2.1.6</AssemblyVersion>
<FileVersion>2.2.1.6</FileVersion>
<AssemblyVersion>2.2.1.7</AssemblyVersion>
<FileVersion>2.2.1.7</FileVersion>
<Copyright>Copyright © 2019-2020</Copyright>
<Description>Wabbajack Server</Description>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>

View File

@ -6,8 +6,8 @@
<UseWPF>true</UseWPF>
<Platforms>x64</Platforms>
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
<AssemblyVersion>2.2.1.6</AssemblyVersion>
<FileVersion>2.2.1.6</FileVersion>
<AssemblyVersion>2.2.1.7</AssemblyVersion>
<FileVersion>2.2.1.7</FileVersion>
<Copyright>Copyright © 2019-2020</Copyright>
<Description>An automated ModList installer</Description>
<PublishReadyToRun>true</PublishReadyToRun>