Implemented zip and tar compressing and decompressing. Implemented chunked file uploading
This commit is contained in:
@@ -4,7 +4,9 @@ using MoonCore.Attributes;
|
||||
using MoonCore.Extended.Abstractions;
|
||||
using MoonCore.Helpers;
|
||||
using MoonlightServers.ApiServer.Database.Entities;
|
||||
using MoonlightServers.DaemonShared.DaemonSide.Http.Requests;
|
||||
using MoonlightServers.DaemonShared.DaemonSide.Http.Responses.Servers;
|
||||
using MoonlightServers.DaemonShared.Enums;
|
||||
|
||||
namespace MoonlightServers.ApiServer.Services;
|
||||
|
||||
@@ -59,6 +61,36 @@ public class ServerFileSystemService
|
||||
);
|
||||
}
|
||||
|
||||
public async Task Compress(Server server, CompressType type, string[] items, string destination)
|
||||
{
|
||||
using var apiClient = await GetApiClient(server);
|
||||
|
||||
await apiClient.Post(
|
||||
$"api/servers/{server.Id}/files/compress",
|
||||
new ServerFilesCompressRequest()
|
||||
{
|
||||
Type = type,
|
||||
Items = items,
|
||||
Destination = destination
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public async Task Decompress(Server server, CompressType type, string path, string destination)
|
||||
{
|
||||
using var apiClient = await GetApiClient(server);
|
||||
|
||||
await apiClient.Post(
|
||||
$"api/servers/{server.Id}/files/decompress",
|
||||
new ServerFilesDecompressRequest()
|
||||
{
|
||||
Type = type,
|
||||
Path = path,
|
||||
Destination = destination
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
#region Helpers
|
||||
|
||||
private async Task<HttpApiClient> GetApiClient(Server server)
|
||||
|
||||
Reference in New Issue
Block a user