Fix master and bump versions

This commit is contained in:
Timothy Baldridge 2020-08-07 21:40:03 -06:00
parent 1fbe1df035
commit 1303c86dcc
5 changed files with 45 additions and 1 deletions

View File

@ -1,5 +1,13 @@
### Changelog
#### Version - 2.2.0.0 - 8/7/2020
* Can now use NTFS XPRESS16 compression to reduce install sizes (optional in the settings panel)
* Better valid directory detection during install
* Prime the Hash cache during install so that we don't have to re-hash during a modlist update
* Better detection and handling of midden files
* Reworked the installer to use less temporary storage during install, keeps fewer archives open at once
* Launcher now passes arguments to the main Wabbajack.exe application
#### Version - 2.1.3.4 - 7/28/2020
* Fixes for Tar Files (for realz this time)
* Watch disk usage, throw an error if disk usage gets too high

View File

@ -239,5 +239,20 @@ namespace Wabbajack.Lib
}
throw new HttpException(result);
}
public static async Task<Uri?> GetMirrorUrl(Hash archiveHash)
{
var client = await GetClient();
try
{
var result =
await client.GetStringAsync($"{Consts.WabbajackBuildServerUri}/mirror/{archiveHash.ToHex()}");
return new Uri(result);
}
catch (HttpException ex)
{
return null;
}
}
}
}

View File

@ -157,9 +157,12 @@ namespace Wabbajack.Lib.Downloaders
{
try
{
var url = await ClientAPI.GetMirrorUrl(archive.Hash);
if (url == null) return false;
var newArchive =
new Archive(
new WabbajackCDNDownloader.State(new Uri($"{Consts.WabbajackMirror}{archive.Hash.ToHex()}")))
new WabbajackCDNDownloader.State(url))
{
Hash = archive.Hash, Size = archive.Size, Name = archive.Name
};

View File

@ -145,6 +145,16 @@ namespace Wabbajack.BuildServer.Controllers
await _sql.PurgePatch(hash, rationale);
return Ok("Purged");
}
[HttpGet]
[Authorize(Roles = "User")]
[Route("/mirror/{hashAsHex}")]
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}");
return NotFound("Not Mirrored");
}
}

View File

@ -75,5 +75,13 @@ namespace Wabbajack.Server.DataLayer
});
}
}
public async Task<bool> HaveMirror(Hash hash)
{
await using var conn = await Open();
return await conn.QueryFirstOrDefaultAsync<Hash>("SELECT Hash FROM dbo.MirroredFiles WHERE Hash = @Hash",
new {Hash = hash}) != default;
}
}
}