Skip to content

fix(history): 音频播放改用 Blob URL + 导出走 Tauri dialog save - #841

Merged
H-Chris233 merged 7 commits into
Open-Less:betafrom
aeoform:fix/audio-playback-blob-url-and-export-dialog
Jul 20, 2026
Merged

fix(history): 音频播放改用 Blob URL + 导出走 Tauri dialog save#841
H-Chris233 merged 7 commits into
Open-Less:betafrom
aeoform:fix/audio-playback-blob-url-and-export-dialog

Conversation

@aeoform

@aeoform aeoform commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

User description

修复内容

  1. 音频播放修复: WebKitGTK 下 <audio> 无法解码 data: URL,改用 Blob URL(base64 → Uint8Array → Blob → createObjectURL)
  2. 导出走 Tauri dialog: 替换浏览器 <a download> 为 Tauri dialog save + 后端 export_audio_recording 命令,让用户可以选择保存路径
  3. CSP 更新: 新增 media-src blob: 以支持 WebKitGTK 的 Blob URL 音频播放
  4. i18n: 新增 audioDecodeFailed 翻译键(中/英/日/韩/繁)
  5. IPC 对齐: readAudioRecording 返回类型从 Uint8Array 改为 string(data URL)

改动文件

文件 变更
commands/history.rs 返回 data URL + 新增 export_audio_recording
lib.rs 注册 export_audio_recording
tauri.conf.json CSP media-src blob:
ipc/history.ts 返回类型对齐
History.tsx Blob URL 播放 + Tauri dialog 导出
i18n/* (×5) audioDecodeFailed 翻译

PR Type

Bug fix, Enhancement


Description

  • Switch audio playback to Blob URL for WebKitGTK compatibility

  • Add export via Tauri dialog with cross-platform support (desktop & mobile)

  • Update CSP, i18n, IPC types, and mobile runtime for new features


File Walkthrough

Relevant files
Bug fix
2 files
history.rs
Add export command and change read return type                     
+147/-10
History.tsx
Rewrite playback and export with Blob URL and dialog         
+87/-29 
Configuration
3 files
lib.rs
Register export_audio_recording command                                   
+2/-0     
mobile_runtime.rs
Register tauri-plugin-fs for mobile                                           
+6/-2     
tauri.conf.json
Add media-src blob: to CSP                                                             
+1/-0     
I18n
5 files
en.ts
Add exportError and audioDecodeFailed keys                             
+2/-0     
ja.ts
Add Japanese translations for new keys                                     
+2/-0     
ko.ts
Add Korean translations for new keys                                         
+2/-0     
zh-CN.ts
Add Simplified Chinese translations                                           
+2/-0     
zh-TW.ts
Add Traditional Chinese translations                                         
+2/-0     
Enhancement
1 files
history.ts
Change readAudioRecording return type to string                   
+6/-11   
Dependencies
1 files
Cargo.toml
Add tauri-plugin-fs for mobile targets                                     
+3/-0     

@github-actions

github-actions Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

PR Reviewer Guide 🔍

(Review updated until commit c9141b9)

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Possible compilation error on mobile

In copy_recording_to_mobile_url, app.fs().open(destination.clone(), options) passes a FilePath::Url (e.g., content:// on Android) directly where open expects impl AsRef<Path>. FilePath does not implement AsRef<Path>, which will cause a compilation error on Android/iOS targets. This blocks the mobile export feature from building. The function should convert the URL to a path (e.g., using to_file_path() on the URL) or handle the URL case differently for Android content URIs.

let mut destination_file = match app.fs().open(destination.clone(), options) {

@github-actions

Copy link
Copy Markdown
Contributor

Persistent review updated to latest commit 46acaa3

@github-actions

Copy link
Copy Markdown
Contributor

Persistent review updated to latest commit 96ba204

@github-actions

Copy link
Copy Markdown
Contributor

Persistent review updated to latest commit 5d6bab0

@github-actions

Copy link
Copy Markdown
Contributor

Persistent review updated to latest commit a8ec7db

@github-actions

Copy link
Copy Markdown
Contributor

Persistent review updated to latest commit 4b5a2f3

@github-actions

Copy link
Copy Markdown
Contributor

Persistent review updated to latest commit c9141b9

@H-Chris233 H-Chris233 self-assigned this Jul 20, 2026
@H-Chris233
H-Chris233 merged commit a1fe387 into Open-Less:beta Jul 20, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants