feat(welcome): SilverOS Welcome first-logon wizard (flavour engine + apply orchestrator + MAUI UI + image bake) #4
@@ -1,6 +0,0 @@
|
||||
namespace SilverOS.Welcome.Core;
|
||||
|
||||
public class Class1
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace SilverOS.Welcome.Core.Flavours;
|
||||
|
||||
public sealed record FlavourManifest
|
||||
{
|
||||
public string Id { get; init; } = "";
|
||||
public string Label { get; init; } = "";
|
||||
public string Description { get; init; } = "";
|
||||
public bool IsDefault { get; init; }
|
||||
public HardeningSpec Hardening { get; init; } = new();
|
||||
public IReadOnlyList<string> AppSet { get; init; } = Array.Empty<string>();
|
||||
public IReadOnlyDictionary<string, JsonElement> Settings { get; init; }
|
||||
= new Dictionary<string, JsonElement>();
|
||||
|
||||
public static readonly JsonSerializerOptions JsonOptions = new()
|
||||
{
|
||||
PropertyNameCaseInsensitive = true,
|
||||
ReadCommentHandling = JsonCommentHandling.Skip,
|
||||
AllowTrailingCommas = true
|
||||
};
|
||||
}
|
||||
|
||||
public sealed record HardeningSpec
|
||||
{
|
||||
public IReadOnlyList<string> Modules { get; init; } = Array.Empty<string>();
|
||||
public IReadOnlyDictionary<string, string> Params { get; init; }
|
||||
= new Dictionary<string, string>();
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System.Text.Json;
|
||||
using SilverOS.Welcome.Core.Flavours;
|
||||
using Xunit;
|
||||
|
||||
public class FlavourManifestTests
|
||||
{
|
||||
[Fact]
|
||||
public void Deserializes_a_full_manifest()
|
||||
{
|
||||
var json = """
|
||||
{
|
||||
"id": "daily-driver", "label": "Daily-Driver",
|
||||
"description": "Balanced.", "isDefault": true,
|
||||
"hardening": { "modules": ["00","03","05"], "params": { "wdac": "audit" } },
|
||||
"appSet": ["SilverBrowser"], "settings": { "autoLock": 120 }
|
||||
}
|
||||
""";
|
||||
var m = JsonSerializer.Deserialize<FlavourManifest>(json, FlavourManifest.JsonOptions)!;
|
||||
Assert.Equal("daily-driver", m.Id);
|
||||
Assert.True(m.IsDefault);
|
||||
Assert.Equal(new[] { "00", "03", "05" }, m.Hardening.Modules);
|
||||
Assert.Equal("audit", m.Hardening.Params["wdac"]);
|
||||
Assert.Contains("SilverBrowser", m.AppSet);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user