mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Check the featured_lists.json when loading modlists data
This commit is contained in:
parent
0626fd2899
commit
7ef7a2ae27
2
.github/workflows/tests.yaml
vendored
2
.github/workflows/tests.yaml
vendored
@ -7,7 +7,7 @@ on:
|
||||
branches: [ main ]
|
||||
|
||||
env:
|
||||
VERSION: 3.0.0.1
|
||||
VERSION: 3.0.0.2
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
@ -189,19 +189,29 @@ public class Client
|
||||
|
||||
public async Task<ModlistMetadata[]> LoadLists()
|
||||
{
|
||||
var repos = await LoadRepositories();
|
||||
var repos = LoadRepositories();
|
||||
var featured = await LoadFeaturedLists();
|
||||
|
||||
return await repos.PMapAll(async url =>
|
||||
return await (await repos).PMapAll(async url =>
|
||||
(await _client.GetFromJsonAsync<ModlistMetadata[]>(_limiter, new HttpRequestMessage(HttpMethod.Get, url.Value),
|
||||
_dtos.Options))!.Select(meta =>
|
||||
{
|
||||
meta.RepositoryName = url.Key;
|
||||
meta.Official = (meta.RepositoryName == "wj-featured" || featured.Contains(meta.NamespacedName));
|
||||
return meta;
|
||||
}))
|
||||
.SelectMany(x => x)
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
private async Task<HashSet<string>> LoadFeaturedLists()
|
||||
{
|
||||
var data = await _client.GetFromJsonAsync<string[]>(_limiter,
|
||||
new HttpRequestMessage(HttpMethod.Get,
|
||||
"https://raw.githubusercontent.com/wabbajack-tools/mod-lists/master/featured_lists.json"), _dtos.Options);
|
||||
return data!.ToHashSet(StringComparer.CurrentCultureIgnoreCase);
|
||||
}
|
||||
|
||||
public async Task<Dictionary<string, Uri>> LoadRepositories()
|
||||
{
|
||||
var repositories = await _client.GetFromJsonAsync<Dictionary<string, Uri>>(_limiter,
|
||||
|
Loading…
Reference in New Issue
Block a user