mirror of
https://github.com/FalloutCollaborationProject/FCP-Mod-Updater.git
synced 2026-07-27 17:04:05 -07:00
Check for "rimworld-mod" topic to filter public repos
This commit is contained in:
@@ -7,5 +7,6 @@ public record RemoteRepo(
|
||||
[property: JsonPropertyName("clone_url")] string CloneUrl,
|
||||
[property: JsonPropertyName("default_branch")] string DefaultBranch,
|
||||
[property: JsonPropertyName("description")] string? Description,
|
||||
[property: JsonPropertyName("html_url")] string HtmlUrl
|
||||
[property: JsonPropertyName("html_url")] string HtmlUrl,
|
||||
[property: JsonPropertyName("topics")] IReadOnlyList<string> Topics
|
||||
);
|
||||
|
||||
@@ -7,6 +7,7 @@ public class GitHubApiService : IGitHubApiService, IDisposable
|
||||
{
|
||||
private const string OrgName = "FalloutCollaborationProject";
|
||||
private const string BaseUrl = "https://api.github.com";
|
||||
private const string RequiredTopic = "rimworld-mod";
|
||||
|
||||
private readonly HttpClient _httpClient;
|
||||
private readonly TimeSpan _cacheExpiry = TimeSpan.FromHours(1);
|
||||
@@ -86,7 +87,10 @@ public class GitHubApiService : IGitHubApiService, IDisposable
|
||||
|
||||
if (allRepos.Count > 0)
|
||||
{
|
||||
_cachedRepos = allRepos;
|
||||
// Filter to only repos tagged as RimWorld mods
|
||||
_cachedRepos = allRepos
|
||||
.Where(r => r.Topics.Contains(RequiredTopic, StringComparer.OrdinalIgnoreCase))
|
||||
.ToList();
|
||||
_cacheTime = DateTimeOffset.UtcNow;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user