Files
ele-HeiXiu/shared/constants/ipc/storage.ts
YoungestSongMo 136a17c0bf feat: 任务列表右键菜单回调 + 主进程下载 + sharp 缩略图 + IPC 精简重构
- 任务右键菜单:实现打开输出目录(inputs/outputs/.cache 结构)、
    复制资源链接、重新编辑、再次生成、拉取结果、重新下载、收藏、删除记录
  - 主进程下载:通过 Electron net 模块绕过 CORS,支持 CDN 媒体文件下载
  - sharp 缩略图:替换 nativeImage,支持 4K/8K+ 大尺寸素材的流式处理
  - IPC 精简:40+ 冗余通道 → 15 个分组通道,移除未使用的 preload 桥接方法
  - 任务存储:新增收藏字段、schema 迁移、task-store 持久化
  - 清理废弃模块:canvas-ipc / updater / request / pricing

refactor: IPC/Preload/Services 模块化拆分 — 单一职责 + 向后兼容

  主要变更:
  - shared/constants/ipc-channels.ts → ipc/ 模块 (base/storage/canvas/updater)
  - electron/preload.ts → preload/ 模块 (base/safe-storage/file-storage/canvas)
  - electron/main/ipc/canvas-ipc.ts → canvas/ 模块 (types/walk/sidecar/mime/thumbnail)
  - electron/main/ipc/storage-ipc.ts → 提取 utils/ (path/download/thumbnail)
  - electron/main/updater.ts → updater/ 模块 (provider/platform-updaters)
  - src/services/request.ts → request/ 模块 (token/interceptors/methods)
  - src/shared/utils/pricing.ts → pricing/ 模块 (types/helpers/format/calculate/fields)
  - src/modules/home/center/views/ModelInputForm.tsx → 提取 utils + DependentFormItem

  架构优化:
  - 所有拆分均保持向后兼容(旧导入路径仍可用)
  - TypeScript 编译通过 ✓
  - 每个模块单一职责,平均 ~130 行
2026-07-03 11:13:36 +08:00

37 lines
1.7 KiB
TypeScript
Raw Permalink 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 BIDIRECTIONAL_STORAGE = {
/** safeStorage 加密(明文 → Base64 密文) */
SAFESTORAGE_ENCRYPT: 'safe-storage:encrypt',
/** safeStorage 解密Base64 密文 → 明文) */
SAFESTORAGE_DECRYPT: 'safe-storage:decrypt',
/** 文件写入Blob Buffer → 磁盘) */
FILE_WRITE: 'storage:file-write',
/** 文件读取(磁盘 → Base64 */
FILE_READ: 'storage:file-read',
/** 文件删除 */
FILE_DELETE: 'storage:file-delete',
/** 创建目录(递归) */
MAKE_DIR: 'storage:make-dir',
/** 在文件管理器中显示文件 */
SHOW_ITEM_IN_FOLDER: 'storage:show-item-in-folder',
/** 获取应用数据目录路径 */
GET_DATA_DIR: 'storage:get-data-dir',
/** 获取文件大小 */
FILE_SIZE: 'storage:file-size',
/** 文件/目录是否存在 */
FILE_EXISTS: 'storage:file-exists',
/** 绝对路径文件写入(绕过 heixiu-data 沙箱,用于用户自定义输出目录) */
FILE_WRITE_ABSOLUTE: 'storage:file-write-absolute',
/** 绝对路径目录创建(绕过 heixiu-data 沙箱) */
MAKE_DIR_ABSOLUTE: 'storage:make-dir-absolute',
/** 主进程下载文件到绝对路径(绕过浏览器 CORS 限制) */
DOWNLOAD_TO_PATH: 'storage:download-to-path',
/** 获取系统下载目录路径 */
GET_DOWNLOADS_PATH: 'storage:get-downloads-path',
/** 生成图片缩略图(读取原图 → 缩放 → 写入目标路径) */
GENERATE_THUMBNAIL: 'storage:generate-thumbnail',
} as const;