Merge pull request #262 from survaaki/1.2.x

Early config.uploadModsToMaster check so it does not do a bunch of checks
This commit is contained in:
Arvids Godjuks authored and GitHub committed 2019-11-25 23:10:59 +01:00
commit 136bd24399
2 files changed
+18 -17

No files matched your search

+1
View File
@@ -7,6 +7,7 @@ Version 1.2.4
- Removed broken remote combinator signaling. - Removed broken remote combinator signaling.
- Fixed research sync endlessly updating already researched technologies - Fixed research sync endlessly updating already researched technologies
- Removed obsolete item/fluid statistics from clusterioMod - Removed obsolete item/fluid statistics from clusterioMod
- Removed per mod upload logging when config.uploadModsToMaster disabled
Version 1.2.3 Version 1.2.3
+17 -17
View File
@@ -737,19 +737,19 @@ async function instanceManagement(instanceconfig) {
setTimeout(function(){hashMods(instance, uploadMods)}, 5000); setTimeout(function(){hashMods(instance, uploadMods)}, 5000);
function uploadMods(modHashes) { function uploadMods(modHashes) {
// [{modName:string,hash:string}, ... ] if (config.uploadModsToMaster) {
for(let i=0;i<modHashes.length;i++){ // [{modName:string,hash:string}, ... ]
let payload = { for(let i=0;i<modHashes.length;i++){
modName: modHashes[i].modName, let payload = {
hash: modHashes[i].hash, modName: modHashes[i].modName,
}; hash: modHashes[i].hash,
needle.post(config.masterIP + ":" + config.masterPort + '/api/checkMod', payload, needleOptionsWithTokenAuthHeader, function (err, response, body) { };
if(err) console.error("Unable to contact master server /api/checkMod! Please check your config.json."); needle.post(config.masterIP + ":" + config.masterPort + '/api/checkMod', payload, needleOptionsWithTokenAuthHeader, function (err, response, body) {
if(response && body && body == "found") { if(err) console.error("Unable to contact master server /api/checkMod! Please check your config.json.");
console.log("master has mod "+modHashes[i].modName); if(response && body && body == "found") {
} else if (response && body && typeof body == "string") { console.log("master has mod "+modHashes[i].modName);
let mod = response.body; } else if (response && body && typeof body == "string") {
if(config.uploadModsToMaster){ let mod = response.body;
console.log("Sending mod: " + mod); console.log("Sending mod: " + mod);
// Send mods master says it wants // Send mods master says it wants
// response.body is a string which is a modName.zip // response.body is a string which is a modName.zip
@@ -766,11 +766,11 @@ async function instanceManagement(instanceconfig) {
}); });
var form = req.form(); var form = req.form();
form.append('file', fs.createReadStream(config.instanceDirectory+"/"+instance+"/mods/"+mod)); form.append('file', fs.createReadStream(config.instanceDirectory+"/"+instance+"/mods/"+mod));
} else {
console.log("Not sending mod: " + mod + " to master because config.uploadModsToMaster is not enabled")
} }
} });
}); }
} else {
console.log("Bypassing sending mods to master because config.uploadModsToMaster is not enabled")
} }
} }
} // END OF INSTANCE START --------------------------------------------------------------------- } // END OF INSTANCE START ---------------------------------------------------------------------