From 3282e1e5d9f1861cd0268e16ab88faae8b6d8f6b Mon Sep 17 00:00:00 2001 From: H-Chris233 Date: Thu, 30 Apr 2026 20:42:24 +0800 Subject: [PATCH] Avoid false inserted history without macOS accessibility Before posting Cmd+V on macOS, check the current Accessibility trust state. If permission has been revoked, keep the transcript on the clipboard and reuse the existing CopiedFallback path instead of recording a successful insertion. Constraint: Keep issue #62 fix minimal and avoid adding unreliable target-control paste verification Rejected: AX focused-value readback with timeout | broader and brittle across apps/web editors Confidence: medium Scope-risk: narrow Tested: cargo check --manifest-path openless-all/app/src-tauri/Cargo.toml Tested: git diff --check Not-tested: Live macOS Accessibility revoke flow on this host --- openless-all/app/src-tauri/src/insertion.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/openless-all/app/src-tauri/src/insertion.rs b/openless-all/app/src-tauri/src/insertion.rs index af4a925c..2f3b88a2 100644 --- a/openless-all/app/src-tauri/src/insertion.rs +++ b/openless-all/app/src-tauri/src/insertion.rs @@ -58,6 +58,12 @@ fn copy_to_clipboard(text: &str) -> bool { #[cfg(target_os = "macos")] fn simulate_paste() -> Result<(), String> { + if !matches!( + crate::permissions::check_accessibility(), + crate::permissions::PermissionStatus::Granted + ) { + return Err("accessibility permission is not granted".into()); + } macos::post_cmd_v() }