Refactored container helper service. Cleaned up event models. Implemented version changing. Added security questions before rebuild
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Moonlight.Shared.Http.Events;
|
||||
|
||||
public struct RebuildEvent
|
||||
public struct RebuildEventDto
|
||||
{
|
||||
[JsonPropertyName("type")]
|
||||
public RebuildEventType Type { get; set; }
|
||||
@@ -0,0 +1,10 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Moonlight.Shared.Http.Requests.Admin.ContainerHelper;
|
||||
|
||||
public class SetVersionDto
|
||||
{
|
||||
[Required]
|
||||
[RegularExpression(@"^(?!\/|.*\/\/|.*\.\.|.*\/$)[A-Za-z0-9._/-]+$", ErrorMessage = "Invalid version format")]
|
||||
public string Version { get; set; }
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using Moonlight.Shared.Http.Events;
|
||||
using Moonlight.Shared.Http.Requests.ApiKeys;
|
||||
using Moonlight.Shared.Http.Requests.Roles;
|
||||
@@ -46,13 +47,28 @@ namespace Moonlight.Shared.Http;
|
||||
[JsonSerializable(typeof(ThemeDto))]
|
||||
|
||||
// Events
|
||||
[JsonSerializable(typeof(RebuildEvent))]
|
||||
[JsonSerializable(typeof(RebuildEventDto))]
|
||||
|
||||
// Container Helper
|
||||
[JsonSerializable(typeof(ContainerHelperStatusDto))]
|
||||
|
||||
// Misc
|
||||
[JsonSerializable(typeof(ProblemDetails))]
|
||||
public partial class SerializationContext : JsonSerializerContext
|
||||
public partial class SharedSerializationContext : JsonSerializerContext
|
||||
{
|
||||
private static JsonSerializerOptions? InternalTunedOptions;
|
||||
|
||||
public static JsonSerializerOptions TunedOptions
|
||||
{
|
||||
get
|
||||
{
|
||||
if (InternalTunedOptions != null)
|
||||
return InternalTunedOptions;
|
||||
|
||||
InternalTunedOptions = new JsonSerializerOptions(JsonSerializerDefaults.Web);
|
||||
InternalTunedOptions.TypeInfoResolverChain.Add(Default);
|
||||
|
||||
return InternalTunedOptions;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user