fixed semantical errors in code
This commit is contained in:
parent
c6ab659e78
commit
3caa59ccbf
28
main.js
28
main.js
@ -13,12 +13,7 @@ var modList = mods.mod_list;
|
||||
var modDownloads = mods.mod_downloads;
|
||||
|
||||
modList.forEach((ele, idx, arr) => {
|
||||
if (process.argv[2] != "overwrite"){
|
||||
if (Object.keys(oldRegistry).includes(ele)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
let link = modDownloads[ele];
|
||||
let modinfo = {
|
||||
modName: "",
|
||||
@ -26,22 +21,25 @@ modList.forEach((ele, idx, arr) => {
|
||||
|
||||
}
|
||||
|
||||
modinfo.modName = "*" + ele;
|
||||
registry[ele] = modinfo;
|
||||
|
||||
if (link == "client"){
|
||||
modinfo.modName = "*" + ele;
|
||||
return;
|
||||
}
|
||||
let output = cp.execSync("cd /root/mcserver/mods && wget --content-disposition -nc " + link).toString('utf-8'); //change dir and download mod
|
||||
console.log(output);
|
||||
try {
|
||||
modinfo.modName = output.match(/(["'])(?:(?=(\\?))\2.)*?\1/)[0];//kill myself?
|
||||
modinfo.modName = modinfo.modName.substring(1, modinfo.modName.length - 1);
|
||||
} catch{
|
||||
modinfo.modName = "*" + ele;
|
||||
|
||||
if (process.argv[2] != "overwrite"){
|
||||
if (Object.keys(oldRegistry).includes(ele.substring(1))) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
console.log("\n\n\n\n\n\n" + modinfo.modName + "\n\n\n\n\n\n");
|
||||
registry[ele] = modinfo;
|
||||
let output = cp.execSync("cd /root/mcserver/mods && wget --content-disposition -nc " + link).toString('utf-8'); //change dir and download mod
|
||||
console.log(output);
|
||||
|
||||
console.log("\n\n\n\n\n\n" + modinfo.modName + "\n\n\n\n\n\n");
|
||||
|
||||
});
|
||||
|
||||
fs.writeFileSync("/root/mcserver/modRegistry.yaml", yaml.stringify(registry));
|
||||
|
Loading…
x
Reference in New Issue
Block a user