feat: add audited one-shot prepare gate
This commit is contained in:
@@ -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 ||
|
||||
|
||||
Reference in New Issue
Block a user