mirror of
https://github.com/jamiepine/voicebox.git
synced 2026-10-03 09:05:17 -07:00
fix: scope DMABUF workaround to Linux+NVIDIA, add origin validation
Address CodeRabbit review feedback: - Makefile: only set WEBKIT_DISABLE_DMABUF_RENDERER=1 when running on Linux with an NVIDIA GPU detected via lspci - main.rs: validate webview origin before auto-granting microphone permission — only allow for trusted local origins (tauri://, localhost, 127.0.0.1) Co-Authored-By: Claude Opus 4.6 <[email protected]>
This commit is contained in:
@@ -79,7 +79,11 @@ dev: ## Start backend + desktop app (parallel)
|
|||||||
@echo -e "$(YELLOW)Note: If Tauri fails, run 'make build-server' first or use separate terminals$(NC)"
|
@echo -e "$(YELLOW)Note: If Tauri fails, run 'make build-server' first or use separate terminals$(NC)"
|
||||||
@trap 'kill 0' EXIT; \
|
@trap 'kill 0' EXIT; \
|
||||||
$(MAKE) dev-backend & \
|
$(MAKE) dev-backend & \
|
||||||
sleep 2 && WEBKIT_DISABLE_DMABUF_RENDERER=1 $(MAKE) dev-frontend & \
|
sleep 2 && if [ "$$(uname)" = "Linux" ] && lspci 2>/dev/null | grep -qi nvidia; then \
|
||||||
|
WEBKIT_DISABLE_DMABUF_RENDERER=1 $(MAKE) dev-frontend; \
|
||||||
|
else \
|
||||||
|
$(MAKE) dev-frontend; \
|
||||||
|
fi & \
|
||||||
wait
|
wait
|
||||||
|
|
||||||
dev-backend: ## Start FastAPI backend server
|
dev-backend: ## Start FastAPI backend server
|
||||||
|
|||||||
@@ -651,11 +651,21 @@ pub fn run() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Auto-grant UserMediaPermissionRequest (microphone access)
|
// Auto-grant UserMediaPermissionRequest (microphone access)
|
||||||
wk_webview.connect_permission_request(move |_, request: &webkit2gtk::PermissionRequest| {
|
// Only for trusted local origins (Tauri dev server or custom protocol)
|
||||||
|
wk_webview.connect_permission_request(move |webview, request: &webkit2gtk::PermissionRequest| {
|
||||||
if request.is::<webkit2gtk::UserMediaPermissionRequest>() {
|
if request.is::<webkit2gtk::UserMediaPermissionRequest>() {
|
||||||
|
let uri = WebViewExt::uri(webview).unwrap_or_default();
|
||||||
|
let is_trusted = uri.starts_with("tauri://")
|
||||||
|
|| uri.starts_with("https://tauri.localhost")
|
||||||
|
|| uri.starts_with("http://localhost")
|
||||||
|
|| uri.starts_with("http://127.0.0.1");
|
||||||
|
if is_trusted {
|
||||||
request.allow();
|
request.allow();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
request.deny();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
false
|
false
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user