feat(plugin): gate pages on companion features

This commit is contained in:
npc0-hue
2026-07-29 09:53:39 +08:00
parent 271e1e684f
commit c9494abc48
16 changed files with 300 additions and 61 deletions
+10 -2
View File
@@ -69,7 +69,8 @@ export function parseSafeGameClientBridgeStatus(value: unknown): GameClientBridg
pluginId: string(record.pluginId, "pluginId"),
available: boolean(record.available, "available"),
reason: optionalString(record.reason, "reason"),
profiles: array(record.profiles, "profiles").map(parseProfile)
profiles: array(record.profiles, "profiles").map(parseProfile),
features: array(record.features ?? [], "features").map(parseFeature)
};
}
@@ -136,10 +137,17 @@ function parseProfile(value: unknown): GameClientBridgeProfileDeclarationRespons
reason: optionalString(record.reason, "profile.reason"),
commandTypes: stringArray(record.commandTypes, "profile.commandTypes"),
snapshotTypes: stringArray(record.snapshotTypes, "profile.snapshotTypes"),
queryTemplateKeys: stringArray(record.queryTemplateKeys, "profile.queryTemplateKeys")
queryTemplateKeys: stringArray(record.queryTemplateKeys, "profile.queryTemplateKeys"),
handlerTypes: stringArray(record.handlerTypes ?? [], "profile.handlerTypes"),
eventProducerTypes: stringArray(record.eventProducerTypes ?? [], "profile.eventProducerTypes")
};
}
function parseFeature(value: unknown): { key: string; available: boolean; reason?: string } {
const record = safeObject(value, "Game Client Bridge feature");
return { key: string(record.key, "feature.key"), available: boolean(record.available, "feature.available"), reason: optionalString(record.reason, "feature.reason") };
}
function parseResult(value: unknown): GameClientBridgeCommandResultResponse {
const record = safeObject(value, "Game Client Bridge command result");
const result: GameClientBridgeCommandResultResponse = {