mirror of
https://github.com/rustdesk/rustdesk.git
synced 2024-11-27 14:59:02 +08:00
fix: option OPTION_ONE_WAY_FILE_TRANSFER (#9387)
Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
parent
e20f5dd001
commit
e5ec6957fe
@ -132,7 +132,7 @@ impl ClipboardFile {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_stopping_allowed_from_peer(&self) -> bool {
|
pub fn is_beginning_message(&self) -> bool {
|
||||||
matches!(
|
matches!(
|
||||||
self,
|
self,
|
||||||
ClipboardFile::MonitorReady | ClipboardFile::FormatList { .. }
|
ClipboardFile::MonitorReady | ClipboardFile::FormatList { .. }
|
||||||
|
@ -1895,7 +1895,7 @@ impl<T: InvokeUiSession> Remote<T> {
|
|||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
let is_stopping_allowed = clip.is_stopping_allowed_from_peer();
|
let is_stopping_allowed = clip.is_beginning_message();
|
||||||
let file_transfer_enabled = self.handler.lc.read().unwrap().enable_file_copy_paste.v;
|
let file_transfer_enabled = self.handler.lc.read().unwrap().enable_file_copy_paste.v;
|
||||||
let stop = is_stopping_allowed && !file_transfer_enabled;
|
let stop = is_stopping_allowed && !file_transfer_enabled;
|
||||||
log::debug!(
|
log::debug!(
|
||||||
|
@ -440,7 +440,7 @@ impl<T: InvokeUiCM> IpcTaskRunner<T> {
|
|||||||
Data::ClipboardFile(_clip) => {
|
Data::ClipboardFile(_clip) => {
|
||||||
#[cfg(any(target_os = "windows", target_os="linux", target_os = "macos"))]
|
#[cfg(any(target_os = "windows", target_os="linux", target_os = "macos"))]
|
||||||
{
|
{
|
||||||
let is_stopping_allowed = _clip.is_stopping_allowed_from_peer();
|
let is_stopping_allowed = _clip.is_beginning_message();
|
||||||
let is_clipboard_enabled = ContextSend::is_enabled();
|
let is_clipboard_enabled = ContextSend::is_enabled();
|
||||||
let file_transfer_enabled = self.file_transfer_enabled;
|
let file_transfer_enabled = self.file_transfer_enabled;
|
||||||
let stop = !is_stopping_allowed && !(is_clipboard_enabled && file_transfer_enabled);
|
let stop = !is_stopping_allowed && !(is_clipboard_enabled && file_transfer_enabled);
|
||||||
@ -565,10 +565,15 @@ impl<T: InvokeUiCM> IpcTaskRunner<T> {
|
|||||||
log::debug!(
|
log::debug!(
|
||||||
"Process clipboard message from clip, stop: {}, is_stopping_allowed: {}, is_clipboard_enabled: {}, file_transfer_enabled: {}, file_transfer_enabled_peer: {}",
|
"Process clipboard message from clip, stop: {}, is_stopping_allowed: {}, is_clipboard_enabled: {}, file_transfer_enabled: {}, file_transfer_enabled_peer: {}",
|
||||||
stop, is_stopping_allowed, is_clipboard_enabled, file_transfer_enabled, file_transfer_enabled_peer);
|
stop, is_stopping_allowed, is_clipboard_enabled, file_transfer_enabled, file_transfer_enabled_peer);
|
||||||
if stop || crate::get_builtin_option(OPTION_ONE_WAY_FILE_TRANSFER) == "Y"{
|
if stop {
|
||||||
ContextSend::set_is_stopped();
|
ContextSend::set_is_stopped();
|
||||||
} else {
|
} else {
|
||||||
allow_err!(self.tx.send(Data::ClipboardFile(_clip)));
|
if _clip.is_beginning_message() && crate::get_builtin_option(OPTION_ONE_WAY_FILE_TRANSFER) == "Y" {
|
||||||
|
// If one way file transfer is enabled, don't send clipboard file to client
|
||||||
|
// Don't call `ContextSend::set_is_stopped()`, because it will stop bidirectional file copy&paste.
|
||||||
|
} else {
|
||||||
|
allow_err!(self.tx.send(Data::ClipboardFile(_clip)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user