Fix preflight checks

This commit is contained in:
Timothy Baldridge 2022-04-02 10:45:09 -06:00
parent 26eb1ed38b
commit 79fc1b345d
2 changed files with 3 additions and 15 deletions

View File

@ -183,7 +183,7 @@ namespace Wabbajack.Lib
if (PublishData == null) return;
var ourLists = await (await AuthorApi.Client.Create()).GetMyModlists();
if (ourLists.All(l => l.MachineURL != PublishData.MachineUrl))
if (ourLists.All(l => l != PublishData.MachineUrl))
{
Utils.ErrorThrow(new CriticalFailureIntervention(
$"Cannot publish to {PublishData.MachineUrl}, you are not listed as a maintainer",

View File

@ -88,22 +88,10 @@ namespace Wabbajack.Lib.AuthorApi
});
}
public async Task<IReadOnlyList<(string MachineURL, Version Version)>> GetMyModlists()
public async Task<IReadOnlyList<string>> GetMyModlists()
{
var myLists = await _client.GetJsonAsync<string[]>($"{Consts.WabbajackBuildServerUri}author_controls/lists");
List<(string MachineURL, Version Version)> lists = new();
var client = await GitHub.Client.Get();
foreach (var file in Enum.GetValues<GitHub.Client.List>())
{
foreach (var lst in (await client.GetData(file)).Lists)
{
if (myLists.Contains(lst.Links.MachineURL))
{
lists.Add((lst.Links.MachineURL, lst.Version ?? new Version()));
}
}
}
return lists;
return myLists;
}
public async Task<Uri> UploadFile(WorkQueue queue, AbsolutePath path, Action<string, Percent> progressFn)