using System.Text.Json; using Microsoft.AspNetCore.Mvc; using MoonCore.Services; using Moonlight.ApiServer.Configuration; using Moonlight.ApiServer.Models; namespace Moonlight.ApiServer.Http.Controllers.Swagger; [ApiController] [Route("api/swagger")] public class SwaggerController : Controller { private readonly ConfigService ConfigService; public SwaggerController(ConfigService configService) { ConfigService = configService; } [HttpGet] public async Task Get() { if (!ConfigService.Get().Development.EnableApiDocs) return BadRequest("Api docs are disabled"); var options = new ApiDocsOptions(); var optionsJson = JsonSerializer.Serialize(options); //TODO: Replace the css link with a better one var html = "\n" + "\n" + "\n" + "Moonlight Api Reference\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + ""; return Content(html, "text/html"); } }