update:同步DeEarth分支

This commit is contained in:
Tianpao
2025-07-02 20:00:26 +08:00
parent 839d208029
commit ea56258dee

View File

@@ -56,6 +56,24 @@ export async function DeEarth(modpath: string, movepath: string) {
} }
} }
} catch (error) { //mods.toml或fabric.mod.json判断 } catch (error) { //mods.toml或fabric.mod.json判断
try{//DeEarthPublic
for (let i = 0; i < zip.length; i++) {
const e = zip[i]
if (e.entryName == "META-INF/mods.toml") { //Forge,Neoforge
const modid = toml.parse(e.getData().toString('utf-8')).mods[0].modId
const body = JSON.parse(await FastGot(`https://dearth.0771010.xyz/api/modid?modid=${modid}`))
if (body.isClient) {
fs.renameSync(modpath, `${movepath}/${path.basename(modpath)}`)
}
} else if (e.entryName == "fabric.mod.json") { //Fabric
const modid = JSON.parse(e.getData().toString('utf-8')).id
const body = JSON.parse(await FastGot(`https://dearth.0771010.xyz/api/modid?modid=${modid}`))
if (body.isClient) {
fs.renameSync(modpath, `${movepath}/${path.basename(modpath)}`)
}
}
}
}catch(errorr){
for (let i = 0; i < zip.length; i++) { for (let i = 0; i < zip.length; i++) {
const e = zip[i] const e = zip[i]
try { try {
@@ -101,7 +119,7 @@ export async function DeEarth(modpath: string, movepath: string) {
} }
} }
} }
//} }
} }
async function FastGot(url: string) { async function FastGot(url: string) {