diff --git a/Robust.Cdn/Controllers/DownloadCompatibilityController.cs b/Robust.Cdn/Controllers/DownloadCompatibilityController.cs index 3739d68..e763be4 100644 --- a/Robust.Cdn/Controllers/DownloadCompatibilityController.cs +++ b/Robust.Cdn/Controllers/DownloadCompatibilityController.cs @@ -1,14 +1,17 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Options; using Robust.Cdn.Config; +using Robust.Cdn.Services; namespace Robust.Cdn.Controllers; [ApiController] [Route("/version/{version}")] public sealed class DownloadCompatibilityController( - DownloadController downloadController, - IOptions cdnOptions) : ControllerBase + Database db, + ILogger logger, + IOptionsSnapshot cdnOptions, + DownloadRequestLogger requestLogger) : ControllerBase { [HttpGet("manifest")] public IActionResult GetManifest(string version) @@ -16,7 +19,7 @@ public IActionResult GetManifest(string version) if (cdnOptions.Value.DefaultFork is not { } defaultFork) return NotFound(); - return downloadController.GetManifest(defaultFork, version); + return GetDownloadController().GetManifest(defaultFork, version); } [HttpOptions("download")] @@ -25,7 +28,7 @@ public IActionResult DownloadOptions(string version) if (cdnOptions.Value.DefaultFork is not { } defaultFork) return NotFound(); - return downloadController.DownloadOptions(defaultFork, version); + return GetDownloadController().DownloadOptions(defaultFork, version); } [HttpPost("download")] @@ -34,6 +37,14 @@ public async Task Download(string version) if (cdnOptions.Value.DefaultFork is not { } defaultFork) return NotFound(); - return await downloadController.Download(defaultFork, version); + return await GetDownloadController().Download(defaultFork, version); + } + + private DownloadController GetDownloadController() + { + return new DownloadController(db, logger, cdnOptions, requestLogger) + { + ControllerContext = ControllerContext + }; } }