fix:unzip无添加、遇到Mixin错误会崩溃
This commit is contained in:
@@ -181,15 +181,21 @@ export class Dex {
|
|||||||
let index = 1;
|
let index = 1;
|
||||||
for await (const entry of zip) {
|
for await (const entry of zip) {
|
||||||
const isDir = entry.fileName.endsWith("/");
|
const isDir = entry.fileName.endsWith("/");
|
||||||
console.log(index, entry.fileName);
|
logger.info(`index: ${index}, fileName: ${entry.fileName}`);
|
||||||
if (isDir) {
|
if (isDir) {
|
||||||
|
if (this._ublack(entry.fileName)) {
|
||||||
|
this.message.unzip(entry.fileName, zip.length, index);
|
||||||
|
index++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
await fs.promises.mkdir(`${instancePath}/${entry.fileName}`, {
|
await fs.promises.mkdir(`${instancePath}/${entry.fileName}`, {
|
||||||
recursive: true,
|
recursive: true,
|
||||||
});
|
});
|
||||||
} else if (entry.fileName.startsWith("overrides/")) {
|
} else if (entry.fileName.startsWith("overrides/")) {
|
||||||
// 跳过黑名单文件
|
// 跳过黑名单文件
|
||||||
if (this._ublack(entry.fileName)) {
|
if (this._ublack(entry.fileName)) {
|
||||||
console.log("Skip blacklist file", entry.fileName);
|
logger.info("Skip blacklist file", entry.fileName);
|
||||||
|
this.message.unzip(entry.fileName, zip.length, index);
|
||||||
index++;
|
index++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -222,7 +228,10 @@ export class Dex {
|
|||||||
"overrides/options.txt",
|
"overrides/options.txt",
|
||||||
"shaderpacks",
|
"shaderpacks",
|
||||||
"essential",
|
"essential",
|
||||||
"resourcepacks"
|
"resourcepacks",
|
||||||
|
"PCL",
|
||||||
|
"CustomSkinLoader",
|
||||||
|
"overrides"
|
||||||
];
|
];
|
||||||
|
|
||||||
return blacklist.some(item => filename.includes(item));
|
return blacklist.some(item => filename.includes(item));
|
||||||
|
|||||||
@@ -113,8 +113,10 @@ export class DeEarth {
|
|||||||
const serverMods: string[] = [];
|
const serverMods: string[] = [];
|
||||||
const modIds: string[] = [];
|
const modIds: string[] = [];
|
||||||
const map: Map<string, string> = new Map();
|
const map: Map<string, string> = new Map();
|
||||||
|
try{
|
||||||
for (const file of this.files) {
|
for (const file of this.files) {
|
||||||
for (const info of file.infos) {
|
for (const info of file.infos) {
|
||||||
|
try{
|
||||||
const config = JSON.parse(info.data);
|
const config = JSON.parse(info.data);
|
||||||
const keys = Object.keys(config);
|
const keys = Object.keys(config);
|
||||||
if (keys.includes("id")) {
|
if (keys.includes("id")) {
|
||||||
@@ -124,6 +126,9 @@ export class DeEarth {
|
|||||||
modIds.push(config.mods[0].modId);
|
modIds.push(config.mods[0].modId);
|
||||||
map.set(config.mods[0].modId, file.filename);
|
map.set(config.mods[0].modId, file.filename);
|
||||||
}
|
}
|
||||||
|
}catch(error: any){
|
||||||
|
logger.error("Checking mod info file failed, filename: " + file.filename, error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const modids = modIds;
|
const modids = modIds;
|
||||||
@@ -146,6 +151,9 @@ export class DeEarth {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}catch(error: any){
|
||||||
|
logger.error("Dexpub check failed", error);
|
||||||
|
}
|
||||||
return { serverMods, clientMods };
|
return { serverMods, clientMods };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user