diff --git a/MoonlightServers.ApiServer/MoonlightServers.ApiServer.csproj b/MoonlightServers.ApiServer/MoonlightServers.ApiServer.csproj index 609b7b9..2160d2b 100644 --- a/MoonlightServers.ApiServer/MoonlightServers.ApiServer.csproj +++ b/MoonlightServers.ApiServer/MoonlightServers.ApiServer.csproj @@ -5,16 +5,19 @@ enable enable Linux + true + 2.1.0 + MoonlightServers.ApiServer + apiserver - - + - + @@ -22,8 +25,24 @@ - + + + + true + src + Never + + + true + src + Never + + + + + + diff --git a/MoonlightServers.ApiServer/Program.cs b/MoonlightServers.ApiServer/Program.cs index 15dd10c..35990a0 100644 --- a/MoonlightServers.ApiServer/Program.cs +++ b/MoonlightServers.ApiServer/Program.cs @@ -1,6 +1,7 @@ using System.Text.Json; using Moonlight.ApiServer; using Moonlight.ApiServer.Models; +using MoonlightServers.ApiServer.Startup; // Development Server Startup @@ -28,8 +29,6 @@ pluginManifest.Assemblies.Clear(); #endregion -await startup.Run( - args, - [typeof(Program).Assembly], - [pluginManifest] -); \ No newline at end of file +await startup.Run(args, [ + new PluginStartup() +]); \ No newline at end of file diff --git a/MoonlightServers.ApiServer/Startup/PluginStartup.cs b/MoonlightServers.ApiServer/Startup/PluginStartup.cs index c81e20f..86227be 100644 --- a/MoonlightServers.ApiServer/Startup/PluginStartup.cs +++ b/MoonlightServers.ApiServer/Startup/PluginStartup.cs @@ -1,30 +1,49 @@ using MoonCore.Extensions; -using Moonlight.ApiServer.Interfaces.Startup; +using Moonlight.ApiServer.Configuration; +using Moonlight.ApiServer.Models; +using Moonlight.ApiServer.Plugins; using MoonlightServers.ApiServer.Database; using MoonlightServers.ApiServer.Helpers; namespace MoonlightServers.ApiServer.Startup; +[PluginStartup] public class PluginStartup : IPluginStartup { - public Task BuildApplication(IHostApplicationBuilder builder) + public Task BuildApplication(IServiceProvider serviceProvider, IHostApplicationBuilder builder) { // Scan the current plugin assembly for di services builder.Services.AutoAddServices(); builder.Services.AddDbContext(); - + // Configure authentication for the remote endpoints builder.Services .AddAuthentication() .AddScheme("nodeAuthentication", null); - + + var configuration = serviceProvider.GetRequiredService(); + + if (configuration.Client.Enable) + { + builder.Services.AddSingleton(new FrontendConfigurationOption() + { + Scripts = + [ + "js/XtermBlazor.min.js", + "js/addon-fit.js", + "js/moonlightServers.js" + ], + Styles = ["css/XtermBlazor.min.css"] + }); + } + return Task.CompletedTask; } - public Task ConfigureApplication(IApplicationBuilder app) - => Task.CompletedTask; + public Task ConfigureApplication(IServiceProvider serviceProvider, IApplicationBuilder app) + => Task.CompletedTask; - public Task ConfigureEndpoints(IEndpointRouteBuilder routeBuilder) + public Task ConfigureEndpoints(IServiceProvider serviceProvider, IEndpointRouteBuilder routeBuilder) => Task.CompletedTask; } \ No newline at end of file diff --git a/MoonlightServers.DaemonShared/MoonlightServers.DaemonShared.csproj b/MoonlightServers.DaemonShared/MoonlightServers.DaemonShared.csproj index 97e9cc2..3549f92 100644 --- a/MoonlightServers.DaemonShared/MoonlightServers.DaemonShared.csproj +++ b/MoonlightServers.DaemonShared/MoonlightServers.DaemonShared.csproj @@ -4,6 +4,11 @@ net8.0 enable enable + MoonlightServers.DaemonShared + shared + true + 2.1.0 + MoonlightServers.DaemonShared diff --git a/MoonlightServers.Frontend/MoonlightServers.Frontend.csproj b/MoonlightServers.Frontend/MoonlightServers.Frontend.csproj index 7908bd6..1ef943f 100644 --- a/MoonlightServers.Frontend/MoonlightServers.Frontend.csproj +++ b/MoonlightServers.Frontend/MoonlightServers.Frontend.csproj @@ -4,12 +4,16 @@ net8.0 enable enable + true + 2.1.0 + MoonlightServers.Frontend + frontend - - - + + + @@ -27,4 +31,26 @@ + + + true + src + Never + + + true + src + Never + + + true + styles + Never + + + + + + + diff --git a/MoonlightServers.Frontend/Program.cs b/MoonlightServers.Frontend/Program.cs index 21a691b..9d8fe98 100644 --- a/MoonlightServers.Frontend/Program.cs +++ b/MoonlightServers.Frontend/Program.cs @@ -1,4 +1,5 @@ using Moonlight.Client; +using MoonlightServers.Frontend.Startup; // Development Client Startup @@ -11,5 +12,5 @@ using Moonlight.Client; var startup = new Startup(); await startup.Run(args, [ - typeof(Program).Assembly + new PluginStartup() ]); \ No newline at end of file diff --git a/MoonlightServers.Frontend/Startup/PluginStartup.cs b/MoonlightServers.Frontend/Startup/PluginStartup.cs index 4b88831..eabd632 100644 --- a/MoonlightServers.Frontend/Startup/PluginStartup.cs +++ b/MoonlightServers.Frontend/Startup/PluginStartup.cs @@ -1,14 +1,16 @@ using Microsoft.AspNetCore.Components.WebAssembly.Hosting; using MoonCore.Extensions; using Moonlight.Client.Interfaces; +using Moonlight.Client.Plugins; using MoonlightServers.Frontend.Implementations; using MoonlightServers.Frontend.Interfaces; namespace MoonlightServers.Frontend.Startup; +[PluginStartup] public class PluginStartup : IPluginStartup { - public Task BuildApplication(WebAssemblyHostBuilder builder) + public Task BuildApplication(IServiceProvider serviceProvider, WebAssemblyHostBuilder builder) { builder.Services.AddSingleton(); builder.Services.AddSingleton(); @@ -18,7 +20,7 @@ public class PluginStartup : IPluginStartup return Task.CompletedTask; } - public Task ConfigureApplication(WebAssemblyHost app) + public Task ConfigureApplication(IServiceProvider serviceProvider, WebAssemblyHost app) { return Task.CompletedTask; } diff --git a/MoonlightServers.Shared/MoonlightServers.Shared.csproj b/MoonlightServers.Shared/MoonlightServers.Shared.csproj index 3a63532..7edd6c0 100644 --- a/MoonlightServers.Shared/MoonlightServers.Shared.csproj +++ b/MoonlightServers.Shared/MoonlightServers.Shared.csproj @@ -4,6 +4,10 @@ net8.0 enable enable + true + 2.1.0 + MoonlightServers.Shared + shared