From bc444b79c24066047febf28f71ac3a99df17e385 Mon Sep 17 00:00:00 2001 From: Hornwitser Date: Mon, 28 Oct 2019 14:18:30 +0100 Subject: [PATCH] Remove broken client download command Remove the client download command which would download pre-releases. The mod add command is a complete replacement for it. --- CHANGELOG.md | 2 ++ Dockerfile | 2 +- client.js | 23 ----------------------- 3 files changed, 3 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5af51bc8..2adbb981 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,8 @@ Version 2.0.0 - The game port, RCON port and RCON password instance config entries are are now null by default, indicating that a random one will be generated every time the instance is started. +- Removed the broken client download command as this would download + pre-releases. ### Breaking Changes diff --git a/Dockerfile b/Dockerfile index 6db56d48..040399de 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ WORKDIR factorioClusterio RUN mkdir instances sharedMods RUN cp config.json.dist config.json -RUN node client download +RUN node client manage shared mods add clusterio LABEL maintainer "Sir3lit@gmail.com" diff --git a/client.js b/client.js index 5e3165bf..bbf4987f 100644 --- a/client.js +++ b/client.js @@ -1,10 +1,8 @@ const fs = require('fs-extra'); const Tail = require('tail').Tail; -const https = require('follow-redirects').https; const needle = require("needle"); const child_process = require('child_process'); const path = require('path'); -const syncRequest = require('sync-request'); const request = require("request"); const deepmerge = require("deepmerge"); const getMac = require('getmac').getMac; @@ -209,25 +207,6 @@ async function deleteInstance(instance) { } } -async function downloadMod() { - console.log("Downloading mods..."); - // get JSON data about releases - let res = syncRequest('GET', 'https://api.github.com/repos/Danielv123/factorioClusterioMod/releases', {"headers":{"User-Agent":"factorioClusterio"}}); - let url = JSON.parse(res.getBody())[0].assets[0].browser_download_url; - let name = JSON.parse(res.getBody())[0].assets[0].name; - if(url) { - console.log(url); - let file = fs.createWriteStream("sharedMods/"+name); - https.get(url, function(response) { - response.on('end', function () { - console.log("Downloaded "+name); - process.exit(0); - }); - response.pipe(file); - }).end(); - } -} - /** * Create and update symlinks for shared mods in an instance * @@ -542,8 +521,6 @@ async function startClient() { // process.exit(0); } else if (command == "delete") { await deleteInstance(instance); - } else if (command == "download") { - await downloadMod(); } else if (command == "start" && instance === undefined) { console.error("ERROR: No instanceName provided!"); console.error("Usage: node client start [instanceName]");