[🚧 Fix] <PLS & FS> Improve PLS download logic & UX

1. [+] 增加了 PLS 下载操作的取消功能
2. [/] 修复了 FS IPC 中 `downloadFile` 时, 过早地从 downloadTasks 中删除任务的逻辑错误。
3. [↑] 改进了 PLS IPC 中 `handlePLSDownload` 获取版本信息时的逻辑, 现在该函数会从全局 API 信息中逐个尝试 API 域名。减少了极端网络环境下, 版本信息获取失败的可能性。
4. [/] 修复了下载失败后, 下载按钮依然保持灰显的问题。
5. [+] 为 PLS 下载增加了进度条显示。
6. [/] 优化了 `plsConnectionManager` 中一些不必要的 IPC 状态同步 (有些时候还会导致逻辑错误)。
This commit is contained in:
Minoricew
2025-06-13 11:49:22 +08:00
parent a9d3772b51
commit ca5d94ebd8
10 changed files with 444 additions and 84 deletions

View File

@@ -1,5 +1,5 @@
type DownloadTaskID = string;
type DownloadTaskStatus = "waiting" | "progressing" | "done" | "failed" | "cancelled";
type DownloadTaskStatus = "waiting" | "progressing" | "done" | "failed" | "cancelled" | "struggling";
interface DownloadTask {
id: DownloadTaskID;

View File

@@ -24,7 +24,7 @@ interface GlobalHugoAuraInfo {
}
interface GlobalHugoAuraApiInfo {
baseUrl: string;
domains: string[];
plsUpdate: string;
auraUpdate: string;
}

View File

@@ -1,15 +1,28 @@
import { RendererProcessOnlyVal } from "../global";
type PLSStatusDesc =
| "dead"
| "running"
| "notReady"
| "downloading"
| "notInstalled";
interface PLSStatus {
installed: boolean;
detached: boolean;
connected: boolean;
launched: boolean;
status: string;
status: PLSStatusDesc;
version: string;
authToken: string;
}
type PLSLifecycleType = "isDetached" | "isSvcInstalled" | "isSvcStart";
type PLSLifecycleControlType = "instSvc" | "rmSvc" | "startSvc" | "stopSvc" | "rmBin" | "dlBin";
type PLSLifecycleControlType =
| "instSvc"
| "rmSvc"
| "startSvc"
| "stopSvc"
| "rmBin"
| "dlBin";