Skip to content

Commit

Permalink
🐛 修复脚本删除同步失败的问题 #254
Browse files Browse the repository at this point in the history
  • Loading branch information
CodFrm committed Feb 26, 2024
1 parent 57bc6f9 commit bf68abb
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "scriptcat",
"version": "0.16.0",
"version": "0.16.1",
"description": "脚本猫,一个可以执行用户脚本的浏览器扩展,万物皆可脚本化,让你的浏览器可以做更多的事情!",
"author": "CodFrm",
"license": "GPLv3",
Expand Down
5 changes: 3 additions & 2 deletions src/app/service/synchronize/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ export default class SynchronizeManager extends Manager {
`脚本${script.name}已被删除`
);
}
scriptMap.delete(uuid);
} else {
// 否则认为是一个无效的.meta文件,进行删除
await fs.delete(file.meta!.path);
Expand Down Expand Up @@ -285,12 +286,12 @@ export default class SynchronizeManager extends Manager {
result.push(this.pullScript(fs, file as SyncFiles));
}
});
// 忽略错误
await Promise.allSettled(result);
// 上传剩下的脚本
scriptMap.forEach((script) => {
result.push(this.pushScript(fs, script));
});
// 忽略错误
await Promise.allSettled(result);
// 重新获取文件列表,保存文件摘要
this.logger.info("sync complete");
await this.updateFileDigest(fs);
Expand Down
2 changes: 0 additions & 2 deletions src/runtime/content/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,6 @@ export function proxyContext(
}
} else if (name === Symbol.unscopables) {
return unscopables;
} else if (name === Symbol.toStringTag) {
return name;
}
}
return undefined;
Expand Down

0 comments on commit bf68abb

Please sign in to comment.