From f3171c2feb1fede99ebcff505798275152b977d9 Mon Sep 17 00:00:00 2001 From: Hornwitser Date: Sun, 17 Nov 2019 23:11:23 +0100 Subject: [PATCH] Remove support for uploading mods to master Remove the uploadMod and checkMod APIs as these have become more or less obsolete after Factorio implementd syncing mods to the server in game. --- CHANGELOG.md | 2 ++ client.js | 42 ------------------------------------- config.json.dist | 1 - master.js | 54 ------------------------------------------------ 4 files changed, 2 insertions(+), 97 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ab3ceef..05d74489 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -64,6 +64,8 @@ Version 2.0.0 - Removed getLua and getCommand from lib/clusterTools. If you need to run more than the most trivial of code in commands use the save patcher and add in a remote interface. +- Removed mod uploading and distributing from the HTTP interface. Breaks + the old unmaintained and no longer needed factorioClusterioClient. Version 1.2.3 diff --git a/client.js b/client.js index ab5b976e..325eef0c 100644 --- a/client.js +++ b/client.js @@ -704,48 +704,6 @@ async function instanceManagement(config, instance, instanceconfig, server) { }); } }); - // Mod uploading and management ----------------------------------------------- - // get mod names and hashes - // string: instance, function: callback - - setTimeout(function(){hashMods(instance, uploadMods)}, 5000); - function uploadMods(modHashes) { - // [{modName:string,hash:string}, ... ] - for(let i=0;i { - if(file == req.body.modName) { - found = true; - } - }); - if(!found) { - // we don't have mod, plz send - res.send(req.body.modName); - } else { - res.send("found"); - } - res.end(); -}); -/** -POST endpoint for uploading mods to the master server. Required for automatic mod downloads with factorioClusterioClient (electron app, see seperate repo) -@memberof clusterioMaster -@instance -@alias /api/uploadMod -*/ -app.post("/api/uploadMod", authenticate.middleware, function(req,res) { - endpointHitCounter.labels(req.route.path).inc(); - if (req.files && req.files.file) { - // console.log(req.files.file); - req.files.file.mv(path.resolve(config.databaseDirectory, "masterMods", req.files.file.name), function(err) { - if (err) { - res.status(500).send(err); - } else { - res.send('File uploaded!'); - console.log("Uploaded mod: " + req.files.file.name); - } - }); - } else { - res.send('No files were uploaded.'); - - } -}); /** Prepare the slaveCache for both /api/slaves calls */ @@ -671,12 +623,6 @@ async function startServer() { config.databaseDirectory = args.databaseDirectory || config.databaseDirectory || "./database"; await fs.ensureDir(config.databaseDirectory); - const masterModFolder = path.join(config.databaseDirectory, "masterMods"); - await fs.ensureDir(masterModFolder); - - // mod downloads - app.use(express.static(masterModFolder)); - await loadDatabase(config.databaseDirectory); authenticate.setAuthSecret(config.masterAuthSecret);