Merge branch 'Erotica' of gitee.com:xiyidaiwa/spark-store into Erotica

# Conflicts:
#	src/App.vue
This commit is contained in:
xiyidaiwa
2026-08-07 18:23:35 +08:00
5 changed files with 308 additions and 229 deletions
+26 -27
View File
@@ -1269,7 +1269,6 @@ ipcMain.handle("show-apm-install-dialog", async (event) => {
return { success: false, cancelled: true };
});
// eslint-disable-next-line @typescript-eslint/no-explicit-any
ipcMain.handle(
"uninstall-installed",
async (
@@ -1283,42 +1282,42 @@ ipcMain.handle(
}
const { pkgname, origin } = parsed;
const superUserCmd = await checkSuperUserCommand();
const execCommand = superUserCmd || SHELL_CALLER_PATH;
const execParams = superUserCmd ? [SHELL_CALLER_PATH] : [];
const superUserCmd = await checkSuperUserCommand();
const execCommand = superUserCmd || SHELL_CALLER_PATH;
const execParams = superUserCmd ? [SHELL_CALLER_PATH] : [];
if (origin === "apm") {
execParams.push("apm", "remove", "-y", pkgname);
} else {
execParams.push("aptss", "remove", "-y", pkgname);
}
if (origin === "apm") {
execParams.push("apm", "remove", "-y", pkgname);
} else {
execParams.push("aptss", "remove", "-y", pkgname);
}
const { code, stdout, stderr } = await runCommandCapture(
execCommand,
execParams,
);
const success = code === 0;
const { code, stdout, stderr } = await runCommandCapture(
execCommand,
execParams,
);
const success = code === 0;
if (success) {
logger.info(`卸载完成: ${pkgname}`);
} else {
logger.error(`卸载失败: ${pkgname} ${stderr || stdout}`);
}
if (success) {
logger.info(`卸载完成: ${pkgname}`);
} else {
logger.error(`卸载失败: ${pkgname} ${stderr || stdout}`);
}
return {
success,
message: success
? "卸载完成"
: stderr || stdout || `卸载失败,退出码 ${code}`,
};
});
return {
success,
message: success
? "卸载完成"
: stderr || stdout || `卸载失败,退出码 ${code}`,
};
},
);
interface LaunchAppPayload {
pkgname: string;
origin?: "spark" | "apm";
}
ipcMain.handle(
"launch-app",
async (
+15
View File
@@ -357,6 +357,16 @@ function saveWindowState(state: WindowState): void {
}
let saveBoundsTimer: NodeJS.Timeout | null = null;
function flushSaveBounds(): void {
if (saveBoundsTimer) {
clearTimeout(saveBoundsTimer);
saveBoundsTimer = null;
}
if (win && !win.isDestroyed()) {
const { width, height, x, y } = win.getBounds();
saveWindowState({ width, height, x, y, maximized: win.isMaximized() });
}
}
function scheduleSaveBounds(winInstance: BrowserWindow): void {
if (saveBoundsTimer) clearTimeout(saveBoundsTimer);
saveBoundsTimer = setTimeout(() => {
@@ -372,6 +382,11 @@ function scheduleSaveBounds(winInstance: BrowserWindow): void {
}, 400);
}
// 应用退出前立即持久化(防抖 400ms 可能在快速关闭时丢失最后一次状态)
app.on("before-quit", () => {
flushSaveBounds();
});
async function createWindow() {
const saved = loadWindowState();
// 恢复时:若上次窗口过大(>1600x900,通常为全屏/最大化),回退到默认尺寸并居中,