Files
Moonlight/Moonlight.ApiServer/Http/Controllers/ClientPlugins/ClientPluginsController.cs
Masu Baumgartner d92f996169 Started adding module service
I will probably change the api paths and a lot of other stuff i wrote today tomorrow :|
2024-11-10 22:06:19 +01:00

37 lines
955 B
C#

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
};
}
}