From 9511fb72c7420bef042f7fd7209151fe8bf4e294 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 14 Sep 2022 10:14:17 +0100 Subject: [PATCH] Allow component plugins in cloud --- packages/server/src/api/controllers/plugin/index.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/server/src/api/controllers/plugin/index.ts b/packages/server/src/api/controllers/plugin/index.ts index 99a9e7db66..4f842b7708 100644 --- a/packages/server/src/api/controllers/plugin/index.ts +++ b/packages/server/src/api/controllers/plugin/index.ts @@ -197,10 +197,12 @@ export async function storePlugin( } export async function processPlugin(plugin: FileType, source?: string) { - if (!env.SELF_HOSTED) { - throw new Error("Plugins not supported outside of self-host.") + const { metadata, directory } = await fileUpload(plugin) + + // Only allow components in cloud + if (!env.SELF_HOSTED && metadata?.schema?.type !== PluginType.COMPONENT) { + throw new Error("Only component plugins are supported outside of self-host") } - const { metadata, directory } = await fileUpload(plugin) return await storePlugin(metadata, directory, source) }