feat: add audited one-shot prepare gate

This commit is contained in:
2026-07-18 12:29:09 +09:00
parent 1302b1b92f
commit 5379511b8a
25 changed files with 6188 additions and 41 deletions

View File

@@ -6,6 +6,12 @@ namespace MBN_STOCK_WEBVIEW.LegacyBridge;
public sealed record LegacyExecutePlayoutIntent(LegacyOperatorPlayoutCommand Command)
: LegacyUiIntent;
/// <summary>
/// Process-scoped Gate A PREPARE request. The opaque capability is validated and
/// consumed by the native launch authorization; it is never emitted in state.
/// </summary>
public sealed record LegacyGateAPrepareIntent(string Capability) : LegacyUiIntent;
public sealed record LegacySetFadeDurationIntent(int Duration)
: LegacyUiIntent;
@@ -17,6 +23,7 @@ internal static class LegacyPlayoutUiIntentParser
{
public static LegacyUiIntent? Parse(string type, JsonElement payload) => type switch
{
"gate-a-prepare" => ParseGateAPrepare(payload),
"prepare-playout" => ParseEmpty(
payload,
static () => new LegacyExecutePlayoutIntent(
@@ -43,6 +50,29 @@ internal static class LegacyPlayoutUiIntentParser
_ => null
};
private static LegacyUiIntent? ParseGateAPrepare(JsonElement payload)
{
if (payload.ValueKind != JsonValueKind.Object ||
payload.GetRawText().Length > 128 ||
payload.EnumerateObject().Count() != 1 ||
!payload.TryGetProperty("capability", out var capabilityElement) ||
capabilityElement.ValueKind != JsonValueKind.String)
{
return null;
}
var capability = capabilityElement.GetString();
if (capability is null || capability.Length != 64 ||
capability.Any(character =>
character is not (>= '0' and <= '9') and
not (>= 'A' and <= 'F')))
{
return null;
}
return new LegacyGateAPrepareIntent(capability);
}
private static LegacyUiIntent? ParseFadeDuration(JsonElement payload)
{
if (payload.ValueKind != JsonValueKind.Object ||