Started adding module service

I will probably change the api paths and a lot of other stuff i wrote today tomorrow :|
This commit is contained in:
Masu Baumgartner
2024-11-10 22:06:19 +01:00
parent 96bb3a5c0f
commit d92f996169
5 changed files with 177 additions and 13 deletions

View File

@@ -0,0 +1,37 @@
using Microsoft.AspNetCore.Mvc;
using Moonlight.ApiServer.Services;
using Moonlight.Shared.Http.Responses.ClientPlugins;
namespace Moonlight.ApiServer.Http.Controllers.ClientPlugins;
[ApiController]
[Route("api/clientPlugins")]
public class ClientPluginsController : Controller
{
private readonly ModuleService ModuleService;
public ClientPluginsController(ModuleService moduleService)
{
ModuleService = moduleService;
}
[HttpGet]
public async Task<ClientPluginsResponse> Get()
{
var dlls = ModuleService.Modules
.Where(x => x.Modules.ContainsKey("client"))
.SelectMany(x =>
x.Modules
.FirstOrDefault(c => c.Key == "client")
.Value
.Select(y => x.Name + "." + y)
)
.ToArray();
return new()
{
CacheKey = "unset",
Dlls = dlls
};
}
}