From c90ea302cb1b4ffbcbe06709fe9fed83d9535054 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 18 Sep 2019 11:33:08 +0200 Subject: [PATCH] add plugin directory --- src/app.js | 9 +++++++-- src/remixAppManager.js | 9 ++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/app.js b/src/app.js index 54c9b0e9f5..fca6a249cd 100644 --- a/src/app.js +++ b/src/app.js @@ -328,10 +328,15 @@ Please make a backup of your contracts and start using http://remix.ethereum.org debug, analysis, test, - filePanel.remixdHandle, - ...appManager.registeredPlugins() + filePanel.remixdHandle ]) + try { + appManager.register(await appManager.registeredPlugins()) + } catch (e) { + console.log('couldn\'t register iframe plugins', e.message) + } + await appManager.activate(['contentImport', 'theme', 'editor', 'fileManager', 'compilerMetadata', 'compilerArtefacts', 'network', 'offsetToLineColumnConverter']) await appManager.activate(['mainPanel']) await appManager.activate(['menuicons', 'home', 'sidePanel', 'pluginManager', 'fileExplorers', 'settings']) diff --git a/src/remixAppManager.js b/src/remixAppManager.js index 272eacdac4..9a87fd973b 100644 --- a/src/remixAppManager.js +++ b/src/remixAppManager.js @@ -1,4 +1,4 @@ -/* global localStorage */ +/* global localStorage, fetch */ import { PluginEngine, IframePlugin } from '@remixproject/engine' import { EventEmitter } from 'events' import { PermissionHandler } from './app/ui/persmission-handler' @@ -20,6 +20,7 @@ export class RemixAppManager extends PluginEngine { super(plugins, settings) this.event = new EventEmitter() this.registered = {} + this.pluginsDirectory = 'https://github.com/ethereum/remix-plugins-directory' } onActivated (plugin) { @@ -73,7 +74,7 @@ export class RemixAppManager extends PluginEngine { return requiredModules.includes(name) } - registeredPlugins () { + async registeredPlugins () { const vyper = { name: 'vyper', displayName: 'Vyper', @@ -262,6 +263,7 @@ export class RemixAppManager extends PluginEngine { icon: 'https://zokrates.blockchain-it.hr/zokrates.svg', location: 'sidePanel' } + const plugins = JSON.parse(await fetch(this.pluginsDirectory)) return [ new IframePlugin(pipeline), new IframePlugin(vyper), @@ -277,7 +279,8 @@ export class RemixAppManager extends PluginEngine { new IframePlugin(gasProfiler), new IframePlugin(flattener), new IframePlugin(ethpm), - new IframePlugin(zokrates) + new IframePlugin(zokrates), + ...plugins ] } }