mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-12 07:04:52 +09:00
Change config in modManager to be passed to each individual functions instead of requiring it be present at load time.
36 lines
1.3 KiB
JavaScript
36 lines
1.3 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");
|
|
// 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 */));
|
|
});
|
|
}
|
|
}
|