mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Print the archive being extracted when analysis fails.
This commit is contained in:
parent
c96665cde3
commit
895bdb15a6
@ -64,6 +64,28 @@ namespace Wabbajack.BuildServer.Test
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task CanDeleteFilesUsingClientApi()
|
||||
{
|
||||
using (var file = new TempFile())
|
||||
{
|
||||
var data = new byte[1024];
|
||||
await using (var fs = file.Path.Create())
|
||||
{
|
||||
await fs.WriteAsync(data);
|
||||
}
|
||||
|
||||
Utils.Log($"Uploading {file.Path.Size.ToFileSizeString()} file");
|
||||
var result = await AuthorAPI.UploadFile(file.Path,
|
||||
progress => Utils.Log($"Uploading : {progress * 100}%"), Fixture.APIKey);
|
||||
|
||||
Utils.Log($"Delete {result}");
|
||||
await AuthorAPI.DeleteFile((string)((RelativePath)new Uri(result).AbsolutePath).FileName);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public UploadedFilesTest(ITestOutputHelper output, SingletonAdaptor<BuildServerFixture> fixture) : base(output, fixture)
|
||||
{
|
||||
|
@ -114,10 +114,14 @@ namespace Wabbajack.BuildServer.Controllers
|
||||
DownloadMetaData = metadata.DownloadMetadata,
|
||||
HasFailures = failedCount > 0,
|
||||
MachineName = metadata.Links.MachineURL,
|
||||
Archives = archives.Select(a => new DetailedStatusItem
|
||||
Archives = archives.Select(a =>
|
||||
{
|
||||
Archive = a.Item1,
|
||||
IsFailing = a.Item2 == ArchiveStatus.InValid || a.Item2 == ArchiveStatus.Updating
|
||||
a.Item1.Meta = "";
|
||||
return new DetailedStatusItem
|
||||
{
|
||||
Archive = a.Item1,
|
||||
IsFailing = a.Item2 == ArchiveStatus.InValid || a.Item2 == ArchiveStatus.Updating
|
||||
};
|
||||
}).ToList()
|
||||
};
|
||||
|
||||
@ -172,33 +176,59 @@ namespace Wabbajack.BuildServer.Controllers
|
||||
var mod = await SQL.GetNexusModInfoString(ns.Game, ns.ModID);
|
||||
var files = await SQL.GetModFiles(ns.Game, ns.ModID);
|
||||
|
||||
if (mod == null)
|
||||
try
|
||||
{
|
||||
Utils.Log($"Found missing Nexus mod info {ns.Game} {ns.ModID}");
|
||||
mod = await (await _nexusClient).GetModInfo(ns.Game, ns.ModID, false);
|
||||
try
|
||||
if (mod == null)
|
||||
{
|
||||
await SQL.AddNexusModInfo(ns.Game, ns.ModID, mod.updated_time, mod);
|
||||
Utils.Log($"Found missing Nexus mod info {ns.Game} {ns.ModID}");
|
||||
try
|
||||
{
|
||||
mod = await (await _nexusClient).GetModInfo(ns.Game, ns.ModID, false);
|
||||
}
|
||||
catch
|
||||
{
|
||||
mod = new ModInfo
|
||||
{
|
||||
mod_id = ns.ModID.ToString(), game_id = ns.Game.MetaData().NexusGameId, available = false
|
||||
};
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
await SQL.AddNexusModInfo(ns.Game, ns.ModID, mod.updated_time, mod);
|
||||
}
|
||||
catch (Exception _)
|
||||
{
|
||||
// Could be a PK constraint failure
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception _)
|
||||
|
||||
if (files == null)
|
||||
{
|
||||
// Could be a PK constraint failure
|
||||
Utils.Log($"Found missing Nexus mod file infos {ns.Game} {ns.ModID}");
|
||||
try
|
||||
{
|
||||
files = await (await _nexusClient).GetModFiles(ns.Game, ns.ModID, false);
|
||||
}
|
||||
catch
|
||||
{
|
||||
files = new NexusApiClient.GetModFilesResponse {files = new List<NexusFileInfo>()};
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
await SQL.AddNexusModFiles(ns.Game, ns.ModID, mod.updated_time, files);
|
||||
}
|
||||
catch (Exception _)
|
||||
{
|
||||
// Could be a PK constraint failure
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (files == null)
|
||||
catch (Exception ex)
|
||||
{
|
||||
Utils.Log($"Found missing Nexus mod file infos {ns.Game} {ns.ModID}");
|
||||
files = await (await _nexusClient).GetModFiles(ns.Game, ns.ModID, false);
|
||||
|
||||
try
|
||||
{
|
||||
await SQL.AddNexusModFiles(ns.Game, ns.ModID, mod.updated_time, files);
|
||||
}
|
||||
catch (Exception _)
|
||||
{
|
||||
// Could be a PK constraint failure
|
||||
}
|
||||
return ArchiveStatus.InValid;
|
||||
}
|
||||
|
||||
if (mod.available && files.files.Any(f => !string.IsNullOrEmpty(f.category_name) && f.file_id == ns.FileID))
|
||||
|
@ -214,20 +214,24 @@ namespace Wabbajack.BuildServer.Controllers
|
||||
{
|
||||
var user = User.FindFirstValue(ClaimTypes.Name);
|
||||
Utils.Log($"Delete Uploaded File {user} {name}");
|
||||
var files = await SQL.AllUploadedFilesForUser(name);
|
||||
var files = await SQL.AllUploadedFilesForUser(user);
|
||||
|
||||
var to_delete = files.First(f => f.MungedName == name);
|
||||
|
||||
if (AlphaFile.Exists(Path.Combine("public", "files", to_delete.MungedName)))
|
||||
AlphaFile.Delete(Path.Combine("public", "files", to_delete.MungedName));
|
||||
|
||||
using (var client = new FtpClient("storage.bunnycdn.com"))
|
||||
{
|
||||
client.Credentials = new NetworkCredential(_settings.BunnyCDN_User, _settings.BunnyCDN_Password);
|
||||
await client.ConnectAsync();
|
||||
if (await client.FileExistsAsync(to_delete.MungedName))
|
||||
await client.DeleteFileAsync(to_delete.MungedName);
|
||||
|
||||
if (_settings.BunnyCDN_User != "TEST" || _settings.BunnyCDN_Password != "TEST")
|
||||
{
|
||||
using (var client = new FtpClient("storage.bunnycdn.com"))
|
||||
{
|
||||
client.Credentials = new NetworkCredential(_settings.BunnyCDN_User, _settings.BunnyCDN_Password);
|
||||
await client.ConnectAsync();
|
||||
if (await client.FileExistsAsync(to_delete.MungedName))
|
||||
await client.DeleteFileAsync(to_delete.MungedName);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
await SQL.DeleteUploadedFile(to_delete.Id);
|
||||
@ -263,12 +267,7 @@ namespace Wabbajack.BuildServer.Controllers
|
||||
files.Add(uf);
|
||||
await SQL.AddUploadedFile(uf);
|
||||
}
|
||||
|
||||
|
||||
return Ok(files.Count);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -229,7 +229,6 @@ namespace Wabbajack.Lib
|
||||
|
||||
result.Name = archive.Name;
|
||||
result.Hash = archive.File.Hash;
|
||||
result.Meta = archive.Meta;
|
||||
result.Size = archive.File.Size;
|
||||
|
||||
await result.State!.GetDownloader().Prepare();
|
||||
@ -238,6 +237,9 @@ namespace Wabbajack.Lib
|
||||
Error(
|
||||
$"Unable to resolve link for {archive.Name}. If this is hosted on the Nexus the file may have been removed.");
|
||||
|
||||
result.Meta = string.Join("\n", result.State!.GetMetaIni());
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -184,18 +184,18 @@ namespace Wabbajack.Lib.FileUploader
|
||||
|
||||
public static async Task<string> GetServerLog()
|
||||
{
|
||||
return await (await GetAuthorizedClient()).GetStringAsync($"https://{Consts.WabbajackCacheHostname}/heartbeat/logs");
|
||||
return await (await GetAuthorizedClient()).GetStringAsync($"{Consts.WabbajackBuildServerUri}heartbeat/logs");
|
||||
}
|
||||
|
||||
public static async Task<IEnumerable<string>> GetMyFiles()
|
||||
{
|
||||
return (await (await GetAuthorizedClient()).GetStringAsync($"https://{Consts.WabbajackCacheHostname}/uploaded_files/list")).FromJsonString<string[]>();
|
||||
return (await (await GetAuthorizedClient()).GetStringAsync($"{Consts.WabbajackBuildServerUri}uploaded_files/list")).FromJsonString<string[]>();
|
||||
}
|
||||
|
||||
public static async Task<string> DeleteFile(string name)
|
||||
{
|
||||
var result = await (await GetAuthorizedClient())
|
||||
.DeleteStringAsync($"https://{Consts.WabbajackCacheHostname}/uploaded_files/{name}");
|
||||
.DeleteStringAsync($"{Consts.WabbajackBuildServerUri}uploaded_files/{name}");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user