fix #14740: serve playback only to the main window

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
hauke
2026-11-10 13:52:26 +01:00
co-authored by Claude Opus 5.5
parent a74cfa5864
commit 8c47388eee
14 changed files with 624 additions and 124 deletions
+18 -2
View File
@@ -1,6 +1,7 @@
mod backend;
mod commands;
mod detection;
mod playback;
mod processing;
mod state;
mod tray;
@@ -43,6 +44,21 @@ pub fn run() {
.open_js_links_on_click(false)
.build(),
)
// A call's mix for the player: only for the main window, whatever
// other webviews (the remote backend login) ask for.
.register_asynchronous_uri_scheme_protocol(playback::SCHEME, |ctx, request, responder| {
let webview = ctx.webview_label().to_string();
let dir = ctx
.app_handle()
.try_state::<AppState>()
.map(|state| state.playback_dir().to_path_buf());
tauri::async_runtime::spawn_blocking(move || {
responder.respond(match dir {
Some(dir) => playback::respond(&webview, &request, &dir),
None => playback::unavailable(),
})
});
})
.setup(|app| {
// Release builds log to a file in the app log directory (on
// Windows %LOCALAPPDATA%\eu.euvino.callrecorder\logs), debug
@@ -72,8 +88,7 @@ pub fn run() {
let data_dir = app.path().app_data_dir()?;
let config_dir = app.path().app_config_dir()?;
// The asset protocol may read this directory, and only this one
// (`app.security.assetProtocol.scope` in tauri.conf.json).
// Served to the main window only, by the `playback` scheme.
let playback_dir = app.path().app_cache_dir()?.join("playback");
std::fs::create_dir_all(&data_dir)?;
let store = Store::open(&data_dir.join("calls.sqlite"))?;
@@ -161,6 +176,7 @@ pub fn run() {
commands::unmerge_speaker,
commands::rename_call,
commands::prepare_playback,
commands::release_playback,
backend::backend_server,
backend::backend_status,
backend::backend_login,