refactor: 多维度代码审查修复(安全/清理/类型)

- src/App.vue:
  - fetchAppFromStore 的 category/pkgname 路径参数 encodeURIComponent 编码(防路径穿越)
  - img_urls JSON.parse 增加 try/catch,解析失败回退空数组(两处)
  - onUnmounted 统一移除 hashchange/resize/keydown 及全部 IPC 监听,修复内存泄漏
  - 提取 createFallbackApp 消除 openDetail 重复回退构造
  - 收集并统一停止等待 loading 的一次性 watcher,闭环生命周期清理
- src/global/typedefinition.ts: 移除 CategoryInfo/HomeLink 宽泛索引签名,
  CategoryInfo 改用显式 extra 字段
- electron/main/backend/install-manager.ts: 清理冗余 eslint-disable 并修正缩进
  (remove-installed/check-installed 已通过 parseAppPayload 完成 pkgname 校验,无需改动)
This commit is contained in:
xiyidaiwa
2026-08-06 22:06:43 +08:00
parent 0d580c4d47
commit ae584730c4
3 changed files with 249 additions and 192 deletions
+2 -2
View File
@@ -225,7 +225,8 @@ export interface CategoryInfo {
zh: string;
origins?: string[];
origin?: "spark" | "apm";
[k: string]: unknown;
// 保留扩展点,避免使用宽泛的索引签名削弱类型安全
extra?: Record<string, unknown>;
}
export interface HomeLink {
@@ -237,7 +238,6 @@ export interface HomeLink {
imgUrl?: string;
type?: string;
origin?: "spark" | "apm";
[k: string]: unknown;
}
export interface SidebarEntry {