remoteCommands added plugin and master API endpoint for executing things

This commit is contained in:
Danielv123 committed 2018-04-09 11:25:57 +02:00
1 parent be49deb170
commit 43c1f2ae93
7 files changed
+108 -8

No files matched your search

+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",
},
});
}
});
}
}
}