mirror of
https://gitee.com/spark-store-project/spark-store
synced 2026-04-30 03:10:16 +08:00
fix(下载队列): 为滚动容器添加overscroll-contain防止滚动溢出
refactor(安装管理器): 移除upgradeOnly逻辑并统一使用ssinstall命令 test(更新中心): 更新测试用例以匹配新的安装逻辑
This commit is contained in:
@@ -148,8 +148,7 @@ ipcMain.on("queue-install", async (event, download_json) => {
|
||||
typeof download_json === "string"
|
||||
? JSON.parse(download_json)
|
||||
: download_json;
|
||||
const { id, pkgname, metalinkUrl, filename, upgradeOnly, origin } =
|
||||
download || {};
|
||||
const { id, pkgname, metalinkUrl, filename, origin } = download || {};
|
||||
|
||||
if (!id || !pkgname) {
|
||||
logger.warn("passed arguments missing id or pkgname");
|
||||
@@ -249,26 +248,24 @@ ipcMain.on("queue-install", async (event, download_json) => {
|
||||
}
|
||||
|
||||
if (origin === "spark") {
|
||||
// Spark Store logic
|
||||
if (upgradeOnly) {
|
||||
execCommand = superUserCmd || SHELL_CALLER_PATH;
|
||||
if (superUserCmd) execParams.push(SHELL_CALLER_PATH);
|
||||
execParams.push("aptss", "install", "-y", pkgname, "--only-upgrade");
|
||||
} else {
|
||||
execCommand = superUserCmd || SHELL_CALLER_PATH;
|
||||
if (superUserCmd) execParams.push(SHELL_CALLER_PATH);
|
||||
execCommand = superUserCmd || SHELL_CALLER_PATH;
|
||||
if (superUserCmd) execParams.push(SHELL_CALLER_PATH);
|
||||
|
||||
if (metalinkUrl && filename) {
|
||||
execParams.push(
|
||||
"ssinstall",
|
||||
`${downloadDir}/${filename}`,
|
||||
"--delete-after-install",
|
||||
"--no-create-desktop-entry",
|
||||
"--native",
|
||||
);
|
||||
} else {
|
||||
execParams.push("aptss", "install", "-y", pkgname);
|
||||
}
|
||||
if (metalinkUrl && filename) {
|
||||
execParams.push(
|
||||
"ssinstall",
|
||||
`${downloadDir}/${filename}`,
|
||||
"--delete-after-install",
|
||||
"--no-create-desktop-entry",
|
||||
"--native",
|
||||
);
|
||||
} else {
|
||||
execParams.push(
|
||||
"ssinstall",
|
||||
pkgname,
|
||||
"--no-create-desktop-entry",
|
||||
"--native",
|
||||
);
|
||||
}
|
||||
} else {
|
||||
// APM Store logic
|
||||
|
||||
@@ -3,7 +3,6 @@ import { describe, expect, it, vi } from "vitest";
|
||||
import type { UpdateCenterItem } from "../../../../electron/main/backend/update-center/types";
|
||||
import {
|
||||
createTaskRunner,
|
||||
buildLegacySparkUpgradeCommand,
|
||||
installUpdateItem,
|
||||
} from "../../../../electron/main/backend/update-center/install";
|
||||
import { createUpdateCenterQueue } from "../../../../electron/main/backend/update-center/queue";
|
||||
@@ -114,22 +113,6 @@ describe("update-center task runner", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("returns a direct aptss upgrade command instead of spark-update-tool", () => {
|
||||
expect(
|
||||
buildLegacySparkUpgradeCommand("spark-weather", "/usr/bin/pkexec"),
|
||||
).toEqual({
|
||||
execCommand: "/usr/bin/pkexec",
|
||||
execParams: [
|
||||
"/opt/spark-store/extras/shell-caller.sh",
|
||||
"aptss",
|
||||
"install",
|
||||
"-y",
|
||||
"spark-weather",
|
||||
"--only-upgrade",
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
it("blocks close while a refresh or task is still running", () => {
|
||||
const queue = createUpdateCenterQueue();
|
||||
const item = createAptssItem();
|
||||
@@ -208,7 +191,7 @@ describe("update-center task runner", () => {
|
||||
{
|
||||
id: task.id,
|
||||
status: "failed",
|
||||
error: "APM update task requires downloaded package metadata",
|
||||
error: "Update task for spark-player requires download metadata (URL and filename)",
|
||||
},
|
||||
],
|
||||
});
|
||||
@@ -300,4 +283,28 @@ describe("update-center task runner", () => {
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it("uses ssinstall for aptss (spark) file installs", async () => {
|
||||
childProcessMock.spawnCalls.length = 0;
|
||||
|
||||
await installUpdateItem({
|
||||
item: createAptssItem(),
|
||||
filePath: "/tmp/spark-weather.deb",
|
||||
superUserCmd: "/usr/bin/pkexec",
|
||||
});
|
||||
|
||||
expect(childProcessMock.spawnCalls).toEqual([
|
||||
{
|
||||
command: "/usr/bin/pkexec",
|
||||
args: [
|
||||
"/opt/spark-store/extras/shell-caller.sh",
|
||||
"ssinstall",
|
||||
"/tmp/spark-weather.deb",
|
||||
"--delete-after-install",
|
||||
"--no-create-desktop-entry",
|
||||
"--native",
|
||||
],
|
||||
},
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
@click="handleOverlayClick"
|
||||
>
|
||||
<div
|
||||
class="scrollbar-nowidth scrollbar-thumb-slate-200 dark:scrollbar-thumb-slate-700 scrollbar-track-transparent w-full max-w-2xl max-h-[85vh] overflow-y-auto rounded-3xl border border-white/10 bg-white/95 p-6 shadow-2xl dark:border-slate-800 dark:bg-slate-900"
|
||||
class="scrollbar-nowidth scrollbar-thumb-slate-200 dark:scrollbar-thumb-slate-700 scrollbar-track-transparent w-full max-w-2xl max-h-[85vh] overflow-y-auto overscroll-contain rounded-3xl border border-white/10 bg-white/95 p-6 shadow-2xl dark:border-slate-800 dark:bg-slate-900"
|
||||
@click.stop
|
||||
>
|
||||
<div class="flex items-start justify-between">
|
||||
@@ -154,7 +154,7 @@
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
class="max-h-48 space-y-2 overflow-y-auto rounded-2xl bg-slate-50/80 p-3 font-mono text-xs text-slate-600 dark:bg-slate-900/60 dark:text-slate-300"
|
||||
class="max-h-48 space-y-2 overflow-y-auto overscroll-contain rounded-2xl bg-slate-50/80 p-3 font-mono text-xs text-slate-600 dark:bg-slate-900/60 dark:text-slate-300"
|
||||
>
|
||||
<div
|
||||
v-for="(log, index) in download.logs"
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
leave-from-class="opacity-100 translate-y-0"
|
||||
leave-to-class="opacity-0 -translate-y-2"
|
||||
>
|
||||
<div v-show="isExpanded" class="max-h-96 overflow-y-auto px-3 pb-4">
|
||||
<div v-show="isExpanded" class="max-h-96 overflow-y-auto overscroll-contain px-3 pb-4">
|
||||
<div
|
||||
v-if="downloads.length === 0"
|
||||
class="flex flex-col items-center justify-center rounded-2xl border border-dashed border-slate-200/80 px-4 py-12 text-slate-500 dark:border-slate-800/80 dark:text-slate-400"
|
||||
|
||||
Reference in New Issue
Block a user