From c453a85dde3972ccc98c8a75fecf174d426f5971 Mon Sep 17 00:00:00 2001 From: Anthony Laibe Date: Fri, 31 Aug 2018 10:32:52 +0100 Subject: [PATCH] Add back console command --- lib/modules/console/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/modules/console/index.js b/lib/modules/console/index.js index 0cf40668..1c21a04b 100644 --- a/lib/modules/console/index.js +++ b/lib/modules/console/index.js @@ -24,6 +24,16 @@ class Console { this.events.setCommandHandler("console:history", (cb) => this.getHistory(process.env.DEFAULT_CMD_HISTORY_SIZE, cb)); this.registerEmbarkJs(); this.registerConsoleCommands(); + this.registerApi(); + } + + registerApi() { + let plugin = this.plugins.createPlugin('consoleApi', {}); + plugin.registerAPICall('post', '/embark-api/command', (req, res) => { + this.executeCmd(req.body.command, (_err, result) => { + res.send({result}); + }); + }); } processEmbarkCmd (cmd) {