From c1b0e126af883e5c54f3564f935789fe6651c9b0 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 14 Sep 2022 12:01:49 +0100 Subject: [PATCH] Allow custom components in cloud --- .../server/src/api/controllers/component.js | 37 +++++++++---------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/packages/server/src/api/controllers/component.js b/packages/server/src/api/controllers/component.js index a0db34c9b8..86a0b1938f 100644 --- a/packages/server/src/api/controllers/component.js +++ b/packages/server/src/api/controllers/component.js @@ -33,26 +33,23 @@ exports.fetchAppComponentDefinitions = async function (ctx) { } } - // for now custom components only supported in self-host - if (env.SELF_HOSTED) { - // Add custom components - const globalDB = getGlobalDB() - const response = await globalDB.allDocs( - getPluginParams(null, { - include_docs: true, - }) - ) - response.rows - .map(row => row.doc) - .filter(plugin => plugin.schema.type === "component") - .forEach(plugin => { - const fullComponentName = `plugin/${plugin.name}` - definitions[fullComponentName] = { - component: fullComponentName, - ...plugin.schema.schema, - } - }) - } + // Add custom components + const globalDB = getGlobalDB() + const response = await globalDB.allDocs( + getPluginParams(null, { + include_docs: true, + }) + ) + response.rows + .map(row => row.doc) + .filter(plugin => plugin.schema.type === "component") + .forEach(plugin => { + const fullComponentName = `plugin/${plugin.name}` + definitions[fullComponentName] = { + component: fullComponentName, + ...plugin.schema.schema, + } + }) ctx.body = definitions } catch (err) {