From f6aca4ca8e3eb7661f6665540494278fba7ce87a Mon Sep 17 00:00:00 2001 From: 21pages Date: Thu, 1 Aug 2024 18:17:02 +0800 Subject: [PATCH] fix click cm audio permission button before auth (#8917) 1. When not authenticated, clicking the audio permission button on the cm will send audio data 2. Keep the cursor position code unchanged, because `show_remote_cursor` is false before auth, so subscription will not happen. 3. Keep the clipboard code unchanged, because the keyboard permission will also be determined in `try_sub_services`. If the clipboard permission is clicked before auth and the keyboard permission is clicked after auth, the clipboard service will not be subscribed. Signed-off-by: 21pages --- src/server/connection.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/server/connection.rs b/src/server/connection.rs index 5ea1e923a..b1af36e47 100644 --- a/src/server/connection.rs +++ b/src/server/connection.rs @@ -502,10 +502,12 @@ impl Connection { } else if &name == "audio" { conn.audio = enabled; conn.send_permission(Permission::Audio, enabled).await; - if let Some(s) = conn.server.upgrade() { - s.write().unwrap().subscribe( - super::audio_service::NAME, - conn.inner.clone(), conn.audio_enabled()); + if conn.authorized { + if let Some(s) = conn.server.upgrade() { + s.write().unwrap().subscribe( + super::audio_service::NAME, + conn.inner.clone(), conn.audio_enabled()); + } } } else if &name == "file" { conn.file = enabled;