mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Fix several issues with client authorization with the server
This commit is contained in:
parent
131c11809f
commit
8bca15cb36
@ -27,6 +27,7 @@ namespace Wabbajack.Lib.Http
|
||||
};
|
||||
Utils.Log($"Configuring with SSL {_socketsHandler.SslOptions.EnabledSslProtocols}");
|
||||
Client = new SysHttp.HttpClient(_socketsHandler);
|
||||
Client.DefaultRequestHeaders.Add("User-Agent", Consts.UserAgent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -164,8 +164,12 @@ namespace Wabbajack.Lib.ModListRegistry
|
||||
public string Link => $"/lists/status/{MachineURL}.json";
|
||||
[JsonProperty("report")]
|
||||
public string Report => $"/lists/status/{MachineURL}.html";
|
||||
|
||||
[JsonProperty("modlist_missing")]
|
||||
public bool ModListIsMissing { get; set; }
|
||||
|
||||
[JsonProperty("has_failures")]
|
||||
public bool HasFailures => Failed > 0;
|
||||
public bool HasFailures => Failed > 0 || ModListIsMissing;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -16,5 +16,6 @@ namespace Wabbajack.Server.DTOs
|
||||
public ConcurrentHashSet<(Game Game, long ModId)> SlowQueriedFor { get; set; } = new ConcurrentHashSet<(Game Game, long ModId)>();
|
||||
public Dictionary<Hash, bool> Mirrors { get; set; }
|
||||
public Lazy<Task<Dictionary<Hash, string>>> AllowedMirrors { get; set; }
|
||||
public IEnumerable<AuthoredFilesSummary> AllAuthoredFiles { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ namespace Wabbajack.Server.DataLayer
|
||||
var archiveStatus = AllModListArchivesStatus();
|
||||
var modLists = AllModLists();
|
||||
var mirrors = GetAllMirroredHashes();
|
||||
var authoredFiles = AllAuthoredFiles();
|
||||
return new ValidationData
|
||||
{
|
||||
NexusFiles = new ConcurrentHashSet<(long Game, long ModId, long FileId)>((await nexusFiles).Select(f => (f.NexusGameId, f.ModId, f.FileId))),
|
||||
@ -25,6 +26,7 @@ namespace Wabbajack.Server.DataLayer
|
||||
ModLists = await modLists,
|
||||
Mirrors = await mirrors,
|
||||
AllowedMirrors = new Lazy<Task<Dictionary<Hash, string>>>(async () => await GetAllowedMirrors()),
|
||||
AllAuthoredFiles = await authoredFiles,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -53,10 +53,33 @@ namespace Wabbajack.Server.Services
|
||||
timer.Start();
|
||||
var oldSummary =
|
||||
oldSummaries.FirstOrDefault(s => s.Summary.MachineURL == metadata.Links.MachineURL);
|
||||
|
||||
|
||||
var mainFile = await DownloadDispatcher.Infer(new Uri(metadata.Links.Download));
|
||||
var mainArchive = new Archive(mainFile!)
|
||||
{
|
||||
Size = metadata.DownloadMetadata!.Size,
|
||||
Hash = metadata.DownloadMetadata!.Hash
|
||||
};
|
||||
bool mainFailed = false;
|
||||
|
||||
try
|
||||
{
|
||||
if (!await mainArchive.State.Verify(mainArchive))
|
||||
{
|
||||
mainFailed = true;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
mainFailed = true;
|
||||
}
|
||||
|
||||
var listArchives = await _sql.ModListArchives(metadata.Links.MachineURL);
|
||||
var archives = await listArchives.PMap(queue, async archive =>
|
||||
{
|
||||
if (mainFailed)
|
||||
return (archive, ArchiveStatus.InValid);
|
||||
|
||||
try
|
||||
{
|
||||
ReportStarting(archive.State.PrimaryKeyString);
|
||||
@ -107,6 +130,7 @@ namespace Wabbajack.Server.Services
|
||||
Mirrored = mirroredCount,
|
||||
MachineURL = metadata.Links.MachineURL,
|
||||
Name = metadata.Title,
|
||||
ModListIsMissing = mainFailed
|
||||
};
|
||||
|
||||
var detailed = new DetailedStatus
|
||||
|
Loading…
Reference in New Issue
Block a user