Skip to content

Commit 9ab69ff

Browse files
committed
Upgraded mooncore versions. Cleaned up code, especially startup code. Changed versions
1 parent d2ef59d commit 9ab69ff

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+424
-627
lines changed

Moonlight.ApiServer.Runtime/Moonlight.ApiServer.Runtime.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<PrivateAssets>all</PrivateAssets>
1919
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2020
</PackageReference>
21-
<PackageReference Include="MoonCore.PluginFramework" Version="1.0.8" />
21+
<PackageReference Include="MoonCore.PluginFramework" Version="1.0.9" />
2222
</ItemGroup>
2323

2424
<Import Project="Plugins.props" />
Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,25 @@
1-
using Moonlight.ApiServer.Runtime;
1+
using Moonlight.ApiServer.Configuration;
2+
using Moonlight.ApiServer.Runtime;
23
using Moonlight.ApiServer.Startup;
34

45
var pluginLoader = new PluginLoader();
56
pluginLoader.Initialize();
6-
/*
7-
await startup.Run(args, pluginLoader.Instances);
8-
9-
*/
10-
11-
var cs = new Startup();
12-
13-
await cs.InitializeAsync(args, pluginLoader.Instances);
147

158
var builder = WebApplication.CreateBuilder(args);
169

17-
await cs.AddMoonlightAsync(builder);
10+
builder.AddMoonlight(pluginLoader.Instances);
1811

1912
var app = builder.Build();
2013

21-
await cs.AddMoonlightAsync(app);
14+
app.UseMoonlight(pluginLoader.Instances);
15+
16+
// Add frontend
17+
var configuration = AppConfiguration.CreateEmpty();
18+
builder.Configuration.Bind(configuration);
2219

2320
// Handle setup of wasm app hosting in the runtime
2421
// so the Moonlight.ApiServer doesn't need the wasm package
25-
if (cs.Configuration.Frontend.EnableHosting)
22+
if (configuration.Frontend.EnableHosting)
2623
{
2724
if (app.Environment.IsDevelopment())
2825
app.UseWebAssemblyDebugging();
@@ -31,5 +28,7 @@
3128
app.UseStaticFiles();
3229
}
3330

31+
app.MapMoonlight(pluginLoader.Instances);
32+
3433

3534
await app.RunAsync();

Moonlight.ApiServer/Http/Controllers/Admin/ApiKeys/ApiKeysController.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
using Microsoft.AspNetCore.Authorization;
22
using Microsoft.AspNetCore.Mvc;
33
using Microsoft.EntityFrameworkCore;
4+
using MoonCore.Common;
45
using MoonCore.Extended.Abstractions;
5-
using MoonCore.Models;
66
using Moonlight.ApiServer.Database.Entities;
77
using Moonlight.ApiServer.Mappers;
88
using Moonlight.ApiServer.Services;
@@ -26,7 +26,7 @@ public ApiKeysController(DatabaseRepository<ApiKey> apiKeyRepository, ApiKeyServ
2626

2727
[HttpGet]
2828
[Authorize(Policy = "permissions:admin.apikeys.get")]
29-
public async Task<ActionResult<ICountedData<ApiKeyResponse>>> GetAsync(
29+
public async Task<ActionResult<CountedData<ApiKeyResponse>>> GetAsync(
3030
[FromQuery] int startIndex,
3131
[FromQuery] int count,
3232
[FromQuery] string? orderBy,

Moonlight.ApiServer/Http/Controllers/Admin/Sys/Customisation/ThemesController.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
using System.ComponentModel.DataAnnotations;
2-
using Microsoft.AspNetCore.Authorization;
1+
using Microsoft.AspNetCore.Authorization;
32
using Microsoft.AspNetCore.Mvc;
43
using Microsoft.EntityFrameworkCore;
5-
using MoonCore.Exceptions;
4+
using MoonCore.Common;
65
using MoonCore.Extended.Abstractions;
7-
using MoonCore.Extended.Models;
8-
using MoonCore.Models;
96
using Moonlight.ApiServer.Database.Entities;
107
using Moonlight.ApiServer.Mappers;
118
using Moonlight.Shared.Http.Requests.Admin.Sys.Theme;
@@ -26,7 +23,7 @@ public ThemesController(DatabaseRepository<Theme> themeRepository)
2623

2724
[HttpGet]
2825
[Authorize(Policy = "permissions:admin.system.customisation.themes.read")]
29-
public async Task<ActionResult<ICountedData<ThemeResponse>>> GetAsync(
26+
public async Task<ActionResult<CountedData<ThemeResponse>>> GetAsync(
3027
[FromQuery] int startIndex,
3128
[FromQuery] int count,
3229
[FromQuery] string? orderBy,

Moonlight.ApiServer/Http/Controllers/Admin/Sys/DiagnoseController.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using Microsoft.AspNetCore.Authorization;
2-
using Microsoft.AspNetCore.Http;
32
using Microsoft.AspNetCore.Mvc;
43
using Moonlight.ApiServer.Services;
54
using Moonlight.Shared.Http.Requests.Admin.Sys;

Moonlight.ApiServer/Http/Controllers/Admin/Users/UsersController.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
using Microsoft.AspNetCore.Mvc;
33
using Microsoft.EntityFrameworkCore;
44
using Microsoft.Extensions.DependencyInjection;
5-
using MoonCore.Exceptions;
5+
using MoonCore.Common;
66
using MoonCore.Extended.Abstractions;
77
using MoonCore.Extended.Helpers;
8-
using MoonCore.Models;
98
using Moonlight.ApiServer.Database.Entities;
109
using Moonlight.ApiServer.Services;
1110
using Moonlight.ApiServer.Mappers;
@@ -27,7 +26,7 @@ public UsersController(DatabaseRepository<User> userRepository)
2726

2827
[HttpGet]
2928
[Authorize(Policy = "permissions:admin.users.get")]
30-
public async Task<ActionResult<ICountedData<UserResponse>>> GetAsync(
29+
public async Task<ActionResult<CountedData<UserResponse>>> GetAsync(
3130
[FromQuery] int startIndex,
3231
[FromQuery] int count,
3332
[FromQuery] string? orderBy,

Moonlight.ApiServer/Http/Controllers/Auth/AuthController.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using Microsoft.AspNetCore.Http;
55
using Microsoft.AspNetCore.Mvc;
66
using Moonlight.ApiServer.Configuration;
7-
using Moonlight.ApiServer.Implementations.LocalAuth;
87
using Moonlight.ApiServer.Interfaces;
98
using Moonlight.Shared.Http.Responses.Auth;
109

Moonlight.ApiServer/Http/Controllers/Frontend/FrontendPage.razor

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
@using Moonlight.ApiServer.Database.Entities
2-
@using Moonlight.Shared.Misc
32

43
<!DOCTYPE html>
54
<html lang="en" class="bg-background text-base-content font-inter">

Moonlight.ApiServer/Http/Controllers/LocalAuth/LocalAuthController.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
using System.Security.Claims;
22
using Microsoft.AspNetCore.Authentication;
3-
using Microsoft.AspNetCore.Http;
43
using Microsoft.AspNetCore.Mvc;
54
using Microsoft.EntityFrameworkCore;
65
using Microsoft.Extensions.Logging;
76
using Microsoft.Extensions.Options;
8-
using MoonCore.Exceptions;
97
using MoonCore.Extended.Abstractions;
108
using MoonCore.Extended.Helpers;
119
using MoonCore.Helpers;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
namespace Moonlight.ApiServer;
2+
3+
public interface IAssemblyMarker;

0 commit comments

Comments
 (0)