mirror of
https://github.com/jamiepine/voicebox.git
synced 2026-10-03 00:55:14 -07:00
fix: enable microphone access on Linux via WebKitGTK
WebKitGTK denies getUserMedia by default. This adds webkit2gtk as a Linux dependency and configures the webview to enable media streams and auto-grant UserMediaPermissionRequest for microphone access. Co-Authored-By: Claude Opus 4.6 <[email protected]>
This commit is contained in:
Generated
+2
-1
@@ -5041,7 +5041,7 @@ checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "voicebox"
|
name = "voicebox"
|
||||||
version = "0.1.12"
|
version = "0.1.13"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.22.1",
|
"base64 0.22.1",
|
||||||
"core-foundation-sys",
|
"core-foundation-sys",
|
||||||
@@ -5064,6 +5064,7 @@ dependencies = [
|
|||||||
"tauri-plugin-updater",
|
"tauri-plugin-updater",
|
||||||
"tokio",
|
"tokio",
|
||||||
"wasapi",
|
"wasapi",
|
||||||
|
"webkit2gtk",
|
||||||
"windows 0.62.2",
|
"windows 0.62.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,9 @@ core-foundation-sys = "0.8"
|
|||||||
wasapi = "0.22"
|
wasapi = "0.22"
|
||||||
windows = { version = "0.62", features = ["Win32_Foundation", "Win32_UI_WindowsAndMessaging", "Win32_System_Com"] }
|
windows = { version = "0.62", features = ["Win32_Foundation", "Win32_UI_WindowsAndMessaging", "Win32_System_Com"] }
|
||||||
|
|
||||||
|
[target.'cfg(target_os = "linux")'.dependencies]
|
||||||
|
webkit2gtk = "2.0"
|
||||||
|
|
||||||
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
|
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
|
||||||
tauri-plugin-updater = "2.0"
|
tauri-plugin-updater = "2.0"
|
||||||
tauri-plugin-process = "2.0"
|
tauri-plugin-process = "2.0"
|
||||||
|
|||||||
@@ -635,6 +635,33 @@ pub fn run() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enable microphone access on Linux (WebKitGTK denies getUserMedia by default)
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
|
{
|
||||||
|
use tauri::Manager;
|
||||||
|
if let Some(window) = app.get_webview_window("main") {
|
||||||
|
let _ = window.with_webview(|webview| {
|
||||||
|
use webkit2gtk::{WebViewExt, SettingsExt, PermissionRequestExt};
|
||||||
|
use webkit2gtk::glib::ObjectExt;
|
||||||
|
let wk_webview = webview.inner();
|
||||||
|
|
||||||
|
// Enable media stream support in WebKitGTK settings
|
||||||
|
if let Some(settings) = WebViewExt::settings(&wk_webview) {
|
||||||
|
settings.set_enable_media_stream(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Auto-grant UserMediaPermissionRequest (microphone access)
|
||||||
|
wk_webview.connect_permission_request(move |_, request: &webkit2gtk::PermissionRequest| {
|
||||||
|
if request.is::<webkit2gtk::UserMediaPermissionRequest>() {
|
||||||
|
request.allow();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
false
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
})
|
})
|
||||||
.invoke_handler(tauri::generate_handler![
|
.invoke_handler(tauri::generate_handler![
|
||||||
|
|||||||
Reference in New Issue
Block a user