mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-21 16:13:12 +09:00
Merge pull request #93 from Elbrasch/master
fixes issue #87 "Mod manager downloads oldest version of mod availabl…
This commit is contained in:
2 files changed
+11
-8
No files matched your search
@@ -17,6 +17,8 @@
|
|||||||
"username": "",
|
"username": "",
|
||||||
"__comment4": "Token from your factorio.com profile page. Required for MP and mod manager services.",
|
"__comment4": "Token from your factorio.com profile page. Required for MP and mod manager services.",
|
||||||
"token": "",
|
"token": "",
|
||||||
|
"factorio_version": "0.16.41",
|
||||||
|
"__comment7": "Used for communication with the mod portal, not needed if you manage mods by hand",
|
||||||
|
|
||||||
"__comment5": "General user settings",
|
"__comment5": "General user settings",
|
||||||
"verify_user_identity": false,
|
"verify_user_identity": false,
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ modManager.listMods("shared");
|
|||||||
*/
|
*/
|
||||||
module.exports.listMods = function(instance){
|
module.exports.listMods = function(instance){
|
||||||
if(instance && instances.includes(instance)){
|
if(instance && instances.includes(instance)){
|
||||||
factorioAPI.init(false, 'instances/'+instance+'/instanceMods', 'instances/'+instance+'/saves', '0.16.15');
|
factorioAPI.init(false, 'instances/'+instance+'/instanceMods', 'instances/'+instance+'/saves', config.factorio_version);
|
||||||
factorioAPI.authenticate({
|
factorioAPI.authenticate({
|
||||||
username: config.username,
|
username: config.username,
|
||||||
token: config.token,
|
token: config.token,
|
||||||
@@ -65,7 +65,7 @@ module.exports.listMods = function(instance){
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// list shared mods in /sharedMods/
|
// list shared mods in /sharedMods/
|
||||||
factorioAPI.init(false, 'sharedMods/', '', '0.16.15');
|
factorioAPI.init(false, 'sharedMods/', '', config.factorio_version);
|
||||||
factorioAPI.authenticate({
|
factorioAPI.authenticate({
|
||||||
username: config.username,
|
username: config.username,
|
||||||
token: config.token,
|
token: config.token,
|
||||||
@@ -106,6 +106,7 @@ module.exports.findMods = function(searchTerm){
|
|||||||
name:ellipse(mod.name, 30),
|
name:ellipse(mod.name, 30),
|
||||||
downloads:mod.downloads_count,
|
downloads:mod.downloads_count,
|
||||||
updated: moment(mod.updated_at).format("DD.MM.YY"),
|
updated: moment(mod.updated_at).format("DD.MM.YY"),
|
||||||
|
latest_version: mod.latest_release.version,
|
||||||
owner:mod.owner,
|
owner:mod.owner,
|
||||||
//license: mod.license_name,
|
//license: mod.license_name,
|
||||||
}
|
}
|
||||||
@@ -123,15 +124,15 @@ module.exports.addMod = function(term, instance){
|
|||||||
if(term && term.length > 0){
|
if(term && term.length > 0){
|
||||||
if(term.includes("mods.factorio.com/mods/")){ // https://mods.factorio.com/mods/Danielv123/ChooChoo
|
if(term.includes("mods.factorio.com/mods/")){ // https://mods.factorio.com/mods/Danielv123/ChooChoo
|
||||||
// treat it as a link download
|
// treat it as a link download
|
||||||
factorioAPI.init(false, modDirectory, "", "0.16.15");
|
factorioAPI.init(false, modDirectory, "", config.factorio_version);
|
||||||
factorioAPI.authenticate({
|
factorioAPI.authenticate({
|
||||||
username: config.username,
|
username: config.username,
|
||||||
token: config.token,
|
token: config.token,
|
||||||
require_ownership: false
|
require_ownership: false
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
factorioAPI.searchMods(term.split("/")[term.split("/").length-1]).then(body => {
|
factorioAPI.searchMods(term.split("/")[term.split("/").length-1]).then(body => {
|
||||||
console.log("Im gonna download: "+body[0].name);
|
console.log("Im gonna download: "+body[0].name + " in version: " + body[0].latest_release.version);
|
||||||
factorioAPI.downloadMod(body[0]).then(()=>{
|
factorioAPI.downloadMod( {name: body[0].name, version: body[0].latest_release.version}).then(()=>{
|
||||||
console.log("Mod downloaded");
|
console.log("Mod downloaded");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -166,15 +167,15 @@ module.exports.addMod = function(term, instance){
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// treat it as a search and download the top result
|
// treat it as a search and download the top result
|
||||||
factorioAPI.init(false, modDirectory, "", "0.16.15");
|
factorioAPI.init(false, modDirectory, "", config.factorio_version);
|
||||||
factorioAPI.authenticate({
|
factorioAPI.authenticate({
|
||||||
username: config.username,
|
username: config.username,
|
||||||
token: config.token,
|
token: config.token,
|
||||||
require_ownership: false
|
require_ownership: false
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
factorioAPI.searchMods(term).then(body => {
|
factorioAPI.searchMods(term).then(body => {
|
||||||
console.log("Im gonna download: "+body[0].name);
|
console.log("Im gonna download: "+body[0].name + " in version: " + body[0].latest_release.version);
|
||||||
factorioAPI.downloadMod(body[0]).then(()=>{
|
factorioAPI.downloadMod( {name: body[0].name, version: body[0].latest_release.version}).then(()=>{
|
||||||
console.log("Mod downloaded");
|
console.log("Mod downloaded");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in new issue
Block a user