Fixed plugin loader usage. Improved export for nuget. Changed css name
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -425,3 +425,4 @@ storage/
|
||||
Moonlight/Moonlight.Client/wwwroot/css/style.min.css
|
||||
/.idea/.idea.Moonlight/.idea
|
||||
style.min.css
|
||||
core.min.css
|
||||
@@ -23,7 +23,7 @@
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="MoonCore" Version="1.7.8" />
|
||||
<PackageReference Include="MoonCore" Version="1.7.9" />
|
||||
<PackageReference Include="MoonCore.Extended" Version="1.2.2" />
|
||||
<PackageReference Include="MoonCore.PluginFramework" Version="1.0.5" />
|
||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.2" />
|
||||
|
||||
@@ -11,6 +11,11 @@ public class PluginService
|
||||
private static string PluginsFolder = PathBuilder.Dir("storage", "plugins");
|
||||
private readonly ILogger<PluginService> Logger;
|
||||
|
||||
private readonly JsonSerializerOptions SerializerOptions = new()
|
||||
{
|
||||
PropertyNameCaseInsensitive = true
|
||||
};
|
||||
|
||||
public PluginService(ILogger<PluginService> logger)
|
||||
{
|
||||
Logger = logger;
|
||||
@@ -34,7 +39,7 @@ public class PluginService
|
||||
try
|
||||
{
|
||||
var manifestText = await File.ReadAllTextAsync(manifestPath);
|
||||
manifest = JsonSerializer.Deserialize<PluginManifest>(manifestText)!;
|
||||
manifest = JsonSerializer.Deserialize<PluginManifest>(manifestText, SerializerOptions)!;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
<IsPackable>true</IsPackable>
|
||||
<Version>2.1.0</Version>
|
||||
@@ -16,33 +15,41 @@
|
||||
<RepositoryUrl>https://github.com/Moonlight-Panel/Moonlight</RepositoryUrl>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<PackageTags>moonlight</PackageTags>
|
||||
<DefaultItemExcludes>
|
||||
**\bin\**;**\obj\**;**\node_modules\**;**\Styles\*.json
|
||||
</DefaultItemExcludes>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Blazor-ApexCharts" Version="3.5.0" />
|
||||
<PackageReference Include="Blazor-ApexCharts" Version="3.5.0"/>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.10"/>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.10" PrivateAssets="all"/>
|
||||
<PackageReference Include="MoonCore" Version="1.7.8" />
|
||||
<PackageReference Include="MoonCore.Blazor" Version="1.2.7" />
|
||||
<PackageReference Include="MoonCore.PluginFramework" Version="1.0.5" />
|
||||
<PackageReference Include="MoonCore.Blazor.Tailwind" Version="1.1.4" />
|
||||
<PackageReference Include="MoonCore" Version="1.7.9"/>
|
||||
<PackageReference Include="MoonCore.Blazor" Version="1.2.7"/>
|
||||
<PackageReference Include="MoonCore.PluginFramework" Version="1.0.5"/>
|
||||
<PackageReference Include="MoonCore.Blazor.Tailwind" Version="1.1.4"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<!--
|
||||
Specify the /p:BuildPWA=true flag to build moonlight as a PWA.
|
||||
This flag is by default disabled to allow nuget package generation
|
||||
-->
|
||||
|
||||
<PropertyGroup Condition="'$(BuildPWA)' == 'true'">
|
||||
<ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition="'$(BuildPWA)' == 'true'">
|
||||
<ServiceWorker Include="wwwroot\service-worker.js" PublishedContent="wwwroot\service-worker.published.js"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Moonlight.Shared\Moonlight.Shared.csproj" />
|
||||
<ProjectReference Include="..\Moonlight.Shared\Moonlight.Shared.csproj"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Helpers\" />
|
||||
<Folder Include="wwwroot\css\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<_ContentIncludedByDefault Remove="UI\Screens\AuthenticationScreen.razor" />
|
||||
<Folder Include="Helpers\"/>
|
||||
<Folder Include="wwwroot\css\"/>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
10
Moonlight.Client/Services/ApplicationAssemblyService.cs
Normal file
10
Moonlight.Client/Services/ApplicationAssemblyService.cs
Normal file
@@ -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();
|
||||
}
|
||||
@@ -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<IAppLoader>();
|
||||
configuration.AddInterface<IAppScreen>();
|
||||
@@ -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
|
||||
|
||||
@@ -1 +1 @@
|
||||
npx tailwindcss -i style.css -o ../wwwroot/css/style.min.css --watch
|
||||
npx tailwindcss -i style.css -o ../wwwroot/css/core.min.css --watch
|
||||
@@ -1,2 +1,2 @@
|
||||
#! /bin/bash
|
||||
npx tailwindcss -i style.css -o ../wwwroot/css/style.min.css --watch
|
||||
npx tailwindcss -i style.css -o ../wwwroot/css/core.min.css --watch
|
||||
@@ -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
|
||||
|
||||
<ErrorLogger>
|
||||
<OAuth2AuthenticationHandler>
|
||||
<Router AppAssembly="@typeof(App).Assembly" AdditionalAssemblies="PluginLoaderService.PluginAssemblies">
|
||||
<Router AppAssembly="@typeof(App).Assembly" AdditionalAssemblies="ApplicationAssemblyService.NavigationAssemblies">
|
||||
<Found Context="routeData">
|
||||
<CascadingValue Name="TargetPageType" Value="routeData.PageType">
|
||||
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)"/>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Moonlight.Client</title>
|
||||
<base href="/" />
|
||||
<link rel="stylesheet" href="/css/style.min.css" />
|
||||
<link rel="stylesheet" href="/css/core.min.css" />
|
||||
<link href="manifest.webmanifest" rel="manifest" />
|
||||
<link rel="apple-touch-icon" sizes="512x512" href="icon-512.png" />
|
||||
<link rel="apple-touch-icon" sizes="192x192" href="icon-192.png" />
|
||||
|
||||
Reference in New Issue
Block a user