mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-06-24 01:04:51 +03:00
Fix clipboard synchronization not fully disabled in View Only mode (#15224)
* fix: view-only clipboard sync Signed-off-by: Setani <little_stejan@hotmail.com> * fix: gate Android MultiClipboards handling with clipboard permissions Signed-off-by: Setani <little_stejan@hotmail.com> --------- Signed-off-by: Setani <little_stejan@hotmail.com>
This commit is contained in:
@@ -1426,7 +1426,8 @@ impl<T: InvokeUiSession> Remote<T> {
|
||||
self.handler.set_cursor_position(cp);
|
||||
}
|
||||
Some(message::Union::Clipboard(cb)) => {
|
||||
if !self.handler.lc.read().unwrap().disable_clipboard.v {
|
||||
let lc = self.handler.lc.read().unwrap();
|
||||
if !lc.disable_clipboard.v && !lc.view_only.v {
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
update_clipboard(vec![cb], ClipboardSide::Client);
|
||||
#[cfg(target_os = "ios")]
|
||||
@@ -1445,7 +1446,8 @@ impl<T: InvokeUiSession> Remote<T> {
|
||||
}
|
||||
}
|
||||
Some(message::Union::MultiClipboards(_mcb)) => {
|
||||
if !self.handler.lc.read().unwrap().disable_clipboard.v {
|
||||
let lc = self.handler.lc.read().unwrap();
|
||||
if !lc.disable_clipboard.v && !lc.view_only.v {
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
update_clipboard(_mcb.clipboards, ClipboardSide::Client);
|
||||
#[cfg(target_os = "ios")]
|
||||
|
||||
@@ -326,12 +326,14 @@ pub fn session_toggle_option(session_id: SessionID, value: String) {
|
||||
try_sync_peer_option(&session, &session_id, &value, None);
|
||||
}
|
||||
#[cfg(not(target_os = "ios"))]
|
||||
if sessions::get_session_by_session_id(&session_id).is_some() && value == "disable-clipboard" {
|
||||
if sessions::get_session_by_session_id(&session_id).is_some()
|
||||
&& (value == "disable-clipboard" || value == "view-only")
|
||||
{
|
||||
crate::flutter::update_text_clipboard_required();
|
||||
}
|
||||
#[cfg(feature = "unix-file-copy-paste")]
|
||||
if sessions::get_session_by_session_id(&session_id).is_some()
|
||||
&& value == config::keys::OPTION_ENABLE_FILE_COPY_PASTE
|
||||
&& (value == config::keys::OPTION_ENABLE_FILE_COPY_PASTE || value == "view-only")
|
||||
{
|
||||
crate::flutter::update_file_clipboard_required();
|
||||
}
|
||||
|
||||
@@ -2891,7 +2891,7 @@ impl Connection {
|
||||
self.update_auto_disconnect_timer();
|
||||
}
|
||||
Some(message::Union::Clipboard(cb)) => {
|
||||
if self.clipboard {
|
||||
if self.clipboard_enabled() {
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
update_clipboard(vec![cb], ClipboardSide::Host);
|
||||
// ios as the controlled side is actually not supported for now.
|
||||
@@ -2919,12 +2919,12 @@ impl Connection {
|
||||
}
|
||||
}
|
||||
Some(message::Union::MultiClipboards(_mcb)) => {
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
if self.clipboard {
|
||||
if self.clipboard_enabled() {
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
update_clipboard(_mcb.clipboards, ClipboardSide::Host);
|
||||
#[cfg(target_os = "android")]
|
||||
crate::clipboard::handle_msg_multi_clipboards(_mcb);
|
||||
}
|
||||
#[cfg(target_os = "android")]
|
||||
crate::clipboard::handle_msg_multi_clipboards(_mcb);
|
||||
}
|
||||
#[cfg(any(target_os = "windows", feature = "unix-file-copy-paste"))]
|
||||
Some(message::Union::Cliprdr(clip)) => {
|
||||
|
||||
@@ -175,13 +175,16 @@ impl SessionPermissionConfig {
|
||||
*self.server_clipboard_enabled.read().unwrap()
|
||||
&& *self.server_keyboard_enabled.read().unwrap()
|
||||
&& !self.lc.read().unwrap().disable_clipboard.v
|
||||
&& !self.lc.read().unwrap().view_only.v
|
||||
}
|
||||
|
||||
#[cfg(feature = "unix-file-copy-paste")]
|
||||
pub fn is_file_clipboard_required(&self) -> bool {
|
||||
let lc = self.lc.read().unwrap();
|
||||
*self.server_keyboard_enabled.read().unwrap()
|
||||
&& *self.server_file_transfer_enabled.read().unwrap()
|
||||
&& self.lc.read().unwrap().enable_file_copy_paste.v
|
||||
&& lc.enable_file_copy_paste.v
|
||||
&& !lc.view_only.v
|
||||
}
|
||||
}
|
||||
|
||||
@@ -411,13 +414,16 @@ impl<T: InvokeUiSession> Session<T> {
|
||||
*self.server_clipboard_enabled.read().unwrap()
|
||||
&& *self.server_keyboard_enabled.read().unwrap()
|
||||
&& !self.lc.read().unwrap().disable_clipboard.v
|
||||
&& !self.lc.read().unwrap().view_only.v
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "windows", feature = "unix-file-copy-paste"))]
|
||||
pub fn is_file_clipboard_required(&self) -> bool {
|
||||
let lc = self.lc.read().unwrap();
|
||||
*self.server_keyboard_enabled.read().unwrap()
|
||||
&& *self.server_file_transfer_enabled.read().unwrap()
|
||||
&& self.lc.read().unwrap().enable_file_copy_paste.v
|
||||
&& lc.enable_file_copy_paste.v
|
||||
&& !lc.view_only.v
|
||||
}
|
||||
|
||||
#[cfg(feature = "flutter")]
|
||||
|
||||
Reference in New Issue
Block a user