mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Merge pull request #275 from wabbajack-tools/broken-list-warning
Filter gallery by valid lists pulled from the validation service.
This commit is contained in:
commit
ff25be8551
@ -28,16 +28,6 @@ namespace Wabbajack.CacheServer
|
||||
public bool HasFailures { get; set; }
|
||||
}
|
||||
|
||||
public class ModlistSummary
|
||||
{
|
||||
public string Name;
|
||||
public DateTime Checked;
|
||||
public int Failed;
|
||||
public int Passed;
|
||||
public string Link => $"/lists/status/{Name}.json";
|
||||
public string Report => $"/lists/status/{Name}.html";
|
||||
}
|
||||
|
||||
public static Dictionary<string, ModListStatus> ModLists { get; set; }
|
||||
|
||||
public ListValidationService() : base("/lists")
|
||||
|
@ -76,7 +76,7 @@ namespace Wabbajack.Common
|
||||
public static string ModPermissionsURL = "https://raw.githubusercontent.com/wabbajack-tools/opt-out-lists/master/NexusModPermissions.yml";
|
||||
public static string ServerWhitelistURL = "https://raw.githubusercontent.com/wabbajack-tools/opt-out-lists/master/ServerWhitelist.yml";
|
||||
public static string ModlistMetadataURL = "https://raw.githubusercontent.com/wabbajack-tools/mod-lists/master/modlists.json";
|
||||
|
||||
public static string ModlistSummaryURL = "http://build.wabbajack.org/lists/status.json";
|
||||
public static string UserAgent
|
||||
{
|
||||
get
|
||||
|
@ -1,4 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Media.Imaging;
|
||||
@ -34,6 +36,9 @@ namespace Wabbajack.Lib.ModListRegistry
|
||||
[JsonProperty("download_metadata")]
|
||||
public DownloadMetadata DownloadMetadata { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public ModlistSummary ValidationSummary { get; set; } = new ModlistSummary();
|
||||
|
||||
public class LinksObject
|
||||
{
|
||||
[JsonProperty("image")]
|
||||
@ -60,8 +65,23 @@ namespace Wabbajack.Lib.ModListRegistry
|
||||
{
|
||||
var client = new HttpClient();
|
||||
Utils.Log("Loading ModLists from Github");
|
||||
var result = await client.GetStringAsync(Consts.ModlistMetadataURL);
|
||||
return result.FromJSONString<List<ModlistMetadata>>();
|
||||
var metadataResult = client.GetStringAsync(Consts.ModlistMetadataURL);
|
||||
var summaryResult = client.GetStringAsync(Consts.ModlistSummaryURL);
|
||||
|
||||
var metadata = (await metadataResult).FromJSONString<List<ModlistMetadata>>();
|
||||
try
|
||||
{
|
||||
var summaries = (await summaryResult).FromJSONString<List<ModlistSummary>>().ToDictionary(d => d.Name);
|
||||
|
||||
foreach (var data in metadata)
|
||||
if (summaries.TryGetValue(data.Title, out var summary))
|
||||
data.ValidationSummary = summary;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
|
||||
return metadata;
|
||||
}
|
||||
|
||||
public bool NeedsDownload(string modlistPath)
|
||||
@ -87,4 +107,15 @@ namespace Wabbajack.Lib.ModListRegistry
|
||||
|
||||
}
|
||||
|
||||
public class ModlistSummary
|
||||
{
|
||||
public string Name;
|
||||
public DateTime Checked;
|
||||
public int Failed;
|
||||
public int Passed;
|
||||
public string Link => $"/lists/status/{Name}.json";
|
||||
public string Report => $"/lists/status/{Name}.html";
|
||||
public bool HasFailures => Failed > 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -39,6 +39,7 @@ namespace Wabbajack
|
||||
.SelectTask(async _ =>
|
||||
{
|
||||
return (await ModlistMetadata.LoadFromGithub())
|
||||
.Where(m => !m.ValidationSummary.HasFailures)
|
||||
.AsObservableChangeSet(x => x.DownloadMetadata?.Hash ?? $"Fallback{missingHashFallbackCounter++}");
|
||||
})
|
||||
.Switch()
|
||||
|
Loading…
Reference in New Issue
Block a user