fixed semantical errors in code

This commit is contained in:
APEX FIGHT 2025-03-11 10:18:32 -04:00
parent c6ab659e78
commit 3caa59ccbf

24
main.js
View File

@ -13,11 +13,6 @@ 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 = {
@ -26,21 +21,24 @@ 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;
}
}
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");
registry[ele] = modinfo;
});