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.
This commit is contained in:
Hornwitser committed 2019-10-28 19:46:21 +01:00
1 parent ff3fc3b94b
commit bc444b79c2
3 files changed
+3 -24

No files matched your search

+2
View File
@@ -34,6 +34,8 @@ Version 2.0.0
- The game port, RCON port and RCON password instance config entries are are - 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 now null by default, indicating that a random one will be generated every
time the instance is started. time the instance is started.
- Removed the broken client download command as this would download
pre-releases.
### Breaking Changes ### Breaking Changes
+1 -1
View File
@@ -9,7 +9,7 @@ WORKDIR factorioClusterio
RUN mkdir instances sharedMods RUN mkdir instances sharedMods
RUN cp config.json.dist config.json RUN cp config.json.dist config.json
RUN node client download RUN node client manage shared mods add clusterio
LABEL maintainer "Sir3lit@gmail.com" LABEL maintainer "Sir3lit@gmail.com"
-23
View File
@@ -1,10 +1,8 @@
const fs = require('fs-extra'); const fs = require('fs-extra');
const Tail = require('tail').Tail; const Tail = require('tail').Tail;
const https = require('follow-redirects').https;
const needle = require("needle"); const needle = require("needle");
const child_process = require('child_process'); const child_process = require('child_process');
const path = require('path'); const path = require('path');
const syncRequest = require('sync-request');
const request = require("request"); const request = require("request");
const deepmerge = require("deepmerge"); const deepmerge = require("deepmerge");
const getMac = require('getmac').getMac; 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 * Create and update symlinks for shared mods in an instance
* *
@@ -542,8 +521,6 @@ async function startClient() {
// process.exit(0); // process.exit(0);
} else if (command == "delete") { } else if (command == "delete") {
await deleteInstance(instance); await deleteInstance(instance);
} else if (command == "download") {
await downloadMod();
} else if (command == "start" && instance === undefined) { } else if (command == "start" && instance === undefined) {
console.error("ERROR: No instanceName provided!"); console.error("ERROR: No instanceName provided!");
console.error("Usage: node client start [instanceName]"); console.error("Usage: node client start [instanceName]");