js: CD-Aware-AutoGather: 捕获json文件无效导致的脚本异常 (#1706)

This commit is contained in:
Patrick-Ze
2025-08-25 22:50:51 +08:00
committed by GitHub
parent 8c758ac17d
commit eb01271085
3 changed files with 9 additions and 4 deletions

View File

@@ -180,8 +180,13 @@ async function runClearMode() {
function scanSpecialCollectMethod(jsonFiles) {
const actions = jsonFiles.flatMap((filePath) => {
const data = JSON.parse(file.readTextSync(filePath));
return data.positions.map((p) => p.action).filter((a) => a);
try {
const data = JSON.parse(file.readTextSync(filePath));
return data.positions.map((p) => p.action).filter((a) => a);
} catch (e) {
log.warn(`json文件无效: {0}: ${e.message}`, filePath);
return [];
}
});
return [...new Set(actions)];
}

View File

@@ -1,7 +1,7 @@
{
"manifest_version": 1,
"name": "带CD管理的自动采集",
"version": "1.5",
"version": "1.6",
"bgi_version": "0.45.0",
"description": "自动同步你通过BetterGI订阅的地图追踪任务执行采集任务并管理材料刷新时间支持多账号。\n首次使用前请先简单阅读说明可在`全自动`——`JS脚本`页面,点击本脚本名称查看)",
"authors": [

View File

@@ -1,7 +1,7 @@
{
"info": {
"name": "晶蝶-稻妻-踏鞴砂-12个",
"type": "collect"
"type": "collect",
"version": "1.0",
"description": "",
"authors": [