mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-12 07:04:52 +09:00
Move the contents of node_modules/_app into lib/ as there shouldn't be any content in node_modules. This directory is automatically managed and pruned by npm. Add lib/ as a local package in package.json, this allows scripts everywhere to require it's content as "lib/path" instead of relying on local paths. This shadows the StdLib Node.js Bindings package, but I could care less. Change all requires with lib as a local path and _app to use just lib.
44 lines
1.7 KiB
JavaScript
44 lines
1.7 KiB
JavaScript
const needle = require("needle");
|
|
const fs = require("fs-extra");
|
|
|
|
const pluginConfig = require("./config");
|
|
const COMPRESS_LUA = false;
|
|
|
|
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")(this.config);
|
|
const configManager = require("lib/manager/configManager.js");
|
|
// const modManager = require("lib/manager/modManager.js")(this.config);
|
|
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()
|
|
// callback(mods);
|
|
});
|
|
this.socket.on("serverManagerGetConfig", async (data, callback) => {
|
|
let config = await configManager.getConfig(data.instance);
|
|
callback(config);
|
|
});
|
|
this.socket.on("serverManagerEditConfig", async (data, callback) => {
|
|
callback(configManager.editConfig(data.instance, data.entry, data.value));
|
|
});
|
|
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 */));
|
|
});
|
|
}
|
|
}
|