Refactored ui. Improved console experience. Added command endpoint

This commit is contained in:
2025-07-18 21:16:52 +02:00
parent f8c11b2dd8
commit 265a4b280b
43 changed files with 479 additions and 149 deletions

View File

@@ -11,6 +11,7 @@ using MoonlightServers.ApiServer.Extensions;
using MoonlightServers.ApiServer.Models;
using MoonlightServers.ApiServer.Services;
using MoonlightServers.Shared.Enums;
using MoonlightServers.Shared.Http.Requests.Client.Servers;
using MoonlightServers.Shared.Http.Responses.Client.Servers;
using MoonlightServers.Shared.Http.Responses.Client.Servers.Allocations;
using MoonlightServers.Shared.Models;
@@ -293,6 +294,17 @@ public class ServersController : Controller
};
}
[HttpPost("{serverId:int}/command")]
public async Task RunCommand([FromRoute] int serverId, [FromBody] ServerCommandRequest request)
{
var server = await GetServerById(
serverId,
permission => permission is { Name: "console", Type: >= ServerPermissionType.ReadWrite }
);
await ServerService.RunCommand(server, request.Command);
}
private async Task<Server> GetServerById(int serverId, Func<ServerSharePermission, bool>? filter = null)
{
var server = await ServerRepository