From beb0ed199102ab3810eb5afc5b33b1ef7a41e38b Mon Sep 17 00:00:00 2001 From: Lorenzo Blasa Date: Mon, 11 Jul 2022 07:04:55 -0700 Subject: [PATCH] Plugin marketplace for flipper-server-core Summary: Implementation taken from: https://www.internalfb.com/code/fbsource/[85c1fe5afee7]/xplat/sonar/desktop/flipper-ui-core/src/fb/pluginMarketplaceAPI.tsx As with the previous diff, the marketplace API for flipper-server-core accesses the existing config in a different way and depends on FlipperServer, instead of User, to execute intern request as to obtain marketplace plugins. Reviewed By: passy Differential Revision: D37749775 fbshipit-source-id: 968ea3f7a412893f032e5a7a50ecf17c298e18ff --- .../plugins/fb-stubs/pluginMarketplaceAPI.tsx | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 desktop/flipper-server-core/src/plugins/fb-stubs/pluginMarketplaceAPI.tsx diff --git a/desktop/flipper-server-core/src/plugins/fb-stubs/pluginMarketplaceAPI.tsx b/desktop/flipper-server-core/src/plugins/fb-stubs/pluginMarketplaceAPI.tsx new file mode 100644 index 000000000..12934bb05 --- /dev/null +++ b/desktop/flipper-server-core/src/plugins/fb-stubs/pluginMarketplaceAPI.tsx @@ -0,0 +1,24 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +import {FlipperServer, MarketplacePluginDetails} from 'flipper-common'; + +export async function loadAvailablePlugins( + server: FlipperServer, + marketplaceURL: string, +): Promise { + try { + const response = await fetch(marketplaceURL); + const plugins = await response.json(); + return plugins; + } catch (e) { + console.error('Failed while retrieving marketplace plugins', e); + return []; + } +}