feat: support machine-specific plugins

This commit is contained in:
Federico Jaramillo Martinez
2026-06-09 15:10:32 +02:00
parent 0118e6ebe9
commit c57f24dfa5
22 changed files with 286 additions and 47 deletions
@@ -9,6 +9,7 @@ interface RemotePluginManifestEntry {
module: string;
source?: string;
scope?: string;
machineSpecific?: boolean;
}
interface RemotePluginManifest {
@@ -158,11 +159,18 @@ function parseRemoteManifest(value: unknown): RemotePluginManifest {
module: entry["module"],
...(typeof entry["source"] === "string" ? { source: entry["source"] } : {}),
...(typeof entry["scope"] === "string" ? { scope: entry["scope"] } : {}),
...(parseRemoteMachineSpecific(entry["machineSpecific"])),
};
}),
};
}
function parseRemoteMachineSpecific(value: unknown): { machineSpecific?: boolean } {
if (value === undefined) return {};
if (typeof value !== "boolean") throw new Error("Invalid remote PI WEB plugin manifest entry");
return { machineSpecific: value };
}
function applySafeHeaders(reply: FastifyReply, headers: Record<string, string | string[] | undefined>): void {
for (const [name, value] of Object.entries(headers)) {
if (value === undefined) continue;