Implemented zip and tar compressing and decompressing. Implemented chunked file uploading

This commit is contained in:
2025-03-24 22:15:05 +01:00
parent 4046579c42
commit f56f94a03b
18 changed files with 573 additions and 55 deletions

View File

@@ -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)