1- using System . Net . Mime ;
2- using System . Reflection ;
3- using Microsoft . AspNetCore . Authorization ;
4- using Microsoft . AspNetCore . Mvc ;
5- using OpenShock . API . Utils ;
1+ using Microsoft . AspNetCore . Mvc ;
2+ using Microsoft . Extensions . Options ;
63using OpenShock . Common ;
74using OpenShock . Common . Models ;
8- using OpenShock . Common . Problems ;
5+ using OpenShock . Common . Options ;
96using OpenShock . Common . Utils ;
7+ using System . Net . Mime ;
8+ using System . Reflection ;
109
1110namespace OpenShock . API . Controller . Version ;
1211
@@ -27,16 +26,23 @@ public sealed partial class VersionController : OpenShockControllerBase
2726 /// <response code="200">The version was successfully retrieved.</response>
2827 [ HttpGet ]
2928 [ ProducesResponseType < BaseResponse < RootResponse > > ( StatusCodes . Status200OK , MediaTypeNames . Application . Json ) ]
30- public IActionResult GetBackendVersion ( [ FromServices ] ApiConfig apiConfig )
29+ public IActionResult GetBackendVersion (
30+ [ FromServices ] IOptions < FrontendOptions > frontendOptions ,
31+ [ FromServices ] IOptions < CloudflareTurnstileOptions > turnstileOptions
32+ )
3133 {
34+ var frontendConfig = frontendOptions . Value ;
35+ var turnstileConfig = turnstileOptions . Value ;
36+
3237 return RespondSuccessLegacy (
33- data : new RootResponse {
38+ data : new RootResponse
39+ {
3440 Version = OpenShockBackendVersion ,
3541 Commit = GitHashAttribute . FullHash ,
3642 CurrentTime = DateTimeOffset . UtcNow ,
37- FrontendUrl = apiConfig . Frontend . BaseUrl ,
38- ShortLinkUrl = apiConfig . Frontend . ShortUrl ,
39- TurnstileSiteKey = apiConfig . Turnstile . SiteKey
43+ FrontendUrl = frontendConfig . BaseUrl ,
44+ ShortLinkUrl = frontendConfig . ShortUrl ,
45+ TurnstileSiteKey = turnstileConfig . SiteKey
4046 } ,
4147 message : "OpenShock"
4248 ) ;
0 commit comments