From cd4887e5cf7589a6a60f9cf23e957d9820aad222 Mon Sep 17 00:00:00 2001 From: Danielv123 Date: Mon, 2 Apr 2018 12:06:32 +0200 Subject: [PATCH] Fixed getMac and launching instance with no mods --- client.js | 19 ++++++++++--------- static/slaveDisplay.js | 14 ++++++++------ 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/client.js b/client.js index cef8ebd2..c9fb1062 100644 --- a/client.js +++ b/client.js @@ -605,9 +605,9 @@ function instanceManagement() { } } if(global.mac){ - getMac(callback); - } else { callback(undefined, global.mac); + } else { + getMac(callback); } },1000)}); } @@ -892,7 +892,7 @@ function instanceManagement() { // returns [{modName:string,hash:string}, ... ] function hashMods(instanceName, callback) { if(!callback) { - throw "ERROR in function hashMods NO CALLBACK" + throw new Error("ERROR in function hashMods NO CALLBACK"); } function callback2(hash, modName){ hashedMods[hashedMods.length] = { @@ -900,22 +900,23 @@ function hashMods(instanceName, callback) { hash: hash, } // check if this callback has ran once for each mod - if(hashedMods.length == /*mods.length*/ + instanceMods.length) { + if(hashedMods.length == instanceMods.length) { callback(hashedMods); } //console.log(modname); } let hashedMods = []; - var i = 0; /*let mods = fs.readdirSync("./sharedMods/")*/ let instanceMods = fs.readdirSync("./instances/"+instanceName+"/mods/"); - - for(o=0;o { - console.log(mod.modName); - if(mod.modName.includes("remoteMap")){ - hasRemoteMap = true; // we are still doing the logic on the outside, in case there are multiple instances of remoteMap installed.... - } - }); + if(slaveData[key].mods){ // not all instances have mods apparently + slaveData[key].mods.forEach(mod => { + console.log(mod.modName); + if(mod.modName.includes("remoteMap")){ + hasRemoteMap = true; // we are still doing the logic on the outside, in case there are multiple instances of remoteMap installed.... + } + }); + } if(hasRemoteMap){ HTML += "Remote map" }