From a1fe38730d0424d7bd051fe2962b70872edf568c Mon Sep 17 00:00:00 2001 From: aeoform <128159516+aeoform@users.noreply.github.com> Date: Mon, 20 Jul 2026 15:51:41 +0800 Subject: [PATCH] =?UTF-8?q?fix(history):=20=E9=9F=B3=E9=A2=91=E6=92=AD?= =?UTF-8?q?=E6=94=BE=E6=94=B9=E7=94=A8=20Blob=20URL=20+=20=E5=AF=BC?= =?UTF-8?q?=E5=87=BA=E8=B5=B0=20Tauri=20dialog=20save=20(#841)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(history): 音频播放改用 Blob URL + 导出走 Tauri dialog save * fix(history): 给 export_audio_recording 加最小目标路径校验 * fix(history): export 对话框移到后端,消除 IPC 路径注入风险 * fix(history): 将阻塞 dialog 调用移入 spawn_blocking 避免阻塞异步线程池 * fix(history): support mobile export destinations and blob cleanup * fix(history): use mobile fs handles for recording export * fix(build): sync mobile fs dependency lockfile --------- Co-authored-by: Chris233 --- openless-all/app/src-tauri/Cargo.lock | 1 + openless-all/app/src-tauri/Cargo.toml | 3 + .../app/src-tauri/src/commands/history.rs | 157 ++++++++++++++++-- openless-all/app/src-tauri/src/lib.rs | 2 + .../app/src-tauri/src/mobile_runtime.rs | 8 +- openless-all/app/src-tauri/tauri.conf.json | 1 + openless-all/app/src/i18n/en.ts | 2 + openless-all/app/src/i18n/ja.ts | 2 + openless-all/app/src/i18n/ko.ts | 2 + openless-all/app/src/i18n/zh-CN.ts | 2 + openless-all/app/src/i18n/zh-TW.ts | 2 + openless-all/app/src/lib/ipc/history.ts | 17 +- openless-all/app/src/pages/History.tsx | 116 +++++++++---- 13 files changed, 263 insertions(+), 52 deletions(-) diff --git a/openless-all/app/src-tauri/Cargo.lock b/openless-all/app/src-tauri/Cargo.lock index b2b0a751..779ccff0 100644 --- a/openless-all/app/src-tauri/Cargo.lock +++ b/openless-all/app/src-tauri/Cargo.lock @@ -3965,6 +3965,7 @@ dependencies = [ "tauri-nspanel", "tauri-plugin-autostart", "tauri-plugin-dialog", + "tauri-plugin-fs", "tauri-plugin-shell", "tauri-plugin-single-instance", "tauri-plugin-updater", diff --git a/openless-all/app/src-tauri/Cargo.toml b/openless-all/app/src-tauri/Cargo.toml index 62ee2c64..760cfc39 100644 --- a/openless-all/app/src-tauri/Cargo.toml +++ b/openless-all/app/src-tauri/Cargo.toml @@ -59,6 +59,9 @@ ferrous-opencc = "0.4" # Audio capture — shared across desktop and mobile. cpal = "0.15" +[target.'cfg(any(target_os = "android", target_os = "ios"))'.dependencies] +tauri-plugin-fs = "2.5.1" + # Desktop-only plugins, hotkey/insertion helpers, and tray-icon (not built for mobile). [target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies] reqwest = { version = "0.12", default-features = false, features = ["native-tls"] } diff --git a/openless-all/app/src-tauri/src/commands/history.rs b/openless-all/app/src-tauri/src/commands/history.rs index 642d4cf2..d48aa2e6 100644 --- a/openless-all/app/src-tauri/src/commands/history.rs +++ b/openless-all/app/src-tauri/src/commands/history.rs @@ -1,4 +1,5 @@ use super::*; +use tauri_plugin_dialog::{DialogExt, FilePath}; #[tauri::command] pub fn list_history(coord: CoordinatorState<'_>) -> Result, String> { @@ -37,28 +38,164 @@ pub fn get_activity_stats(coord: CoordinatorState<'_>) -> Vec { /// session_id 在仓库内由 `Uuid::new_v4()` 生成 (`dictation.rs:1531`),前端只会回传 /// 自己列出的合法 id,但 IPC = boundary,按 boundary 规则严格校验。 /// -/// async fs:单条 5 分钟 wav 约 9.6MB,同步 `std::fs::read` 会阻塞 Tauri IPC 主循环。 -/// 改 `tokio::fs::read` 后让出线程给其它 IPC。 +/// 读取录音文件的 data URL(base64),前端 `