koishi-plugin-noah 1.1.3 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +26 -2
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -1479,6 +1479,9 @@ var SDVXService2 = class _SDVXService {
|
|
|
1479
1479
|
async getAllScore(ctx, url, cardId, config) {
|
|
1480
1480
|
try {
|
|
1481
1481
|
const data = await ctx.http.get(`/sdvx/scores?card=${cardId}`, { baseURL: url, responseType: "json" });
|
|
1482
|
+
if (data.errorCode === 1 && data.errorMessage === "没有此卡或该玩家未游玩 SDVX") {
|
|
1483
|
+
return [];
|
|
1484
|
+
}
|
|
1482
1485
|
const filteredData = data.filter((score) => score.music_id !== 244 && score.music_id !== 1759 && score.music_id !== 1761);
|
|
1483
1486
|
const musicIds = filteredData.map((score) => score.music_id);
|
|
1484
1487
|
const diffTypes = filteredData.map((score) => parseInt(score.music_diff));
|
|
@@ -3012,8 +3015,29 @@ var AssetService = class {
|
|
|
3012
3015
|
const extractPath = (0, import_path3.resolve)(this.basePath, "assets");
|
|
3013
3016
|
await (0, import_promises.mkdir)(extractPath, { recursive: true });
|
|
3014
3017
|
this.logger.info(`Extracting assets to ${extractPath}`);
|
|
3015
|
-
|
|
3016
|
-
|
|
3018
|
+
try {
|
|
3019
|
+
const zip = new import_adm_zip.default(archivePath);
|
|
3020
|
+
const zipEntries = zip.getEntries();
|
|
3021
|
+
this.logger.info(`Found ${zipEntries.length} files in archive`);
|
|
3022
|
+
for (const entry of zipEntries) {
|
|
3023
|
+
try {
|
|
3024
|
+
const targetPath = import_path2.default.join(extractPath, entry.entryName);
|
|
3025
|
+
this.logger.debug(`Extracting: ${entry.entryName} to ${targetPath}`);
|
|
3026
|
+
const targetDir = import_path2.default.dirname(targetPath);
|
|
3027
|
+
await (0, import_promises.mkdir)(targetDir, { recursive: true });
|
|
3028
|
+
zip.extractEntryTo(entry, targetDir, false, true);
|
|
3029
|
+
if (process.platform !== "win32") {
|
|
3030
|
+
import_fs.default.chmodSync(targetPath, 420);
|
|
3031
|
+
}
|
|
3032
|
+
} catch (err) {
|
|
3033
|
+
this.logger.error(`Failed to extract ${entry.entryName}: ${err.message}`);
|
|
3034
|
+
}
|
|
3035
|
+
}
|
|
3036
|
+
this.logger.info("Asset extraction completed");
|
|
3037
|
+
} catch (error) {
|
|
3038
|
+
this.logger.error(`Failed to extract assets: ${error.message}`);
|
|
3039
|
+
throw error;
|
|
3040
|
+
}
|
|
3017
3041
|
}
|
|
3018
3042
|
/**
|
|
3019
3043
|
* Ensure a directory exists
|