Skip to content

An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.

disable init clipboard sync by default

rustdesk2e314bf03293
diff --git a/libs/hbb_common/src/config.rs b/libs/hbb_common/src/config.rs
index 0e91ecf42..f0f7ec731 100644
--- a/libs/hbb_common/src/config.rs
+++ b/libs/hbb_common/src/config.rs
@@ -296,6 +296,8 @@ pub struct PeerConfig {
pub keyboard_mode: String,
#[serde(flatten)]
pub view_only: ViewOnly,
+ #[serde(flatten)]
+ pub sync_init_clipboard: SyncInitClipboard,
// Mouse wheel or touchpad scroll mode
#[serde(
default = "PeerConfig::default_reverse_mouse_wheel",
@@ -373,6 +375,7 @@ impl Default for PeerConfig {
ui_flutter: Default::default(),
info: Default::default(),
transfer: Default::default(),
+ sync_init_clipboard: Default::default(),
}
}
}
@@ -1462,6 +1465,13 @@ serde_field_bool!(
"ViewOnly::default_view_only"
);
+serde_field_bool!(
+ SyncInitClipboard,
+ "sync-init-clipboard",
+ default_sync_init_clipboard,
+ "SyncInitClipboard::default_sync_init_clipboard"
+);
+
#[derive(Debug, Default, Serialize, Deserialize, Clone)]
pub struct LocalConfig {
#[serde(default, deserialize_with = "deserialize_string")]
@@ -2156,6 +2166,7 @@ pub mod keys {
pub const OPTION_CUSTOM_IMAGE_QUALITY: &str = "custom_image_quality";
pub const OPTION_CUSTOM_FPS: &str = "custom-fps";
pub const OPTION_CODEC_PREFERENCE: &str = "codec-preference";
+ pub const OPTION_SYNC_INIT_CLIPBOARD: &str = "sync-init-clipboard";
pub const OPTION_THEME: &str = "theme";
pub const OPTION_LANGUAGE: &str = "lang";
pub const OPTION_REMOTE_MENUBAR_DRAG_LEFT: &str = "remote-menubar-drag-left";
@@ -2219,7 +2230,6 @@ pub mod keys {
pub const OPTION_DEFAULT_CONNECT_PASSWORD: &str = "default-connect-password";
pub const OPTION_HIDE_TRAY: &str = "hide-tray";
pub const OPTION_ONE_WAY_CLIPBOARD_REDIRECTION: &str = "one-way-clipboard-redirection";
- pub const OPTION_ENABLE_CLIPBOARD_INIT_SYNC: &str = "enable-clipboard-init-sync";
pub const OPTION_ALLOW_LOGON_SCREEN_PASSWORD: &str = "allow-logon-screen-password";
pub const OPTION_ONE_WAY_FILE_TRANSFER: &str = "one-way-file-transfer";
@@ -2280,6 +2290,7 @@ pub mod keys {
OPTION_CUSTOM_IMAGE_QUALITY,
OPTION_CUSTOM_FPS,
OPTION_CODEC_PREFERENCE,
+ OPTION_SYNC_INIT_CLIPBOARD,
];
// DEFAULT_LOCAL_SETTINGS, OVERWRITE_LOCAL_SETTINGS
pub const KEYS_LOCAL_SETTINGS: &[&str] = &[
@@ -2367,7 +2378,6 @@ pub mod keys {
OPTION_DEFAULT_CONNECT_PASSWORD,
OPTION_HIDE_TRAY,
OPTION_ONE_WAY_CLIPBOARD_REDIRECTION,
- OPTION_ENABLE_CLIPBOARD_INIT_SYNC,
OPTION_ALLOW_LOGON_SCREEN_PASSWORD,
OPTION_ONE_WAY_FILE_TRANSFER,
];
diff --git a/src/client/io_loop.rs b/src/client/io_loop.rs
index c23c967b5..84d8a897c 100644
--- a/src/client/io_loop.rs
+++ b/src/client/io_loop.rs
@@ -1196,15 +1196,12 @@ impl<T: InvokeUiSession> Remote<T> {
}
#[cfg(not(any(target_os = "android", target_os = "ios")))]
- if let Some(msg_out) = crate::clipboard::get_current_clipboard_msg(
- &peer_version,
- &peer_platform,
- crate::clipboard::ClipboardSide::Client,
- ) {
- if crate::get_builtin_option(
- config::keys::OPTION_ENABLE_CLIPBOARD_INIT_SYNC,
- ) != "N"
- {
+ if self.handler.lc.read().unwrap().sync_init_clipboard.v {
+ if let Some(msg_out) = crate::clipboard::get_current_clipboard_msg(
+ &peer_version,
+ &peer_platform,
+ crate::clipboard::ClipboardSide::Client,
+ ) {
let sender = self.sender.clone();
let permission_config = self.handler.get_permission_config();
tokio::spawn(async move {