Moved client api routes to client name space
This commit is contained in:
@@ -3,16 +3,15 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using MoonCore.Exceptions;
|
||||
using MoonCore.Extended.Abstractions;
|
||||
using MoonCore.Extensions;
|
||||
using MoonCore.Helpers;
|
||||
using MoonlightServers.ApiServer.Database.Entities;
|
||||
using MoonlightServers.ApiServer.Services;
|
||||
|
||||
namespace MoonlightServers.ApiServer.Http.Controllers.Users;
|
||||
namespace MoonlightServers.ApiServer.Http.Controllers.Client;
|
||||
|
||||
[ApiController]
|
||||
[Authorize]
|
||||
[Route("api/servers")]
|
||||
[Route("api/client/servers")]
|
||||
public class ServerPowerController : Controller
|
||||
{
|
||||
private readonly DatabaseRepository<Server> ServerRepository;
|
||||
@@ -1,23 +1,20 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using MoonCore.Extended.PermFilter;
|
||||
using MoonCore.Exceptions;
|
||||
using MoonCore.Extended.Abstractions;
|
||||
using MoonCore.Extensions;
|
||||
using MoonCore.Helpers;
|
||||
using MoonCore.Models;
|
||||
using Moonlight.ApiServer.Database.Entities;
|
||||
using MoonlightServers.ApiServer.Database.Entities;
|
||||
using MoonlightServers.ApiServer.Extensions;
|
||||
using MoonlightServers.ApiServer.Services;
|
||||
using MoonlightServers.Shared.Http.Responses.User.Allocations;
|
||||
using MoonlightServers.Shared.Http.Responses.Users.Servers;
|
||||
|
||||
namespace MoonlightServers.ApiServer.Http.Controllers.Users;
|
||||
namespace MoonlightServers.ApiServer.Http.Controllers.Client;
|
||||
|
||||
[ApiController]
|
||||
[Route("api/servers")]
|
||||
[Route("api/client/servers")]
|
||||
public class ServersController : Controller
|
||||
{
|
||||
private readonly DatabaseRepository<Server> ServerRepository;
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Http\Middleware\" />
|
||||
<Folder Include="storage\volumes\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -40,4 +41,14 @@
|
||||
<None Remove="data\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<_ContentIncludedByDefault Remove="storage\volumes\2\banned-ips.json" />
|
||||
<_ContentIncludedByDefault Remove="storage\volumes\2\banned-players.json" />
|
||||
<_ContentIncludedByDefault Remove="storage\volumes\2\ops.json" />
|
||||
<_ContentIncludedByDefault Remove="storage\volumes\2\plugins\spark\config.json" />
|
||||
<_ContentIncludedByDefault Remove="storage\volumes\2\usercache.json" />
|
||||
<_ContentIncludedByDefault Remove="storage\volumes\2\version_history.json" />
|
||||
<_ContentIncludedByDefault Remove="storage\volumes\2\whitelist.json" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -159,7 +159,7 @@
|
||||
try
|
||||
{
|
||||
Status = await ApiClient.GetJson<ServerStatusResponse>(
|
||||
$"api/servers/{Server.Id}/status"
|
||||
$"api/client/servers/{Server.Id}/status"
|
||||
);
|
||||
}
|
||||
catch (Exception e)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
@using Microsoft.AspNetCore.SignalR.Client
|
||||
@using MoonlightServers.Frontend.UI.Views.User
|
||||
@using MoonlightServers.Frontend.UI.Views.Client
|
||||
@using MoonlightServers.Shared.Enums
|
||||
@using MoonlightServers.Shared.Http.Responses.Users.Servers
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
await AlertService.ConfirmDanger(
|
||||
"Server installation",
|
||||
"Do you really want to reinstall the server? This can potentially lead to loss of data",
|
||||
() => HttpApiClient.Post($"api/servers/{Server.Id}/install")
|
||||
() => HttpApiClient.Post($"api/client/servers/{Server.Id}/install")
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -43,7 +43,7 @@
|
||||
{
|
||||
Servers = await PagedData<ServerDetailResponse>.All(async (page, pageSize) =>
|
||||
await ApiClient.GetJson<PagedData<ServerDetailResponse>>(
|
||||
$"api/servers?page={page}&pageSize={pageSize}"
|
||||
$"api/client/servers?page={page}&pageSize={pageSize}"
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -165,7 +165,7 @@
|
||||
{
|
||||
// Load meta data
|
||||
Server = await ApiClient.GetJson<ServerDetailResponse>(
|
||||
$"api/servers/{ServerId}"
|
||||
$"api/client/servers/{ServerId}"
|
||||
);
|
||||
|
||||
// Load server tabs
|
||||
@@ -174,14 +174,14 @@
|
||||
|
||||
// Load initial status for first render
|
||||
var status = await ApiClient.GetJson<ServerStatusResponse>(
|
||||
$"api/servers/{ServerId}/status"
|
||||
$"api/client/servers/{ServerId}/status"
|
||||
);
|
||||
|
||||
State = status.State;
|
||||
|
||||
// Load initial messages
|
||||
var initialLogs = await ApiClient.GetJson<ServerLogsResponse>(
|
||||
$"api/servers/{ServerId}/logs"
|
||||
$"api/client/servers/{ServerId}/logs"
|
||||
);
|
||||
|
||||
InitialConsoleMessage = "";
|
||||
@@ -191,7 +191,7 @@
|
||||
|
||||
// Load websocket meta
|
||||
var websocketDetails = await ApiClient.GetJson<ServerWebSocketResponse>(
|
||||
$"api/servers/{ServerId}/ws"
|
||||
$"api/client/servers/{ServerId}/ws"
|
||||
);
|
||||
|
||||
// Build signal r
|
||||
@@ -232,13 +232,13 @@
|
||||
}
|
||||
|
||||
private async Task Start()
|
||||
=> await ApiClient.Post($"api/servers/{Server.Id}/start");
|
||||
=> await ApiClient.Post($"api/client/servers/{Server.Id}/start");
|
||||
|
||||
private async Task Stop()
|
||||
=> await ApiClient.Post($"api/servers/{Server.Id}/stop");
|
||||
=> await ApiClient.Post($"api/client/servers/{Server.Id}/stop");
|
||||
|
||||
private async Task Kill()
|
||||
=> await ApiClient.Post($"api/servers/{Server.Id}/kill");
|
||||
=> await ApiClient.Post($"api/client/servers/{Server.Id}/kill");
|
||||
|
||||
public async ValueTask DisposeAsync()
|
||||
{
|
||||
Reference in New Issue
Block a user