about summary refs log tree commit diff
path: root/OsuFederatedBeatmapApi/Controllers
diff options
context:
space:
mode:
authorEmma [it/its]@Rory& <root@rory.gay>2023-10-14 23:19:46 +0200
committerEmma [it/its]@Rory& <root@rory.gay>2023-10-14 23:19:46 +0200
commit73461bd79f923caa44740f170213a4abb4743660 (patch)
tree89cbb7403b4bf3f86a505d70a8f255b6463a2c3f /OsuFederatedBeatmapApi/Controllers
parentMaybe fix libmatrix bug with room creation (diff)
downloadOsuFederatedBeatmapApi-master.tar.xz
Stuff works HEAD master
Diffstat (limited to 'OsuFederatedBeatmapApi/Controllers')
-rw-r--r--OsuFederatedBeatmapApi/Controllers/BeatmapRepositoryController.cs7
1 files changed, 4 insertions, 3 deletions
diff --git a/OsuFederatedBeatmapApi/Controllers/BeatmapRepositoryController.cs b/OsuFederatedBeatmapApi/Controllers/BeatmapRepositoryController.cs
index 6a1149d..b1fa4f1 100644
--- a/OsuFederatedBeatmapApi/Controllers/BeatmapRepositoryController.cs
+++ b/OsuFederatedBeatmapApi/Controllers/BeatmapRepositoryController.cs
@@ -6,7 +6,7 @@ namespace OsuFederatedBeatmapApi.Controllers;
 
 [ApiController]
 [Route("/")]
-public class BeatmapRepositoryController(ILogger<BeatmapRepositoryController> logger, FederatedBeatmapApiBotAccountDataService ads) : ControllerBase {
+public class BeatmapRepositoryController(ILogger<BeatmapRepositoryController> logger, FederatedBeatmapApiBotAccountDataService ads, BeatmapFetcherService bfs) : ControllerBase {
     [HttpGet("/beatmapset/all/info")]
     public async IAsyncEnumerable<BeatmapSetInfo> GetAllInfo() {
         await ads.LoadAccountDataAsync();
@@ -24,8 +24,9 @@ public class BeatmapRepositoryController(ILogger<BeatmapRepositoryController> lo
         await ads.LoadAccountDataAsync();
 
         foreach (var repo in ads.ListedRepositories) {
-            var states = await repo.GetStateAsync<BeatmapSetInfo>("gay.rory.beatmap_api.beatmap_set_info", id.ToString());
-            return states as BeatmapSetInfo;
+            var state = await repo.GetStateOrNullAsync<BeatmapSetInfo>("gay.rory.beatmap_api.beatmap_set_info", id.ToString());
+            if (state is not null) return state;
+            return await bfs.FetchBeatmapSetInfo(id);
         }
 
         return null;