diff --git a/.gitignore b/.gitignore index 654171b8..7af470c1 100644 --- a/.gitignore +++ b/.gitignore @@ -56,6 +56,8 @@ sharedPlugins/serverManager/database/* sharedPlugins/serverManager/config.json sharedPlugins/serverManager/secret-api-token.txt !sharedPlugins/scenario_loader/ +sharedPlugins/scenario_loader/scenarios +!sharedPlugins/statisticsExporter/ # File used for marking plugins as disabled sharedPlugins/*/DISABLED diff --git a/config.json.dist b/config.json.dist index 70d85514..6c6a7943 100644 --- a/config.json.dist +++ b/config.json.dist @@ -54,5 +54,7 @@ "mirrorAllChat": false, "__comment7": "Autosave interval for items in the master storage in milliseconds. Defaults to one minute when set to 0 or not set.", "autosaveInterval": 600000, - "disablePrometheusPushgateway": false + "disablePrometheusPushgateway": false, + "__comment8": "This setting only affects the master. It makes every import for things that arent 'electricity' return a maximum of 0. Effectively disables teleport chests.", + "disableImportsOfEverythingExceptElectricity": false } diff --git a/master.js b/master.js index 0e72e40c..c19d45de 100644 --- a/master.js +++ b/master.js @@ -46,6 +46,7 @@ const base64url = require('base64url'); const moment = require("moment"); // constants +console.log(`Requiring config from ${args.config || './config'}`) const config = require(args.config || './config'); config.databaseDirectory = args.databaseDirectory || config.databaseDirectory || "./database"; const masterModFolder = path.join(config.databaseDirectory, "/masterMods/"); @@ -301,7 +302,7 @@ async function shutdown() { console.log("Plugin "+plugin.pluginConfig.name+" exited in "+(Date.now()-startTime)+"ms"); } } - console.log("Exited in "+(Date.now()-exitStartTime)+"ms"); + console.log("Clusterio cleanly exited in "+(Date.now()-exitStartTime)+"ms"); process.exit(0); } @@ -489,10 +490,12 @@ app.post("/api/place", authenticate.middleware, function(req, res) { } }); } - if( x.instanceID - && x.instanceName - && !isNaN(Number(x.count))// This is in no way a proper authentication or anything, its just to make sure everybody are registered as slaves before modifying the cluster (or not, to maintain backwards compat) - /*&& stringUtils.hashCode(slaves[x.unique].rconPassword) == x.unique*/){ + if(x.instanceID + && x.instanceName + && !isNaN(Number(x.count))// This is in no way a proper authentication or anything, its just to make sure everybody are registered as slaves before modifying the cluster (or not, to maintain backwards compat) + /*&& stringUtils.hashCode(slaves[x.unique].rconPassword) == x.unique*/ + && x.name + && typeof x.name == "string"){ if(config.logItemTransfers){ console.log("added: " + req.body.name + " " + req.body.count+" from "+x.instanceName+" ("+x.instanceID+")"); } @@ -552,7 +555,11 @@ app.post("/api/remove", authenticate.middleware, function(req, res) { if(slaves[object.instanceID]) object.instanceName = slaves[object.instanceID].instanceName; let item = db.items[object.name] // console.dir(doc); - if (!item) { + if(!item + ||(( + config.disableImportsOfEverythingExceptElectricity === true || config.disableImportsOfEverythingExceptElectricity === "true" ) + && object.name != "electricity") + ){ if(config.logItemTransfers){ console.log('failure could not find ' + object.name); }