Compare commits
No commits in common. "main" and "master" have entirely different histories.
6
LICENSE
6
LICENSE
|
@ -1,6 +0,0 @@
|
|||
As a special exception, if you link this library with files
|
||||
compiled with a GNU compiler to produce an executable, this
|
||||
does not cause the resulting executable to be covered by
|
||||
the GNU General Public License. This exception does not
|
||||
however invalidate any other reasons why the executable
|
||||
file might be covered by the GNU General Public License.
|
46
main.js
Normal file
46
main.js
Normal file
|
@ -0,0 +1,46 @@
|
|||
const fs = require('fs');
|
||||
const AdmZip = require('adm-zip');
|
||||
const toml = require('toml');
|
||||
|
||||
let re = [];
|
||||
let ls = fs.readdirSync("mods/");
|
||||
ls = ls.filter((a) => a.endsWith(".jar"));
|
||||
|
||||
ls.forEach((v) => {
|
||||
try {
|
||||
let zip = new AdmZip("mods/" + v);
|
||||
try {
|
||||
const modsTomlData = zip.getEntry("META-INF/mods.toml").getData().toString();
|
||||
const modsToml = toml.parse(modsTomlData).mods;
|
||||
modsToml.forEach((mod) => {
|
||||
re.push({ modid: mod.modId, modfile: v });
|
||||
});
|
||||
} catch (e) {
|
||||
const fabricModJsonData = zip.getEntry("fabric.mod.json").getData().toString();
|
||||
const fabricModJson = JSON.parse(fabricModJsonData);
|
||||
re.push({ modid: fabricModJson.id, modfile: v });
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
});
|
||||
|
||||
for (let i of re) {
|
||||
//DeMoon后端服务 StarNet.X所有
|
||||
fetch(`http://154.201.72.75:3008/${i.modid}`).then(async (r) => {
|
||||
try {
|
||||
let body = await r.json();
|
||||
if (body.client === 'true') {
|
||||
if (i.modfile) {
|
||||
fs.renameSync('mods/' + i.modfile, 'clientmod/' + i.modfile);
|
||||
} else {
|
||||
throw new Error(`modfile is undefined for mod id ${i.modid}`);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`Error fetching mod info for ${i.modid}: ${error}`);
|
||||
}
|
||||
}).catch((error) => {
|
||||
console.error(`Error fetching mod info for ${i.modid}: ${error}`);
|
||||
});
|
||||
}
|
120
package-lock.json
generated
Normal file
120
package-lock.json
generated
Normal file
|
@ -0,0 +1,120 @@
|
|||
{
|
||||
"name": "demoon",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "demoon",
|
||||
"version": "1.0.0",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"adm-zip": "^0.5.14",
|
||||
"data-uri-to-buffer": "^4.0.1",
|
||||
"fetch-blob": "^3.2.0",
|
||||
"formdata-polyfill": "^4.0.10",
|
||||
"node-domexception": "^1.0.0",
|
||||
"node-fetch": "^3.3.2",
|
||||
"toml": "^3.0.0",
|
||||
"web-streams-polyfill": "^3.3.3"
|
||||
}
|
||||
},
|
||||
"node_modules/adm-zip": {
|
||||
"version": "0.5.14",
|
||||
"resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.5.14.tgz",
|
||||
"integrity": "sha512-DnyqqifT4Jrcvb8USYjp6FHtBpEIz1mnXu6pTRHZ0RL69LbQYiO+0lDFg5+OKA7U29oWSs3a/i8fhn8ZcceIWg==",
|
||||
"engines": {
|
||||
"node": ">=12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/data-uri-to-buffer": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz",
|
||||
"integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==",
|
||||
"engines": {
|
||||
"node": ">= 12"
|
||||
}
|
||||
},
|
||||
"node_modules/fetch-blob": {
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz",
|
||||
"integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/jimmywarting"
|
||||
},
|
||||
{
|
||||
"type": "paypal",
|
||||
"url": "https://paypal.me/jimmywarting"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"node-domexception": "^1.0.0",
|
||||
"web-streams-polyfill": "^3.0.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.20 || >= 14.13"
|
||||
}
|
||||
},
|
||||
"node_modules/formdata-polyfill": {
|
||||
"version": "4.0.10",
|
||||
"resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz",
|
||||
"integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==",
|
||||
"dependencies": {
|
||||
"fetch-blob": "^3.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.20.0"
|
||||
}
|
||||
},
|
||||
"node_modules/node-domexception": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz",
|
||||
"integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/jimmywarting"
|
||||
},
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://paypal.me/jimmywarting"
|
||||
}
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10.5.0"
|
||||
}
|
||||
},
|
||||
"node_modules/node-fetch": {
|
||||
"version": "3.3.2",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz",
|
||||
"integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==",
|
||||
"dependencies": {
|
||||
"data-uri-to-buffer": "^4.0.0",
|
||||
"fetch-blob": "^3.1.4",
|
||||
"formdata-polyfill": "^4.0.10"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/node-fetch"
|
||||
}
|
||||
},
|
||||
"node_modules/toml": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/toml/-/toml-3.0.0.tgz",
|
||||
"integrity": "sha512-y/mWCZinnvxjTKYhJ+pYxwD0mRLVvOtdS2Awbgxln6iEnt4rk0yBxeSBHkGJcPucRiG0e55mwWp+g/05rsrd6w=="
|
||||
},
|
||||
"node_modules/web-streams-polyfill": {
|
||||
"version": "3.3.3",
|
||||
"resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz",
|
||||
"integrity": "sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==",
|
||||
"engines": {
|
||||
"node": ">= 8"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
21
package.json
Normal file
21
package.json
Normal file
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"name": "demoon",
|
||||
"version": "1.0.0",
|
||||
"description": "this is a project from starnetx",
|
||||
"main": "main.js",
|
||||
"dependencies": {
|
||||
"adm-zip": "^0.5.14",
|
||||
"data-uri-to-buffer": "^4.0.1",
|
||||
"fetch-blob": "^3.2.0",
|
||||
"formdata-polyfill": "^4.0.10",
|
||||
"node-domexception": "^1.0.0",
|
||||
"node-fetch": "^3.3.2",
|
||||
"toml": "^3.0.0",
|
||||
"web-streams-polyfill": "^3.3.3"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node main.js"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC"
|
||||
}
|
Loading…
Reference in New Issue
Block a user