More changes...

This commit is contained in:
splootybean
2026-02-27 19:30:49 -08:00
parent 20fdf60665
commit b64e257b9a
36 changed files with 553 additions and 63 deletions
@@ -11,7 +11,7 @@ namespace RecRoomArchive.Services
/// <summary>
/// HttpClient for making requests to Gitea
/// </summary>
private static readonly HttpClient httpClient = new HttpClient();
private static readonly HttpClient httpClient = new();
/// <summary>
/// MessageOfTheDay reference
@@ -22,16 +22,18 @@ namespace RecRoomArchive.Services
/// Gets the message of the day from Gitea. If the URL cannot be resolved, it will fall back to "Welcome to RecRoomArchive!"
/// </summary>
/// <returns>String related to the Message of the Day</returns>
public async Task<string> GetMessageOfTheDay(string? version = null)
public async Task<string> GetMessageOfTheDay()
{
// I wouldn't want to re-request the MOTD from the server a bunch of times...
if (string.IsNullOrEmpty(MessageOfTheDay))
{
var motd = await httpClient.GetAsync($"https://git.recroomarchive.org/RecRoomArchive/RRAC/raw/branch/main/MOTD");
if (!motd.IsSuccessStatusCode)
return "Welcome to RecRoomArchive!";
//var motd = await httpClient.GetAsync($"https://git.recroomarchive.org/RecRoomArchive/RRAC/raw/branch/main/MOTD");
//if (!motd.IsSuccessStatusCode)
// return "Welcome to RecRoomArchive!";
MessageOfTheDay = await motd.Content.ReadAsStringAsync();
//MessageOfTheDay = await motd.Content.ReadAsStringAsync();
MessageOfTheDay = "Welcome to RecRoomArchive!";
}
return MessageOfTheDay;
@@ -46,17 +48,19 @@ namespace RecRoomArchive.Services
if (CharadesWordsLastFetchedAt - DateTime.UtcNow > TimeSpan.FromMinutes(30))
return CachedCharadesWords;
var request = await httpClient.GetAsync("https://git.recroomarchive.org/RecRoomArchive/RRAC/raw/branch/main/CharadesWords");
if (!request.IsSuccessStatusCode)
return [];
//var request = await httpClient.GetAsync("https://git.recroomarchive.org/RecRoomArchive/RRAC/raw/branch/main/CharadesWords");
//if (!request.IsSuccessStatusCode)
// return [];
var words = await request.Content.ReadAsStringAsync();
if (words == null)
return [];
//var words = await request.Content.ReadAsStringAsync();
//if (words == null)
// return [];
CachedCharadesWords = JsonSerializer.Deserialize<List<CharadesWord>>(words)!;
return [];
return CachedCharadesWords;
//CachedCharadesWords = JsonSerializer.Deserialize<List<CharadesWord>>(words)!;
//return CachedCharadesWords;
}
}
}