Fixed plugin loader usage. Improved export for nuget. Changed css name
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -424,4 +424,5 @@ FodyWeavers.xsd
|
|||||||
storage/
|
storage/
|
||||||
Moonlight/Moonlight.Client/wwwroot/css/style.min.css
|
Moonlight/Moonlight.Client/wwwroot/css/style.min.css
|
||||||
/.idea/.idea.Moonlight/.idea
|
/.idea/.idea.Moonlight/.idea
|
||||||
style.min.css
|
style.min.css
|
||||||
|
core.min.css
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</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.Extended" Version="1.2.2" />
|
||||||
<PackageReference Include="MoonCore.PluginFramework" Version="1.0.5" />
|
<PackageReference Include="MoonCore.PluginFramework" Version="1.0.5" />
|
||||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.2" />
|
<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 static string PluginsFolder = PathBuilder.Dir("storage", "plugins");
|
||||||
private readonly ILogger<PluginService> Logger;
|
private readonly ILogger<PluginService> Logger;
|
||||||
|
|
||||||
|
private readonly JsonSerializerOptions SerializerOptions = new()
|
||||||
|
{
|
||||||
|
PropertyNameCaseInsensitive = true
|
||||||
|
};
|
||||||
|
|
||||||
public PluginService(ILogger<PluginService> logger)
|
public PluginService(ILogger<PluginService> logger)
|
||||||
{
|
{
|
||||||
Logger = logger;
|
Logger = logger;
|
||||||
@@ -34,7 +39,7 @@ public class PluginService
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var manifestText = await File.ReadAllTextAsync(manifestPath);
|
var manifestText = await File.ReadAllTextAsync(manifestPath);
|
||||||
manifest = JsonSerializer.Deserialize<PluginManifest>(manifestText)!;
|
manifest = JsonSerializer.Deserialize<PluginManifest>(manifestText, SerializerOptions)!;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
|
|
||||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||||
<IsPackable>true</IsPackable>
|
<IsPackable>true</IsPackable>
|
||||||
<Version>2.1.0</Version>
|
<Version>2.1.0</Version>
|
||||||
@@ -16,33 +15,41 @@
|
|||||||
<RepositoryUrl>https://github.com/Moonlight-Panel/Moonlight</RepositoryUrl>
|
<RepositoryUrl>https://github.com/Moonlight-Panel/Moonlight</RepositoryUrl>
|
||||||
<RepositoryType>git</RepositoryType>
|
<RepositoryType>git</RepositoryType>
|
||||||
<PackageTags>moonlight</PackageTags>
|
<PackageTags>moonlight</PackageTags>
|
||||||
|
<DefaultItemExcludes>
|
||||||
|
**\bin\**;**\obj\**;**\node_modules\**;**\Styles\*.json
|
||||||
|
</DefaultItemExcludes>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<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" Version="8.0.10"/>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.10" PrivateAssets="all"/>
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.10" PrivateAssets="all"/>
|
||||||
<PackageReference Include="MoonCore" Version="1.7.8" />
|
<PackageReference Include="MoonCore" Version="1.7.9"/>
|
||||||
<PackageReference Include="MoonCore.Blazor" Version="1.2.7" />
|
<PackageReference Include="MoonCore.Blazor" Version="1.2.7"/>
|
||||||
<PackageReference Include="MoonCore.PluginFramework" Version="1.0.5" />
|
<PackageReference Include="MoonCore.PluginFramework" Version="1.0.5"/>
|
||||||
<PackageReference Include="MoonCore.Blazor.Tailwind" Version="1.1.4" />
|
<PackageReference Include="MoonCore.Blazor.Tailwind" Version="1.1.4"/>
|
||||||
</ItemGroup>
|
</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"/>
|
<ServiceWorker Include="wwwroot\service-worker.js" PublishedContent="wwwroot\service-worker.published.js"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Moonlight.Shared\Moonlight.Shared.csproj" />
|
<ProjectReference Include="..\Moonlight.Shared\Moonlight.Shared.csproj"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="Helpers\" />
|
<Folder Include="Helpers\"/>
|
||||||
<Folder Include="wwwroot\css\" />
|
<Folder Include="wwwroot\css\"/>
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<_ContentIncludedByDefault Remove="UI\Screens\AuthenticationScreen.razor" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</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
|
public class Startup
|
||||||
{
|
{
|
||||||
private string[] Args;
|
private string[] Args;
|
||||||
private Assembly[] AdditionalAssemblies;
|
|
||||||
|
|
||||||
// Logging
|
// Logging
|
||||||
private ILoggerProvider[] LoggerProviders;
|
private ILoggerProvider[] LoggerProviders;
|
||||||
@@ -33,11 +32,17 @@ public class Startup
|
|||||||
|
|
||||||
// Plugin Loading
|
// Plugin Loading
|
||||||
private PluginLoaderService PluginLoaderService;
|
private PluginLoaderService PluginLoaderService;
|
||||||
|
private ApplicationAssemblyService ApplicationAssemblyService;
|
||||||
|
|
||||||
public async Task Run(string[] args, Assembly[]? assemblies = null)
|
public async Task Run(string[] args, Assembly[]? assemblies = null)
|
||||||
{
|
{
|
||||||
Args = args;
|
Args = args;
|
||||||
AdditionalAssemblies = assemblies ?? [];
|
|
||||||
|
// Setup assembly storage
|
||||||
|
ApplicationAssemblyService = new()
|
||||||
|
{
|
||||||
|
AdditionalAssemblies = assemblies ?? []
|
||||||
|
};
|
||||||
|
|
||||||
await PrintVersion();
|
await PrintVersion();
|
||||||
await SetupLogging();
|
await SetupLogging();
|
||||||
@@ -124,8 +129,8 @@ public class Startup
|
|||||||
// We use moonlight itself as a plugin assembly
|
// We use moonlight itself as a plugin assembly
|
||||||
configuration.AddAssembly(typeof(Startup).Assembly);
|
configuration.AddAssembly(typeof(Startup).Assembly);
|
||||||
|
|
||||||
configuration.AddAssemblies(AdditionalAssemblies);
|
configuration.AddAssemblies(ApplicationAssemblyService.AdditionalAssemblies);
|
||||||
configuration.AddAssemblies(PluginLoaderService.PluginAssemblies);
|
configuration.AddAssemblies(ApplicationAssemblyService.PluginAssemblies);
|
||||||
|
|
||||||
configuration.AddInterface<IAppLoader>();
|
configuration.AddInterface<IAppLoader>();
|
||||||
configuration.AddInterface<IAppScreen>();
|
configuration.AddInterface<IAppScreen>();
|
||||||
@@ -154,7 +159,9 @@ public class Startup
|
|||||||
await PluginLoaderService.Load();
|
await PluginLoaderService.Load();
|
||||||
|
|
||||||
// Add plugin loader service to di for the Router/App.razor
|
// Add plugin loader service to di for the Router/App.razor
|
||||||
WebAssemblyHostBuilder.Services.AddSingleton(PluginLoaderService);
|
ApplicationAssemblyService.PluginAssemblies = PluginLoaderService.PluginAssemblies;
|
||||||
|
|
||||||
|
WebAssemblyHostBuilder.Services.AddSingleton(ApplicationAssemblyService);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#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
|
#! /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 Moonlight.Client.UI.Layouts
|
||||||
@using MoonCore.Blazor.Components
|
@using MoonCore.Blazor.Components
|
||||||
@using MoonCore.Plugins
|
@using Moonlight.Client.Services
|
||||||
|
|
||||||
@inject PluginLoaderService PluginLoaderService
|
@inject ApplicationAssemblyService ApplicationAssemblyService
|
||||||
|
|
||||||
<ErrorLogger>
|
<ErrorLogger>
|
||||||
<OAuth2AuthenticationHandler>
|
<OAuth2AuthenticationHandler>
|
||||||
<Router AppAssembly="@typeof(App).Assembly" AdditionalAssemblies="PluginLoaderService.PluginAssemblies">
|
<Router AppAssembly="@typeof(App).Assembly" AdditionalAssemblies="ApplicationAssemblyService.NavigationAssemblies">
|
||||||
<Found Context="routeData">
|
<Found Context="routeData">
|
||||||
<CascadingValue Name="TargetPageType" Value="routeData.PageType">
|
<CascadingValue Name="TargetPageType" Value="routeData.PageType">
|
||||||
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)"/>
|
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)"/>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Moonlight.Client</title>
|
<title>Moonlight.Client</title>
|
||||||
<base href="/" />
|
<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 href="manifest.webmanifest" rel="manifest" />
|
||||||
<link rel="apple-touch-icon" sizes="512x512" href="icon-512.png" />
|
<link rel="apple-touch-icon" sizes="512x512" href="icon-512.png" />
|
||||||
<link rel="apple-touch-icon" sizes="192x192" href="icon-192.png" />
|
<link rel="apple-touch-icon" sizes="192x192" href="icon-192.png" />
|
||||||
|
|||||||
Reference in New Issue
Block a user