Recreated plugin with new project template. Started implementing server system daemon
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
namespace MoonlightServers.Shared.Constants;
|
||||
|
||||
public class ServerPermissionConstants
|
||||
{
|
||||
public const string Console = "console";
|
||||
public const string Power = "power";
|
||||
public const string Shares = "shares";
|
||||
public const string Files = "files";
|
||||
public const string Variables = "variables";
|
||||
public const string Settings = "settings";
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace MoonlightServers.Shared.Enums;
|
||||
|
||||
public enum FileParsers
|
||||
{
|
||||
File = 0,
|
||||
Properties = 1
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
namespace MoonlightServers.Shared.Enums;
|
||||
|
||||
public enum ServerPermissionLevel
|
||||
{
|
||||
None = -1,
|
||||
Read = 0,
|
||||
ReadWrite = 1
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
namespace MoonlightServers.Shared.Enums;
|
||||
|
||||
public enum ServerState
|
||||
{
|
||||
Offline = 0,
|
||||
Starting = 1,
|
||||
Online = 2,
|
||||
Stopping = 3,
|
||||
Installing = 4
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
namespace MoonlightServers.Shared.Enums;
|
||||
|
||||
public enum StarVariableType
|
||||
{
|
||||
Text = 0,
|
||||
Number = 1,
|
||||
Toggle = 2,
|
||||
Select = 3
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MoonlightServers.Shared.Http.Requests.Admin.NodeAllocations;
|
||||
|
||||
public class CreateNodeAllocationRangeRequest
|
||||
{
|
||||
[Required(ErrorMessage = "You need to provide an ip address")]
|
||||
[RegularExpression(@"^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$", ErrorMessage = "You need to provide a valid ip address")]
|
||||
public string IpAddress { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "You need to provide a start port")]
|
||||
[Range(1, 65535, ErrorMessage = "You need to provide a valid start port")]
|
||||
public int Start { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "You need to provide a end port")]
|
||||
[Range(1, 65535, ErrorMessage = "You need to provide a valid end port")]
|
||||
public int End { get; set; }
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MoonlightServers.Shared.Http.Requests.Admin.NodeAllocations;
|
||||
|
||||
public class CreateNodeAllocationRequest
|
||||
{
|
||||
[Required(ErrorMessage = "You need to provide an ip address")]
|
||||
[RegularExpression(@"^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$", ErrorMessage = "You need to provide a valid ip address")]
|
||||
public string IpAddress { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "You need to provide a port")]
|
||||
[Range(1, 65535, ErrorMessage = "You need to provide a valid port")]
|
||||
public int Port { get; set; }
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MoonlightServers.Shared.Http.Requests.Admin.NodeAllocations;
|
||||
|
||||
public class UpdateNodeAllocationRequest
|
||||
{
|
||||
[Required(ErrorMessage = "You need to provide an ip address")]
|
||||
[RegularExpression(@"^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$", ErrorMessage = "You need to provide a valid ip address")]
|
||||
public string IpAddress { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "You need to provide a port")]
|
||||
[Range(1, 65535, ErrorMessage = "You need to provide a valid port")]
|
||||
public int Port { get; set; }
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MoonlightServers.Shared.Http.Requests.Admin.Nodes;
|
||||
|
||||
public class CreateNodeRequest
|
||||
{
|
||||
[Required(ErrorMessage = "You need to provide a name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "You need to provide a fqdn")]
|
||||
public string Fqdn { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "You need to provide a http port")]
|
||||
[Range(1, 65535, ErrorMessage = "You need to provide a valid http port")]
|
||||
public int HttpPort { get; set; } = 8080;
|
||||
|
||||
[Required(ErrorMessage = "You need to provide a ftp port")]
|
||||
[Range(1, 65535, ErrorMessage = "You need to provide a valid ftp port")]
|
||||
public int FtpPort { get; set; } = 2021;
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MoonlightServers.Shared.Http.Requests.Admin.Nodes;
|
||||
|
||||
public class UpdateNodeRequest
|
||||
{
|
||||
[Required(ErrorMessage = "You need to provide a name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "You need to provide a fqdn")]
|
||||
public string Fqdn { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "You need to provide a http port")]
|
||||
[Range(1, 65535, ErrorMessage = "You need to provide a valid http port")]
|
||||
public int HttpPort { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "You need to provide a ftp port")]
|
||||
[Range(1, 65535, ErrorMessage = "You need to provide a valid ftp port")]
|
||||
public int FtpPort { get; set; }
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MoonlightServers.Shared.Http.Requests.Admin.ServerVariables;
|
||||
|
||||
public class CreateServerVariableRequest
|
||||
{
|
||||
[Required(ErrorMessage = "You need to provide a key for the variable")]
|
||||
public string Key { get; set; }
|
||||
public string Value { get; set; }
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MoonlightServers.Shared.Http.Requests.Admin.ServerVariables;
|
||||
|
||||
public class UpdateServerVariableRequest
|
||||
{
|
||||
[Required(ErrorMessage = "You need to provide a key for the variable")]
|
||||
public string Key { get; set; }
|
||||
public string Value { get; set; }
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using MoonlightServers.Shared.Http.Requests.Admin.ServerVariables;
|
||||
|
||||
namespace MoonlightServers.Shared.Http.Requests.Admin.Servers;
|
||||
|
||||
public class CreateServerRequest
|
||||
{
|
||||
[Required(ErrorMessage = "You need to provide a name for the server")]
|
||||
public string Name { get; set; }
|
||||
public int OwnerId { get; set; }
|
||||
|
||||
[Range(1, int.MaxValue, ErrorMessage = "You need to provide a valid cpu percent amount")]
|
||||
public int Cpu { get; set; }
|
||||
|
||||
[Range(1, int.MaxValue, ErrorMessage = "You need to provide a valid memory amount")]
|
||||
public int Memory { get; set; }
|
||||
|
||||
[Range(1, int.MaxValue, ErrorMessage = "You need to provide a valid disk amount")]
|
||||
public int Disk { get; set; }
|
||||
|
||||
public string? StartupOverride { get; set; }
|
||||
|
||||
public int DockerImageIndex { get; set; } = -1;
|
||||
|
||||
public int StarId { get; set; }
|
||||
|
||||
public int NodeId { get; set; }
|
||||
|
||||
public int[] AllocationIds { get; set; } = [];
|
||||
public List<CreateServerVariableRequest> Variables { get; set; } = new();
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using MoonlightServers.Shared.Http.Requests.Admin.ServerVariables;
|
||||
|
||||
namespace MoonlightServers.Shared.Http.Requests.Admin.Servers;
|
||||
|
||||
public class UpdateServerRequest
|
||||
{
|
||||
[Required(ErrorMessage = "You need to provide a name for the server")]
|
||||
public string Name { get; set; }
|
||||
public int OwnerId { get; set; }
|
||||
|
||||
[Range(1, int.MaxValue, ErrorMessage = "You need to provide a valid cpu percent amount")]
|
||||
public int Cpu { get; set; }
|
||||
|
||||
[Range(1, int.MaxValue, ErrorMessage = "You need to provide a valid memory amount")]
|
||||
public int Memory { get; set; }
|
||||
|
||||
[Range(1, int.MaxValue, ErrorMessage = "You need to provide a valid disk amount")]
|
||||
public int Disk { get; set; }
|
||||
|
||||
public string? StartupOverride { get; set; }
|
||||
|
||||
public int DockerImageIndex { get; set; }
|
||||
|
||||
// TODO: Add star change
|
||||
//public int StarId { get; set; }
|
||||
|
||||
// TODO: Add transfer
|
||||
//public int NodeId { get; set; }
|
||||
|
||||
public int[] AllocationIds { get; set; } = [];
|
||||
|
||||
public List<UpdateServerVariableRequest> Variables { get; set; } = new();
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MoonlightServers.Shared.Http.Requests.Admin.StarDockerImages;
|
||||
|
||||
public class CreateStarDockerImageRequest
|
||||
{
|
||||
[Required(ErrorMessage = "You need to provide a display name")]
|
||||
public string DisplayName { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "You need to specify a docker image identifier")]
|
||||
[RegularExpression("^(?:(?=[^:\\/]{1,253})(?!-)[a-zA-Z0-9-]{1,63}(?<!-)(?:\\.(?!-)[a-zA-Z0-9-]{1,63}(?<!-))*(?::[0-9]{1,5})?\\/)?((?![._-])(?:[a-z0-9._-]*)(?<![._-])(?:\\/(?![._-])[a-z0-9._-]*(?<![._-]))*)(?::(?![.-])[a-zA-Z0-9_.-]{1,128})?$", ErrorMessage = "You need to specify a valid docker image identifier")]
|
||||
public string Identifier { get; set; }
|
||||
|
||||
public bool AutoPulling { get; set; }
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MoonlightServers.Shared.Http.Requests.Admin.StarDockerImages;
|
||||
|
||||
public class UpdateStarDockerImageRequest
|
||||
{
|
||||
[Required(ErrorMessage = "You need to provide a display name")]
|
||||
public string DisplayName { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "You need to specify a docker image identifier")]
|
||||
[RegularExpression("^(?:(?=[^:\\/]{1,253})(?!-)[a-zA-Z0-9-]{1,63}(?<!-)(?:\\.(?!-)[a-zA-Z0-9-]{1,63}(?<!-))*(?::[0-9]{1,5})?\\/)?((?![._-])(?:[a-z0-9._-]*)(?<![._-])(?:\\/(?![._-])[a-z0-9._-]*(?<![._-]))*)(?::(?![.-])[a-zA-Z0-9_.-]{1,128})?$", ErrorMessage = "You need to specify a valid docker image identifier")]
|
||||
public string Identifier { get; set; }
|
||||
|
||||
public bool AutoPulling { get; set; }
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using MoonlightServers.Shared.Enums;
|
||||
|
||||
namespace MoonlightServers.Shared.Http.Requests.Admin.StarVariables;
|
||||
|
||||
public class CreateStarVariableRequest
|
||||
{
|
||||
[Required(ErrorMessage = "You need to specify a variable name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "You need to specify a variable description", AllowEmptyStrings = true)]
|
||||
public string Description { get; set; } = "";
|
||||
|
||||
[Required(ErrorMessage = "You need to specify a variable key")]
|
||||
public string Key { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "You need to specify a variable default value", AllowEmptyStrings = true)]
|
||||
public string DefaultValue { get; set; } = "";
|
||||
|
||||
public bool AllowViewing { get; set; }
|
||||
public bool AllowEditing { get; set; }
|
||||
|
||||
public StarVariableType Type { get; set; } = StarVariableType.Text;
|
||||
public string? Filter { get; set; } = null;
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using MoonlightServers.Shared.Enums;
|
||||
|
||||
namespace MoonlightServers.Shared.Http.Requests.Admin.StarVariables;
|
||||
|
||||
public class UpdateStarVariableRequest
|
||||
{
|
||||
[Required(ErrorMessage = "You need to specify a variable name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "You need to specify a variable description", AllowEmptyStrings = true)]
|
||||
public string Description { get; set; } = "";
|
||||
|
||||
[Required(ErrorMessage = "You need to specify a variable key")]
|
||||
public string Key { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "You need to specify a variable default value", AllowEmptyStrings = true)]
|
||||
public string DefaultValue { get; set; } = "";
|
||||
|
||||
public bool AllowViewing { get; set; }
|
||||
public bool AllowEditing { get; set; }
|
||||
|
||||
public StarVariableType Type { get; set; } = StarVariableType.Text;
|
||||
public string? Filter { get; set; } = null;
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MoonlightServers.Shared.Http.Requests.Admin.Stars;
|
||||
|
||||
public class CreateStarRequest
|
||||
{
|
||||
[Required(ErrorMessage = "You need to specify a name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "You need to specify a author")]
|
||||
public string Author { get; set; }
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MoonlightServers.Shared.Http.Requests.Admin.Stars;
|
||||
|
||||
public class UpdateStarRequest
|
||||
{
|
||||
[Required(ErrorMessage = "You need to specify a name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "You need to specify a version")]
|
||||
public string Version { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "You need to specify a author")]
|
||||
public string Author { get; set; }
|
||||
|
||||
public string? UpdateUrl { get; set; }
|
||||
public string? DonateUrl { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "You need to specify a startup command")]
|
||||
public string StartupCommand { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "You need to specify a stop command")]
|
||||
public string StopCommand { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "You need to specify a online detection string")]
|
||||
public string OnlineDetection { get; set; }
|
||||
|
||||
|
||||
|
||||
[Required(ErrorMessage = "You need to specify an install shell")]
|
||||
public string InstallShell { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "You need to specify an install docker image")]
|
||||
[RegularExpression("^(?:(?=[^:\\/]{1,253})(?!-)[a-zA-Z0-9-]{1,63}(?<!-)(?:\\.(?!-)[a-zA-Z0-9-]{1,63}(?<!-))*(?::[0-9]{1,5})?\\/)?((?![._-])(?:[a-z0-9._-]*)(?<![._-])(?:\\/(?![._-])[a-z0-9._-]*(?<![._-]))*)(?::(?![.-])[a-zA-Z0-9_.-]{1,128})?$", ErrorMessage = "You need to specify a valid docker image")]
|
||||
public string InstallDockerImage { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "You need to specify an install script")]
|
||||
public string InstallScript { get; set; }
|
||||
|
||||
|
||||
[Range(0, 20, ErrorMessage = "You need to provide a valid amount of allocations")]
|
||||
public int RequiredAllocations { get; set; }
|
||||
|
||||
public bool AllowDockerImageChange { get; set; }
|
||||
public int DefaultDockerImage { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "You need to provide parse configuration")]
|
||||
public string ParseConfiguration { get; set; }
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MoonlightServers.Shared.Http.Requests.Client.Servers.Files;
|
||||
|
||||
public class ServerFilesCompressRequest
|
||||
{
|
||||
[Required(ErrorMessage = "You need to specify a type")]
|
||||
public string Type { get; set; }
|
||||
|
||||
public string[] Items { get; set; } = [];
|
||||
|
||||
[Required(ErrorMessage = "You need to specify a destination")]
|
||||
public string Destination { get; set; }
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MoonlightServers.Shared.Http.Requests.Client.Servers.Files;
|
||||
|
||||
public class ServerFilesDecompressRequest
|
||||
{
|
||||
[Required(ErrorMessage = "You need to specify a type")]
|
||||
public string Type { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "You need to specify a path")]
|
||||
public string Path { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "You need to specify a destination")]
|
||||
public string Destination { get; set; }
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MoonlightServers.Shared.Http.Requests.Client.Servers;
|
||||
|
||||
public class ServerCommandRequest
|
||||
{
|
||||
[Required(ErrorMessage = "The command is required")]
|
||||
public string Command { get; set; }
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using MoonlightServers.Shared.Enums;
|
||||
|
||||
namespace MoonlightServers.Shared.Http.Requests.Client.Servers.Shares;
|
||||
|
||||
public record CreateShareRequest
|
||||
{
|
||||
[Required(ErrorMessage = "You need to provide a username")]
|
||||
public string Username { get; set; }
|
||||
|
||||
public Dictionary<string, ServerPermissionLevel> Permissions { get; set; } = [];
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
using MoonlightServers.Shared.Enums;
|
||||
|
||||
namespace MoonlightServers.Shared.Http.Requests.Client.Servers.Shares;
|
||||
|
||||
public record UpdateShareRequest
|
||||
{
|
||||
public Dictionary<string, ServerPermissionLevel> Permissions { get; set; } = [];
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MoonlightServers.Shared.Http.Requests.Client.Servers.Variables;
|
||||
|
||||
public class UpdateServerVariableRangeRequest
|
||||
{
|
||||
[Required(ErrorMessage = "You need to provide variables")]
|
||||
public UpdateServerVariableRequest[] Variables { get; set; }
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MoonlightServers.Shared.Http.Requests.Client.Servers.Variables;
|
||||
|
||||
public class UpdateServerVariableRequest
|
||||
{
|
||||
[Required(ErrorMessage = "You need to provide a key")]
|
||||
public string Key { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "You need to provide a value", AllowEmptyStrings = true)]
|
||||
public string Value { get; set; }
|
||||
}
|
||||
8
MoonlightServers.Shared/Http/Requests/FormSubmitDto.cs
Normal file
8
MoonlightServers.Shared/Http/Requests/FormSubmitDto.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MoonlightServers.Shared.Http.Requests;
|
||||
|
||||
public class FormSubmitDto
|
||||
{
|
||||
[Required] [MaxLength(32)] public string TextField { get; set; }
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
namespace MoonlightServers.Shared.Http.Responses.Admin.NodeAllocations;
|
||||
|
||||
public class NodeAllocationResponse
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string IpAddress { get; set; }
|
||||
public int Port { get; set; }
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
namespace MoonlightServers.Shared.Http.Responses.Admin.Nodes;
|
||||
|
||||
public class NodeResponse
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public string Fqdn { get; set; }
|
||||
public int HttpPort { get; set; }
|
||||
public int FtpPort { get; set; }
|
||||
|
||||
public bool EnableTransparentMode { get; set; }
|
||||
public bool EnableDynamicFirewall { get; set; }
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
namespace MoonlightServers.Shared.Http.Responses.Admin.Nodes.Statistics;
|
||||
|
||||
public class DockerStatisticsResponse
|
||||
{
|
||||
public string Version { get; set; }
|
||||
|
||||
public long ImagesUsed { get; set; }
|
||||
public long ImagesReclaimable { get; set; }
|
||||
|
||||
public long ContainersUsed { get; set; }
|
||||
public long ContainersReclaimable { get; set; }
|
||||
|
||||
public long BuildCacheUsed { get; set; }
|
||||
public long BuildCacheReclaimable { get; set; }
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
namespace MoonlightServers.Shared.Http.Responses.Admin.Nodes.Statistics;
|
||||
|
||||
public class StatisticsResponse
|
||||
{
|
||||
public CpuData Cpu { get; set; }
|
||||
public MemoryData Memory { get; set; }
|
||||
|
||||
public DiskData[] Disks { get; set; }
|
||||
|
||||
public record DiskData
|
||||
{
|
||||
public string Device { get; set; }
|
||||
public string MountPath { get; set; }
|
||||
public ulong DiskTotal { get; set; }
|
||||
public ulong DiskFree { get; set; }
|
||||
public ulong InodesTotal { get; set; }
|
||||
public ulong InodesFree { get; set; }
|
||||
}
|
||||
|
||||
public record MemoryData
|
||||
{
|
||||
public long Total { get; set; }
|
||||
public long Available { get; set; }
|
||||
public long Free { get; set; }
|
||||
public long Cached { get; set; }
|
||||
public long SwapTotal { get; set; }
|
||||
public long SwapFree { get; set; }
|
||||
}
|
||||
|
||||
public record CpuData
|
||||
{
|
||||
public string Model { get; set; }
|
||||
public double Usage { get; set; }
|
||||
public double[] UsagePerCore { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
namespace MoonlightServers.Shared.Http.Responses.Admin.Nodes.Sys;
|
||||
|
||||
public class NodeSystemStatusResponse
|
||||
{
|
||||
public bool RoundtripSuccess { get; set; }
|
||||
public bool RoundtripRemoteFailure { get; set; }
|
||||
public TimeSpan RoundtripTime { get; set; }
|
||||
public string? RoundtripError { get; set; }
|
||||
public string Version { get; set; }
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
namespace MoonlightServers.Shared.Http.Responses.Admin.ServerVariables;
|
||||
|
||||
public class ServerVariableResponse
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Key { get; set; }
|
||||
public string Value { get; set; }
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
namespace MoonlightServers.Shared.Http.Responses.Admin.Servers;
|
||||
|
||||
public class ServerResponse
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
public int OwnerId { get; set; }
|
||||
public int Cpu { get; set; }
|
||||
public int Memory { get; set; }
|
||||
public int Disk { get; set; }
|
||||
public bool UseVirtualDisk { get; set; }
|
||||
public int Bandwidth { get; set; }
|
||||
|
||||
public string? StartupOverride { get; set; }
|
||||
|
||||
public int DockerImageIndex { get; set; }
|
||||
|
||||
public int StarId { get; set; }
|
||||
|
||||
public int NodeId { get; set; }
|
||||
|
||||
public int[] AllocationIds { get; set; } = [];
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
namespace MoonlightServers.Shared.Http.Responses.Admin.StarDockerImages;
|
||||
|
||||
public class StarDockerImageResponse
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string DisplayName { get; set; }
|
||||
public string Identifier { get; set; }
|
||||
public bool AutoPulling { get; set; }
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using MoonlightServers.Shared.Enums;
|
||||
|
||||
namespace MoonlightServers.Shared.Http.Responses.Admin.StarVariables;
|
||||
|
||||
public class StarVariableResponse
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
public string Description { get; set; }
|
||||
|
||||
public string Key { get; set; }
|
||||
public string DefaultValue { get; set; }
|
||||
|
||||
public bool AllowViewing { get; set; }
|
||||
public bool AllowEditing { get; set; }
|
||||
|
||||
public StarVariableType Type { get; set; }
|
||||
public string? Filter { get; set; }
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
namespace MoonlightServers.Shared.Http.Responses.Admin.Stars;
|
||||
|
||||
public class StarResponse
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
// Meta
|
||||
public string Name { get; set; }
|
||||
public string Version { get; set; }
|
||||
public string Author { get; set; }
|
||||
public string? UpdateUrl { get; set; }
|
||||
public string? DonateUrl { get; set; }
|
||||
|
||||
// Start and stop
|
||||
public string StartupCommand { get; set; }
|
||||
public string StopCommand { get; set; }
|
||||
public string OnlineDetection { get; set; }
|
||||
|
||||
// Install
|
||||
public string InstallShell { get; set; }
|
||||
public string InstallDockerImage { get; set; }
|
||||
public string InstallScript { get; set; }
|
||||
|
||||
// Misc
|
||||
public int RequiredAllocations { get; set; }
|
||||
public bool AllowDockerImageChange { get; set; }
|
||||
public int DefaultDockerImage { get; set; }
|
||||
public string ParseConfiguration { get; set; }
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
namespace MoonlightServers.Shared.Http.Responses.Client.Servers.Allocations;
|
||||
|
||||
public class AllocationDetailResponse
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string IpAddress { get; set; }
|
||||
public int Port { get; set; }
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
namespace MoonlightServers.Shared.Http.Responses.Client.Servers.Files;
|
||||
|
||||
public class ServerFilesDownloadResponse
|
||||
{
|
||||
public string DownloadUrl { get; set; }
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
namespace MoonlightServers.Shared.Http.Responses.Client.Servers.Files;
|
||||
|
||||
public class ServerFilesEntryResponse
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public bool IsFolder { get; set; }
|
||||
public long Size { get; set; }
|
||||
|
||||
public DateTime CreatedAt { get; set; }
|
||||
public DateTime UpdatedAt { get; set; }
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
namespace MoonlightServers.Shared.Http.Responses.Client.Servers.Files;
|
||||
|
||||
public class ServerFilesUploadResponse
|
||||
{
|
||||
public string UploadUrl { get; set; }
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
using MoonlightServers.Shared.Enums;
|
||||
using MoonlightServers.Shared.Http.Responses.Client.Servers.Allocations;
|
||||
|
||||
namespace MoonlightServers.Shared.Http.Responses.Client.Servers;
|
||||
|
||||
public record ServerDetailResponse
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public int Cpu { get; set; }
|
||||
public int Memory { get; set; }
|
||||
public int Disk { get; set; }
|
||||
|
||||
public string NodeName { get; set; }
|
||||
public string StarName { get; set; }
|
||||
|
||||
public AllocationDetailResponse[] Allocations { get; set; }
|
||||
|
||||
public ShareData? Share { get; set; } = null;
|
||||
|
||||
public record ShareData
|
||||
{
|
||||
public string SharedBy { get; set; }
|
||||
public Dictionary<string, ServerPermissionLevel> Permissions { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
namespace MoonlightServers.Shared.Http.Responses.Client.Servers;
|
||||
|
||||
public class ServerLogsResponse
|
||||
{
|
||||
public string[] Messages { get; set; }
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
namespace MoonlightServers.Shared.Http.Responses.Client.Servers;
|
||||
|
||||
public class ServerStatsResponse
|
||||
{
|
||||
public double CpuUsage { get; set; }
|
||||
public ulong MemoryUsage { get; set; }
|
||||
public ulong NetworkRead { get; set; }
|
||||
public ulong NetworkWrite { get; set; }
|
||||
public ulong IoRead { get; set; }
|
||||
public ulong IoWrite { get; set; }
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
using MoonlightServers.Shared.Enums;
|
||||
|
||||
namespace MoonlightServers.Shared.Http.Responses.Client.Servers;
|
||||
|
||||
public class ServerStatusResponse
|
||||
{
|
||||
public ServerState State { get; set; }
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace MoonlightServers.Shared.Http.Responses.Client.Servers;
|
||||
|
||||
public class ServerWebSocketResponse
|
||||
{
|
||||
public string Target { get; set; }
|
||||
public string AccessToken { get; set; }
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
using MoonlightServers.Shared.Enums;
|
||||
|
||||
namespace MoonlightServers.Shared.Http.Responses.Client.Servers.Shares;
|
||||
|
||||
public class ServerShareResponse
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Username { get; set; }
|
||||
public Dictionary<string, ServerPermissionLevel> Permissions { get; set; }
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using MoonlightServers.Shared.Enums;
|
||||
|
||||
namespace MoonlightServers.Shared.Http.Responses.Client.Servers.Variables;
|
||||
|
||||
public class ServerVariableDetailResponse
|
||||
{
|
||||
public string Key { get; set; }
|
||||
public string Value { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
public string Description { get; set; }
|
||||
public StarVariableType Type { get; set; }
|
||||
public string? Filter { get; set; }
|
||||
}
|
||||
6
MoonlightServers.Shared/Http/Responses/FormResultDto.cs
Normal file
6
MoonlightServers.Shared/Http/Responses/FormResultDto.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace MoonlightServers.Shared.Http.Responses;
|
||||
|
||||
public class FormResultDto
|
||||
{
|
||||
public string Result { get; set; }
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
using MoonlightServers.Shared.Enums;
|
||||
|
||||
namespace MoonlightServers.Shared.Models;
|
||||
|
||||
public class ParseConfiguration
|
||||
{
|
||||
public string File { get; set; }
|
||||
public FileParsers Parser { get; set; }
|
||||
|
||||
public List<ParseConfigurationEntry> Entries { get; set; } = new();
|
||||
|
||||
public class ParseConfigurationEntry
|
||||
{
|
||||
public string Key { get; set; }
|
||||
public string Value { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Label="Nuget Settings">
|
||||
<PackageId>MoonlightServers.Shared</PackageId>
|
||||
<Title>MoonlightServers.Shared</Title>
|
||||
<Version>2.1.0</Version>
|
||||
<IsPackable>true</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
13
MoonlightServers.Shared/SerializationContext.cs
Normal file
13
MoonlightServers.Shared/SerializationContext.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using MoonlightServers.Shared.Http.Requests;
|
||||
using MoonlightServers.Shared.Http.Responses;
|
||||
|
||||
namespace MoonlightServers.Shared;
|
||||
|
||||
[JsonSerializable(typeof(FormSubmitDto))]
|
||||
[JsonSerializable(typeof(FormResultDto))]
|
||||
[JsonSourceGenerationOptions(JsonSerializerDefaults.Web)]
|
||||
public partial class SerializationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
||||
Reference in New Issue
Block a user