perf(spark): 优化已安装应用检查逻辑

- 对于 Spark 应用,使用 dpkg-query 替代自定义脚本检查安装状态
- 在 list-installed 接口中支持传入包名列表进行批量检查,避免全量扫描
- 添加 aptss 可用性检查,避免在不可用时执行相关命令
- 移除冗余的 check-installed 二次验证步骤
This commit is contained in:
2026-04-16 00:10:14 +08:00
parent 9eb141ee35
commit 68dd6a0a26
3 changed files with 140 additions and 60 deletions
+13 -10
View File
@@ -816,7 +816,19 @@ const refreshInstalledApps = async () => {
installedError.value = "";
try {
const origin = activeInstalledOrigin.value;
const result = await window.ipcRenderer.invoke("list-installed", origin);
// Spark 优化:只检查远端商店目录中的应用,避免全量扫描
let pkgnameList: string[] | undefined;
if (origin === "spark") {
pkgnameList = apps.value
.filter((a) => a.origin === "spark")
.map((a) => a.pkgname);
}
const result = await window.ipcRenderer.invoke("list-installed", {
origin,
pkgnameList,
});
if (!result?.success) {
installedApps.value = [];
installedError.value = result?.message || "读取已安装应用失败";
@@ -835,15 +847,6 @@ const refreshInstalledApps = async () => {
continue;
}
// 二次确认:使用 check-installed 验证包是否真正安装
const isReallyInstalled = await window.ipcRenderer.invoke(
"check-installed",
{ pkgname: app.pkgname, origin: app.origin },
);
if (!isReallyInstalled) {
continue;
}
if (appInfo) {
appInfo.flags = app.flags;
appInfo.arch = app.arch;