disable init clipboard sync by default

This commit is contained in:
rustdesk 2024-09-20 17:38:29 +08:00
parent b93d4ce3fc
commit 2e314bf032
2 changed files with 18 additions and 11 deletions

View File

@ -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,
];

View File

@ -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 {