diff --git a/.gitignore b/.gitignore index 2e1e636d..3957075f 100644 --- a/.gitignore +++ b/.gitignore @@ -424,4 +424,5 @@ FodyWeavers.xsd storage/ Moonlight/Moonlight.Client/wwwroot/css/style.min.css /.idea/.idea.Moonlight/.idea -style.min.css \ No newline at end of file +style.min.css +core.min.css \ No newline at end of file diff --git a/Moonlight.ApiServer/Moonlight.ApiServer.csproj b/Moonlight.ApiServer/Moonlight.ApiServer.csproj index 7fb008e8..0ca265a6 100644 --- a/Moonlight.ApiServer/Moonlight.ApiServer.csproj +++ b/Moonlight.ApiServer/Moonlight.ApiServer.csproj @@ -23,7 +23,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/Moonlight.ApiServer/Services/PluginService.cs b/Moonlight.ApiServer/Services/PluginService.cs index b55fa618..2139ee53 100644 --- a/Moonlight.ApiServer/Services/PluginService.cs +++ b/Moonlight.ApiServer/Services/PluginService.cs @@ -11,6 +11,11 @@ public class PluginService private static string PluginsFolder = PathBuilder.Dir("storage", "plugins"); private readonly ILogger Logger; + private readonly JsonSerializerOptions SerializerOptions = new() + { + PropertyNameCaseInsensitive = true + }; + public PluginService(ILogger logger) { Logger = logger; @@ -34,7 +39,7 @@ public class PluginService try { var manifestText = await File.ReadAllTextAsync(manifestPath); - manifest = JsonSerializer.Deserialize(manifestText)!; + manifest = JsonSerializer.Deserialize(manifestText, SerializerOptions)!; } catch (Exception e) { diff --git a/Moonlight.Client/Moonlight.Client.csproj b/Moonlight.Client/Moonlight.Client.csproj index 87ea6e7c..57e75636 100644 --- a/Moonlight.Client/Moonlight.Client.csproj +++ b/Moonlight.Client/Moonlight.Client.csproj @@ -4,7 +4,6 @@ net8.0 enable enable - service-worker-assets.js Linux true 2.1.0 @@ -16,33 +15,41 @@ https://github.com/Moonlight-Panel/Moonlight git moonlight + + **\bin\**;**\obj\**;**\node_modules\**;**\Styles\*.json + - + - - - - + + + + - + + + + service-worker-assets.js + + + - + - - - - - - <_ContentIncludedByDefault Remove="UI\Screens\AuthenticationScreen.razor" /> + + diff --git a/Moonlight.Client/Services/ApplicationAssemblyService.cs b/Moonlight.Client/Services/ApplicationAssemblyService.cs new file mode 100644 index 00000000..f7e4eb1e --- /dev/null +++ b/Moonlight.Client/Services/ApplicationAssemblyService.cs @@ -0,0 +1,10 @@ +using System.Reflection; + +namespace Moonlight.Client.Services; + +public class ApplicationAssemblyService +{ + public Assembly[] AdditionalAssemblies { get; set; } + public Assembly[] PluginAssemblies { get; set; } + public Assembly[] NavigationAssemblies => PluginAssemblies.Concat(AdditionalAssemblies).ToArray(); +} \ No newline at end of file diff --git a/Moonlight.Client/Startup.cs b/Moonlight.Client/Startup.cs index 0c125698..e4f1a64a 100644 --- a/Moonlight.Client/Startup.cs +++ b/Moonlight.Client/Startup.cs @@ -20,7 +20,6 @@ namespace Moonlight.Client; public class Startup { private string[] Args; - private Assembly[] AdditionalAssemblies; // Logging private ILoggerProvider[] LoggerProviders; @@ -33,11 +32,17 @@ public class Startup // Plugin Loading private PluginLoaderService PluginLoaderService; + private ApplicationAssemblyService ApplicationAssemblyService; public async Task Run(string[] args, Assembly[]? assemblies = null) { Args = args; - AdditionalAssemblies = assemblies ?? []; + + // Setup assembly storage + ApplicationAssemblyService = new() + { + AdditionalAssemblies = assemblies ?? [] + }; await PrintVersion(); await SetupLogging(); @@ -124,8 +129,8 @@ public class Startup // We use moonlight itself as a plugin assembly configuration.AddAssembly(typeof(Startup).Assembly); - configuration.AddAssemblies(AdditionalAssemblies); - configuration.AddAssemblies(PluginLoaderService.PluginAssemblies); + configuration.AddAssemblies(ApplicationAssemblyService.AdditionalAssemblies); + configuration.AddAssemblies(ApplicationAssemblyService.PluginAssemblies); configuration.AddInterface(); configuration.AddInterface(); @@ -154,7 +159,9 @@ public class Startup await PluginLoaderService.Load(); // Add plugin loader service to di for the Router/App.razor - WebAssemblyHostBuilder.Services.AddSingleton(PluginLoaderService); + ApplicationAssemblyService.PluginAssemblies = PluginLoaderService.PluginAssemblies; + + WebAssemblyHostBuilder.Services.AddSingleton(ApplicationAssemblyService); } #endregion diff --git a/Moonlight.Client/Styles/build.bat b/Moonlight.Client/Styles/build.bat index 6b7e4203..d2e8ac20 100644 --- a/Moonlight.Client/Styles/build.bat +++ b/Moonlight.Client/Styles/build.bat @@ -1 +1 @@ -npx tailwindcss -i style.css -o ../wwwroot/css/style.min.css --watch \ No newline at end of file +npx tailwindcss -i style.css -o ../wwwroot/css/core.min.css --watch \ No newline at end of file diff --git a/Moonlight.Client/Styles/build.sh b/Moonlight.Client/Styles/build.sh index db176f14..e0b4d567 100755 --- a/Moonlight.Client/Styles/build.sh +++ b/Moonlight.Client/Styles/build.sh @@ -1,2 +1,2 @@ #! /bin/bash -npx tailwindcss -i style.css -o ../wwwroot/css/style.min.css --watch \ No newline at end of file +npx tailwindcss -i style.css -o ../wwwroot/css/core.min.css --watch \ No newline at end of file diff --git a/Moonlight.Client/UI/App.razor b/Moonlight.Client/UI/App.razor index fa3ba60d..970884c8 100644 --- a/Moonlight.Client/UI/App.razor +++ b/Moonlight.Client/UI/App.razor @@ -1,12 +1,12 @@ @using Moonlight.Client.UI.Layouts @using MoonCore.Blazor.Components -@using MoonCore.Plugins +@using Moonlight.Client.Services -@inject PluginLoaderService PluginLoaderService +@inject ApplicationAssemblyService ApplicationAssemblyService - + diff --git a/Moonlight.Client/wwwroot/index.html b/Moonlight.Client/wwwroot/index.html index b5710305..8d9505b4 100644 --- a/Moonlight.Client/wwwroot/index.html +++ b/Moonlight.Client/wwwroot/index.html @@ -6,7 +6,7 @@ Moonlight.Client - +