Fix server list loading

This commit is contained in:
Timothy Baldridge
2022-09-19 14:50:49 -06:00
parent 9856441503
commit e6cbda2c89
2 changed files with 20 additions and 5 deletions

View File

@ -1,5 +1,8 @@
### Changelog ### Changelog
#### Version - 3.0.1.0 - 9/19/2022
* Official release of the 3.0 codebase
#### Version - 3.0.0.7 - 9/12/2022 #### Version - 3.0.0.7 - 9/12/2022
* Fix Dragons' Dogma MO2 archive names * Fix Dragons' Dogma MO2 archive names
* Add Modlist Report for CLI * Add Modlist Report for CLI

View File

@ -4,6 +4,7 @@ using System.Linq;
using System.Net; using System.Net;
using System.Net.Http; using System.Net.Http;
using System.Security.Claims; using System.Security.Claims;
using System.Text.Json;
using System.Threading.Tasks; using System.Threading.Tasks;
using FluentFTP.Helpers; using FluentFTP.Helpers;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
@ -76,12 +77,23 @@ public class AuthorControls : ControllerBase
var repos = await LoadRepositories(); var repos = await LoadRepositories();
return await repos.PMapAll(async url => return await repos.PMapAll(async url =>
(await _client.GetFromJsonAsync<ModlistMetadata[]>(_limiter, new HttpRequestMessage(HttpMethod.Get, url.Value), {
_dtos.Options))!.Select(meta => try
{ {
meta.RepositoryName = url.Key; return (await _client.GetFromJsonAsync<ModlistMetadata[]>(_limiter,
return meta; new HttpRequestMessage(HttpMethod.Get, url.Value),
})) _dtos.Options))!.Select(meta =>
{
meta.RepositoryName = url.Key;
return meta;
});
}
catch (JsonException ex)
{
_logger.LogError(ex, "While loading repository {Name} from {Url}", url.Key, url.Value);
return Enumerable.Empty<ModlistMetadata>();
}
})
.SelectMany(x => x) .SelectMany(x => x)
.ToArray(); .ToArray();
} }