Files
ele-HeiXiu/shared/types/logging.ts
YoungestSongMo e4c9ae8fc6 feat: 三栏比例缩放 + SeedanceContent视频上传 + 本地存储基建 (0.0.22)
三栏布局
- ResizeObserver 等比例分配替代固定默认值恢复
- 修复拖拽+窗口调整竞态卡死(needsRecalcRef 延迟补算)
- containerRef.current 动态读取 DOM 替代闭包 el

Seedance2Content
- 从占位文本重构为内容编排控件(文本+图片/视频/音频上传)
- 根据 spec.image_files/video_files/audio_files 动态渲染上传区域
- 值 JSON 序列化 → 提交时转 ContentItem[](text/image_url/video_url/audio_url)

图片上传兼容视频文件
- buildAccept 根据 file_filter 区分 image/video 前缀
- createMediaBeforeUpload 动态放行 video/* MIME
- 公共模块 media-upload-utils.ts

本地存储基建
- sql.js (WASM SQLite) + safeStorage 加密持久化
- 8个IPC文件操作通道 + resolveSafe 路径穿越防护
- <userData>/heixiu-data/ 沙箱 + JWT用户隔离
- 7表DDL + 游标分页 + LRU媒体淘汰

其他
- 修复 errorMessageRef 渲染期写入警告
- 媒体预览回退直接URL(<img>无CORS限制)+ output_type类型补充
- CSP wasm-unsafe-eval + https: CDN媒体源
2026-06-18 19:22:28 +08:00

54 lines
1.7 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.
// ============================================================
// 日志模块 — 共享类型定义(主进程 + 渲染进程双端使用)
// ============================================================
/** 日志级别 */
export type LogLevel = 'DEBUG' | 'INFO' | 'WARN' | 'ERROR';
/** 日志分类 */
export type LogCategory =
| 'request' // HTTP 请求相关
| 'auth' // 登录 / Token / 权限
| 'updater' // 自动更新
| 'event' // 事件总线
| 'app' // 应用生命周期
| 'ui' // UI 层错误 / 警告
| 'ipc' // IPC 通信
| 'safe-storage' // 安全存储safeStorage 加密/解密)
| 'storage'; // 本地存储IndexedDB / sql.js / 文件缓存)
/**
* 结构化错误快照
* Error 对象不可 JSON 序列化,提取关键字段保存
*/
export interface LogErrorSnapshot {
/** 错误名称Error.name 或 constructor name */
name: string;
/** 错误消息 */
message: string;
/** 堆栈信息(可选,按需记录以节省空间) */
stack?: string;
/** 原始错误链cause的消息摘要 */
cause?: string;
}
/**
* 单条日志条目JSON Lines 中的一行)
*/
export interface LogEntry {
/** ISO 8601 时间戳(例如 "2026-06-04T10:30:00.123Z" */
timestamp: string;
/** 日志级别 */
level: LogLevel;
/** 日志分类 */
category: LogCategory;
/** 日志消息(简短描述) */
message: string;
/** 日志来源进程 */
processType: 'main' | 'renderer';
/** 附加上下文(需 JSON 可序列化) */
context?: Record<string, unknown>;
/** 错误快照(仅在 warn / error 级别时填充) */
error?: LogErrorSnapshot;
}