Fixed bundling. Upgraded mooncore.extended

This commit is contained in:
2025-02-26 22:32:02 +01:00
parent caa8d47af2
commit 6c5e4c2a1e
5 changed files with 18 additions and 12 deletions

View File

@@ -10,12 +10,10 @@ namespace Moonlight.ApiServer.Implementations.Startup;
public class CoreStartup : IPluginStartup
{
private readonly AppConfiguration Configuration;
private readonly BundleService BundleService;
public CoreStartup(AppConfiguration configuration, BundleService bundleService)
public CoreStartup(AppConfiguration configuration)
{
Configuration = configuration;
BundleService = bundleService;
}
public Task BuildApplication(IHostApplicationBuilder builder)
@@ -35,15 +33,9 @@ public class CoreStartup : IPluginStartup
#endregion
#region Assets
BundleService.BundleCss("css/core.min.css");
#endregion
#region Database
builder.Services.AddDbContext<DbContext, CoreDataContext>();
builder.Services.AddDbContext<CoreDataContext>();
#endregion

View File

@@ -25,7 +25,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="MoonCore" Version="1.8.3" />
<PackageReference Include="MoonCore.Extended" Version="1.2.9" />
<PackageReference Include="MoonCore.Extended" Version="1.3.0" />
<PackageReference Include="MoonCore.PluginFramework" Version="1.0.5" />
<PackageReference Include="SharpZipLib" Version="1.4.2" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0"/>

View File

@@ -134,7 +134,7 @@ public class BundleGenerationService : IHostedService
if (mainStylesheet.ImportRules.Any(x => x.Text == importRule.Text))
continue;
content += importRule.StylesheetText.Text + "\n";
content = importRule.StylesheetText.Text + "\n" + content;
}
// Media Rules

View File

@@ -126,6 +126,9 @@ public class PluginService
PathBuilder.Dir(pluginFolder, "wwwroot")
);
if(!Directory.Exists(wwwRootPath))
continue;
wwwRootProviders.Add(
new PhysicalFileProvider(wwwRootPath)
);

View File

@@ -69,6 +69,7 @@ public class Startup
await CreateStorage();
await SetupAppConfiguration();
await SetupLogging();
await SetupBundling();
await LoadPlugins();
await InitializePlugins();
@@ -126,6 +127,15 @@ public class Startup
return Task.CompletedTask;
}
private Task SetupBundling()
{
BundleService = new();
BundleService.BundleCss("css/core.min.css");
return Task.CompletedTask;
}
#region Base
private Task RegisterBase()
@@ -490,6 +500,7 @@ public class Startup
private async Task RegisterDatabase()
{
WebApplicationBuilder.Services.AddDatabaseMappings();
WebApplicationBuilder.Services.AddServiceCollectionAccessor();
WebApplicationBuilder.Services.AddScoped(typeof(DatabaseRepository<>));
WebApplicationBuilder.Services.AddScoped(typeof(CrudHelper<,>));