From e299cde6da61a44664d93cd4b65bf05dedf386af Mon Sep 17 00:00:00 2001 From: ChiaraBm Date: Tue, 7 Jan 2025 00:08:19 +0100 Subject: [PATCH] Removed asset controllers. Started adding design section in settings --- .../Controllers/Assets/AssetsController.cs | 26 ------------- .../Assets/AssetsPluginsController.cs | 37 ------------------- .../Http/Controllers/FrontendController.cs | 2 +- .../Moonlight.ApiServer.csproj | 1 - Moonlight.Client/Moonlight.Client.csproj | 2 +- Moonlight.Client/Startup.cs | 2 + Moonlight.Client/Styles/mappings/mooncore.map | 9 ++--- .../UI/Views/Admin/Sys/Design.razor | 25 +++++++++++++ .../UI/Views/Admin/Sys/Index.razor | 4 ++ Moonlight.Client/UiConstants.cs | 7 ++++ 10 files changed, 43 insertions(+), 72 deletions(-) delete mode 100644 Moonlight.ApiServer/Http/Controllers/Assets/AssetsController.cs delete mode 100644 Moonlight.ApiServer/Http/Controllers/Assets/AssetsPluginsController.cs create mode 100644 Moonlight.Client/UI/Views/Admin/Sys/Design.razor create mode 100644 Moonlight.Client/UiConstants.cs diff --git a/Moonlight.ApiServer/Http/Controllers/Assets/AssetsController.cs b/Moonlight.ApiServer/Http/Controllers/Assets/AssetsController.cs deleted file mode 100644 index df32f208..00000000 --- a/Moonlight.ApiServer/Http/Controllers/Assets/AssetsController.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using Moonlight.ApiServer.Services; -using Moonlight.Shared.Http.Responses.Assets; - -namespace Moonlight.ApiServer.Http.Controllers.Assets; - -[ApiController] -[Route("api/assets")] -public class AssetsController : Controller -{ - private readonly AssetService AssetService; - - public AssetsController(AssetService assetService) - { - AssetService = assetService; - } - - [HttpGet] - public async Task Get() - { - return new FrontendAssetResponse() - { - JavascriptFiles = AssetService.GetJavascriptAssets(), - }; - } -} \ No newline at end of file diff --git a/Moonlight.ApiServer/Http/Controllers/Assets/AssetsPluginsController.cs b/Moonlight.ApiServer/Http/Controllers/Assets/AssetsPluginsController.cs deleted file mode 100644 index de90a1a0..00000000 --- a/Moonlight.ApiServer/Http/Controllers/Assets/AssetsPluginsController.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using MoonCore.Exceptions; -using MoonCore.Models; -using Moonlight.ApiServer.Services; - -namespace Moonlight.ApiServer.Http.Controllers.Assets; - -[ApiController] -[Route("api/assets/plugins")] -public class AssetsPluginsController : Controller -{ - private readonly PluginService PluginService; - - public AssetsPluginsController(PluginService pluginService) - { - PluginService = pluginService; - } - - [HttpGet] - public Task GetManifest() - { - return Task.FromResult(PluginService.HostedPluginsManifest); - } - - [HttpGet("stream")] - public async Task GetAssembly([FromQuery(Name = "assembly")] string assembly) - { - var assembliesMap = PluginService.ClientAssemblyMap; - - if (assembliesMap.ContainsKey(assembly)) - throw new HttpApiException("The requested assembly could not be found", 404); - - var path = assembliesMap[assembly]; - - await Results.File(path).ExecuteAsync(HttpContext); - } -} \ No newline at end of file diff --git a/Moonlight.ApiServer/Http/Controllers/FrontendController.cs b/Moonlight.ApiServer/Http/Controllers/FrontendController.cs index fb53d9ed..b9bd76d1 100644 --- a/Moonlight.ApiServer/Http/Controllers/FrontendController.cs +++ b/Moonlight.ApiServer/Http/Controllers/FrontendController.cs @@ -42,7 +42,7 @@ public class FrontendController : Controller return configuration; } - [HttpGet("plugins/{assemblyName}")] + [HttpGet("plugins/{assemblyName}")] // TODO: Test this public async Task GetPluginAssembly(string assemblyName) { var assembliesMap = PluginService.ClientAssemblyMap; diff --git a/Moonlight.ApiServer/Moonlight.ApiServer.csproj b/Moonlight.ApiServer/Moonlight.ApiServer.csproj index 92e6e958..5c523110 100644 --- a/Moonlight.ApiServer/Moonlight.ApiServer.csproj +++ b/Moonlight.ApiServer/Moonlight.ApiServer.csproj @@ -39,7 +39,6 @@ - diff --git a/Moonlight.Client/Moonlight.Client.csproj b/Moonlight.Client/Moonlight.Client.csproj index 76868a2b..6ce46174 100644 --- a/Moonlight.Client/Moonlight.Client.csproj +++ b/Moonlight.Client/Moonlight.Client.csproj @@ -27,7 +27,7 @@ - +