mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Filter gallery by valid lists pulled from the validation service.
This commit is contained in:
parent
f4df8509f0
commit
4b11503319
@ -28,16 +28,6 @@ namespace Wabbajack.CacheServer
|
|||||||
public bool HasFailures { get; set; }
|
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 static Dictionary<string, ModListStatus> ModLists { get; set; }
|
||||||
|
|
||||||
public ListValidationService() : base("/lists")
|
public ListValidationService() : base("/lists")
|
||||||
|
@ -73,7 +73,7 @@ namespace Wabbajack.Common
|
|||||||
public static string ModPermissionsURL = "https://raw.githubusercontent.com/wabbajack-tools/opt-out-lists/master/NexusModPermissions.yml";
|
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 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 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
|
public static string UserAgent
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
@ -34,6 +36,9 @@ namespace Wabbajack.Lib.ModListRegistry
|
|||||||
[JsonProperty("download_metadata")]
|
[JsonProperty("download_metadata")]
|
||||||
public DownloadMetadata DownloadMetadata { get; set; }
|
public DownloadMetadata DownloadMetadata { get; set; }
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public ModlistSummary ValidationSummary { get; set; } = new ModlistSummary();
|
||||||
|
|
||||||
public class LinksObject
|
public class LinksObject
|
||||||
{
|
{
|
||||||
[JsonProperty("image")]
|
[JsonProperty("image")]
|
||||||
@ -60,8 +65,23 @@ namespace Wabbajack.Lib.ModListRegistry
|
|||||||
{
|
{
|
||||||
var client = new HttpClient();
|
var client = new HttpClient();
|
||||||
Utils.Log("Loading ModLists from Github");
|
Utils.Log("Loading ModLists from Github");
|
||||||
var result = await client.GetStringAsync(Consts.ModlistMetadataURL);
|
var metadataResult = client.GetStringAsync(Consts.ModlistMetadataURL);
|
||||||
return result.FromJSONString<List<ModlistMetadata>>();
|
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)
|
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 _ =>
|
.SelectTask(async _ =>
|
||||||
{
|
{
|
||||||
return (await ModlistMetadata.LoadFromGithub())
|
return (await ModlistMetadata.LoadFromGithub())
|
||||||
|
.Where(m => !m.ValidationSummary.HasFailures)
|
||||||
.AsObservableChangeSet(x => x.DownloadMetadata?.Hash ?? $"Fallback{missingHashFallbackCounter++}");
|
.AsObservableChangeSet(x => x.DownloadMetadata?.Hash ?? $"Fallback{missingHashFallbackCounter++}");
|
||||||
})
|
})
|
||||||
.Switch()
|
.Switch()
|
||||||
|
Loading…
Reference in New Issue
Block a user