Files
ele-HeiXiu/shared/constants/ipc-channels.ts
YoungestSongMo 6204c14b88 feat: 重构更新流程 — 无更新不抛异常、用户决定下载、更新详情展示(md文件中的)
【核心重构】
  - getLatestVersion() 不再 throw Error,无更新时返回 { version: APP_VERSION }
  - checkForUpdates() 先自行预检 → 无更新直发 IPC,有更新才交 electron-updater
  - 移除 NO_UPDATE_MESSAGE 常量及所有字符串匹配拦截代码
  - HeiXiuProvider 增加 500ms TTL 缓存,避免预检+electron-updater 重复请求 API

  【用户体验】
  - 检查到新版本后不再自动下载,展示更新内容供用户决定
  - 新增"下载更新"按钮(与"安装更新"分离为两步操作)
  - 设置页新增"查看详情"弹窗,Markdown 格式化渲染更新日志
  - available / downloading / downloaded 三个状态 UI 独立展示

  【Bug 修复】
  - 测试服务器版本排序:字符串序 → 语义版本序(_version_key),0.0.10 正确 > 0.0.9
  - 版本比较:!= → <(_version_key),防止高版本误判为有更新
  - get_best_release fallback 同样改为语义版本排序
  - Windows cmd set 命令尾部空格 → Invalid URL(.trim() 修复)
  - electron-updater 'error' 事件中拦截 NO_UPDATE_MESSAGE → UPDATE_NOT_AVAILABLE

  【文档更新】
  - CHANGELOG.md、PROJECT.md、UpdateA.md 同步更新架构图和流程说明
2026-06-04 18:31:52 +08:00

50 lines
1.6 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// ============================================================
// IPC 通道名称常量 —— 避免魔法字符串
// ============================================================
/** 主进程 → 渲染进程 */
export const MAIN_TO_RENDERER = {
/** 主进程消息推送 */
MAIN_PROCESS_MESSAGE: 'main-process-message',
/** 主题变更通知 */
THEME_CHANGED: 'theme-changed',
/** 窗口聚焦通知 */
WINDOW_FOCUSED: 'window-focused',
/** 窗口失焦通知 */
WINDOW_BLURRED: 'window-blurred',
} as const;
/** 渲染进程 → 主进程 */
export const RENDERER_TO_MAIN = {
/** 打开子窗口 */
OPEN_SUB_WINDOW: 'open-sub-window',
/** 关闭子窗口 */
CLOSE_SUB_WINDOW: 'close-sub-window',
/** 设置窗口标题 */
SET_WINDOW_TITLE: 'set-window-title',
/** 获取平台信息 */
GET_PLATFORM_INFO: 'get-platform-info',
/** 最小化窗口 */
MINIMIZE_WINDOW: 'minimize-window',
/** 最大化/还原窗口 */
TOGGLE_MAXIMIZE: 'toggle-maximize',
/** 关闭窗口 */
CLOSE_WINDOW: 'close-window',
/** 渲染进程日志上报 */
LOG_MESSAGE: 'log-message',
} as const;
/** 双向通信通道 */
export const BIDIRECTIONAL = {
/** 读取应用配置 */
READ_CONFIG: 'read-config',
/** 写入应用配置 */
WRITE_CONFIG: 'write-config',
/** 文件对话框 */
FILE_DIALOG: 'file-dialog',
/** safeStorage 加密(明文 → Base64 密文) */
SAFESTORAGE_ENCRYPT: 'safe-storage:encrypt',
/** safeStorage 解密Base64 密文 → 明文) */
SAFESTORAGE_DECRYPT: 'safe-storage:decrypt',
} as const;