fix(install): 允许添加不同来源的安装相同包名任务

改进任务重复检查逻辑,现在会同时检查软件包名称和来源
修复取消下载时未正确处理任务状态的问题
```

```msg
ci: 添加测试和构建的GitHub Actions配置文件

添加test.yml和build.yml的备份文件,包含单元测试、E2E测试和构建流程
This commit is contained in:
2026-03-29 12:23:32 +08:00
parent 033735d476
commit aec1faf964
4 changed files with 64 additions and 23 deletions

View File

@@ -25,8 +25,15 @@ export const handleInstall = (appObj?: App) => {
const targetApp = appObj || currentApp.value;
if (!targetApp?.pkgname) return;
if (downloads.value.find((d) => d.pkgname === targetApp.pkgname)) {
logger.info(`任务已存在,忽略重复添加: ${targetApp.pkgname}`);
if (
downloads.value.find(
(d) =>
d.pkgname === targetApp.pkgname && d.origin === targetApp.origin,
)
) {
logger.info(
`任务已存在,忽略重复添加: ${targetApp.pkgname} (${targetApp.origin})`,
);
return;
}
@@ -95,8 +102,14 @@ export const handleRetry = (download_: DownloadItem) => {
export const handleUpgrade = (app: App) => {
if (!app.pkgname) return;
if (downloads.value.find((d) => d.pkgname === app.pkgname)) {
logger.info(`任务已存在,忽略重复添加: ${app.pkgname}`);
if (
downloads.value.find(
(d) => d.pkgname === app.pkgname && d.origin === app.origin,
)
) {
logger.info(
`任务已存在,忽略重复添加: ${app.pkgname} (${app.origin})`,
);
return;
}