Files
factorio-clusterio/sharedPlugins/serverManager/index.js
T
Hornwitser 5d9d3981ff Remove getLua and getCommand from clusterTools
Remove the unused and badly behaved getCommand and getLua functions from
clusterTools.  The main issue with these is that encourage the use of
large commands that have negative impact on the performance of the
servers, as such large commands have to be transmitted to all players
that are connected.  These functions also have poor handling of lua
comments and will fail on strings containing for example "--".
2019-10-24 22:49:16 +02:00

35 lines
1.3 KiB
JavaScript

const needle = require("needle");
const fs = require("fs-extra");
const pluginConfig = require("./config");
module.exports = class remoteCommands {
constructor(mergedConfig, messageInterface, extras){
this.messageInterface = messageInterface;
this.config = mergedConfig;
this.socket = extras.socket;
const pluginManager = require("lib/manager/pluginManager.js");
// const modManager = require("lib/manager/modManager");
this.socket.on("hello", () => {
this.socket.emit("registerServerManager");
});
this.socket.on("serverManagerGetStatus", async data => {
});
this.socket.on("serverManagerGetMods", async (data, callback) => {
// TODO: Implement this function separately from listMods (which console.logs it)
// let mods = modManager.getMods(this.config)
// callback(mods);
});
this.socket.on("serverManagerGetPlugins", async (data, callback) => {
callback(await pluginManager.getPlugins());
});
this.socket.on("serverManagerEnablePlugin", async (data, callback) => {
callback(await pluginManager.enablePlugin(data.name, data.instanceID /* Currently ignored */));
});
this.socket.on("serverManagerDisablePlugin", async (data, callback) => {
callback(await pluginManager.disablePlugin(data.name, data.instanceID /* Currently ignored */));
});
}
}