This commit is contained in:
Danielv123 committed 2017-12-09 14:05:17 +01:00
1 parent 9496fa70e0
commit f522f19cb5
3 files changed
+24 -9

No files matched your search

+14
View File
@@ -0,0 +1,14 @@
const fileOps = require("./fileOps.js");
module.exports = {
sync: function(){
let instances;
try {
instances = fileOps.getDirectoriesSync("./instances/");
} catch (e) {
// there are no instances created yet, probably missing the folder
instances = [];
}
return instances;
}
}
+10 -1
View File
@@ -11,7 +11,7 @@ const factorioAPI = require("node-factorio-api");
const fileOps = require("./../fileOps.js");
const config = require("./../../config");
const instances = fileOps.getDirectoriesSync("./instances/");
const instances = require("./../getInstances.js").sync();
/**
Lists mods for an instance as a table. Warning, handles printing internally.
@param {string} instance - Name of the instance or "shared"
@@ -130,3 +130,12 @@ module.exports.downloadFromGitURL = function(url){
});
}
}
/*
module.exports.findUpdates = function(){
console.log("Downloading mods...");
// get JSON data about releases
let res = syncRequest('GET', 'https://api.github.com/repos/Danielv123/factorioClusterioMod/releases', {"headers":{"User-Agent":"Fuck you for requiring user agents!"}});
let url = JSON.parse(res.getBody())[0].assets[0].browser_download_url;
let name = JSON.parse(res.getBody())[0].assets[0].name;
console.log(JSON.parse(res.getBody()))
}*/
-8
View File
@@ -1,8 +0,0 @@
module.exports.findUpdates = function(){
console.log("Downloading mods...");
// get JSON data about releases
let res = syncRequest('GET', 'https://api.github.com/repos/Danielv123/factorioClusterioMod/releases', {"headers":{"User-Agent":"Fuck you for requiring user agents!"}});
let url = JSON.parse(res.getBody())[0].assets[0].browser_download_url;
let name = JSON.parse(res.getBody())[0].assets[0].name;
console.log(JSON.parse(res.getBody()))
}