Merge branch 'dev' into pr/71

This commit is contained in:
Danielv123 committed 2018-04-11 15:22:42 +02:00
commit 51e41835ee
7 files changed
+141 -12

No files matched your search

+14
View File
@@ -0,0 +1,14 @@
/*
Config for clusterio remote command plugin.
Allows you to execute commands on slaves with a web API.
Careful, may allow for RCE vulnerabilities.
*/
var modInfo = require("./info.json");
module.exports = {
// Name of package. For display somewhere I guess.
name: "remoteCommands",
version: "1.0.0",
binary: "nodePackage",
description: "Config for clusterio remote command plugin. Allows you to execute commands on slaves with a web API.",
}
+23
View File
@@ -0,0 +1,23 @@
module.exports.main = class remoteCommands {
constructor(mergedConfig, messageInterface, extras){
console.log = messageInterface;
this.messageInterface = messageInterface;
this.config = mergedConfig;
this.socket = extras.socket;
if(this.config.allowRemoteCommandExecution){
this.socket.on("runCommand", data => {
let {commandID} = data;
this.messageInterface(data.command);
if(commandID){
this.socket.emit("runCommandReturnValue", {
commandID,
body: {
info: "Command was sent to factorio",
},
});
}
});
}
}
}