1- using Microsoft . AspNetCore . Mvc ;
1+ using System . Text . Json . Serialization ;
2+ using Microsoft . AspNetCore . Mvc ;
23using Ryujinx . Systems . Update . Common ;
34using Ryujinx . Systems . Update . Server . Services . GitLab ;
45
@@ -8,36 +9,33 @@ namespace Ryujinx.Systems.Update.Server.Controllers;
89[ ApiController ]
910public class MetaController : ControllerBase
1011{
11- private static readonly Dictionary < string , VersionCacheSource > CacheSources =
12- new ( 2 )
13- {
14- { "stable" , VersionCacheSource . Empty } ,
15- { "canary" , VersionCacheSource . Empty }
16- } ;
17-
12+ private static readonly CacheSourceMapping CacheSources = new ( )
13+ {
14+ Stable = VersionCacheSource . Empty ,
15+ Canary = null
16+ } ;
17+
1818 [ HttpGet ]
1919 [ ProducesResponseType ( StatusCodes . Status200OK ) ]
2020 [ Produces ( "application/json" ) ]
2121 [ EndpointDescription ( "Query the UpdateServer's internal version caches to determine what GitLab projects back each release channel." ) ]
22- public ActionResult < Dictionary < string , VersionCacheSource > > Action ( )
22+ public ActionResult < CacheSourceMapping > Action (
23+ [ FromKeyedServices ( "stableCache" ) ] VersionCache stableCache ,
24+ [ FromKeyedServices ( "canaryCache" ) ] VersionCache canaryCache )
2325 {
24- var stableCache = HttpContext . RequestServices . GetRequiredKeyedService < VersionCache > ( "stableCache" ) ;
25-
2626 if ( ! stableCache . HasProjectInfo )
2727 return BadRequest ( "Stable cache isn't initialized yet." ) ;
28-
29- CacheSources [ "stable" ] = new VersionCacheSource
28+
29+ CacheSources . Stable = new VersionCacheSource
3030 {
3131 Id = stableCache . ProjectId ,
3232 Owner = stableCache . ProjectPath . Split ( '/' ) [ 0 ] ,
3333 Project = stableCache . ProjectPath . Split ( '/' ) [ 1 ]
3434 } ;
35-
36- var canaryCache = HttpContext . RequestServices . GetKeyedService < VersionCache > ( "canaryCache" ) ;
3735
38- if ( canaryCache ? . HasProjectInfo ?? false )
36+ if ( canaryCache . HasProjectInfo )
3937 {
40- CacheSources [ "canary" ] = new VersionCacheSource
38+ CacheSources . Canary = new VersionCacheSource
4139 {
4240 Id = canaryCache . ProjectId ,
4341 Owner = canaryCache . ProjectPath . Split ( '/' ) [ 0 ] ,
0 commit comments