Merge pull request #4795 from dignow/refact/win_cliprd_wait_timeout

Refact/win cliprd wait timeout
This commit is contained in:
RustDesk
2023-06-29 22:50:45 +08:00
committed by GitHub
46 changed files with 223 additions and 37 deletions

View File

@@ -206,16 +206,21 @@ impl<T: InvokeUiSession> Remote<T> {
_msg = rx_clip_client.recv() => {
#[cfg(windows)]
match _msg {
Some(clip) => {
let is_stopping_allowed = clip.is_stopping_allowed();
let server_file_transfer_enabled = *self.handler.server_file_transfer_enabled.read().unwrap();
let file_transfer_enabled = self.handler.lc.read().unwrap().enable_file_transfer.v;
let stop = is_stopping_allowed && !(server_file_transfer_enabled && file_transfer_enabled);
log::debug!("Process clipboard message from system, stop: {}, is_stopping_allowed: {}, server_file_transfer_enabled: {}, file_transfer_enabled: {}", stop, is_stopping_allowed, server_file_transfer_enabled, file_transfer_enabled);
if stop {
ContextSend::set_is_stopped();
} else {
allow_err!(peer.send(&crate::clipboard_file::clip_2_msg(clip)).await);
Some(clip) => match clip {
clipboard::ClipboardFile::NotifyCallback{r#type, title, text} => {
self.handler.msgbox(&r#type, &title, &text, "");
}
_ => {
let is_stopping_allowed = clip.is_stopping_allowed();
let server_file_transfer_enabled = *self.handler.server_file_transfer_enabled.read().unwrap();
let file_transfer_enabled = self.handler.lc.read().unwrap().enable_file_transfer.v;
let stop = is_stopping_allowed && !(server_file_transfer_enabled && file_transfer_enabled);
log::debug!("Process clipboard message from system, stop: {}, is_stopping_allowed: {}, server_file_transfer_enabled: {}, file_transfer_enabled: {}", stop, is_stopping_allowed, server_file_transfer_enabled, file_transfer_enabled);
if stop {
ContextSend::set_is_stopped();
} else {
allow_err!(peer.send(&crate::clipboard_file::clip_2_msg(clip)).await);
}
}
}
None => {

View File

@@ -3,6 +3,20 @@ use hbb_common::message_proto::*;
pub fn clip_2_msg(clip: ClipboardFile) -> Message {
match clip {
ClipboardFile::NotifyCallback {
r#type,
title,
text,
} => Message {
union: Some(message::Union::MessageBox(MessageBox {
msgtype: r#type,
title,
text,
link: "".to_string(),
..Default::default()
})),
..Default::default()
},
ClipboardFile::MonitorReady => Message {
union: Some(message::Union::Cliprdr(Cliprdr {
union: Some(cliprdr::Union::Ready(CliprdrMonitorReady {

View File

@@ -511,5 +511,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Collapse toolbar", ""),
("Accept and Elevate", ""),
("accept_and_elevate_btn_tooltip", ""),
("clipboard_wait_response_timeout_tip", ""),
].iter().cloned().collect();
}

View File

@@ -511,5 +511,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Collapse toolbar", "折叠工具栏"),
("Accept and Elevate", "接受并提权"),
("accept_and_elevate_btn_tooltip", "接受连接并提升 UAC 权限"),
("clipboard_wait_response_timeout_tip", "等待拷贝响应超时"),
].iter().cloned().collect();
}

View File

@@ -511,5 +511,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Collapse toolbar", ""),
("Accept and Elevate", ""),
("accept_and_elevate_btn_tooltip", ""),
("clipboard_wait_response_timeout_tip", ""),
].iter().cloned().collect();
}

View File

@@ -511,5 +511,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Collapse toolbar", ""),
("Accept and Elevate", ""),
("accept_and_elevate_btn_tooltip", ""),
("clipboard_wait_response_timeout_tip", ""),
].iter().cloned().collect();
}

View File

@@ -511,5 +511,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Collapse toolbar", "Symbolleiste einklappen"),
("Accept and Elevate", "Akzeptieren und Rechte erhöhen"),
("accept_and_elevate_btn_tooltip", "Akzeptieren Sie die Verbindung und erhöhen Sie die UAC-Berechtigungen."),
("clipboard_wait_response_timeout_tip", ""),
].iter().cloned().collect();
}

View File

@@ -511,5 +511,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Collapse toolbar", ""),
("Accept and Elevate", ""),
("accept_and_elevate_btn_tooltip", ""),
("clipboard_wait_response_timeout_tip", ""),
].iter().cloned().collect();
}

View File

@@ -70,5 +70,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("resolution_fit_local_tip", "Fit local resolution"),
("resolution_custom_tip", "Custom resolution"),
("accept_and_elevate_btn_tooltip", "Accept the connection and elevate UAC permissions."),
("clipboard_wait_response_timeout_tip", "Timed out waiting for copy response."),
].iter().cloned().collect();
}

View File

@@ -511,5 +511,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Collapse toolbar", ""),
("Accept and Elevate", ""),
("accept_and_elevate_btn_tooltip", ""),
("clipboard_wait_response_timeout_tip", ""),
].iter().cloned().collect();
}

View File

@@ -511,5 +511,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Collapse toolbar", "Contraer barra de herramientas"),
("Accept and Elevate", "Aceptar y Elevar"),
("accept_and_elevate_btn_tooltip", "Aceptar la conexión y elevar permisos UAC."),
("clipboard_wait_response_timeout_tip", ""),
].iter().cloned().collect();
}

View File

@@ -511,5 +511,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Collapse toolbar", "جمع کردن نوار ابزار"),
("Accept and Elevate", "بپذیرید و افزایش دهید"),
("accept_and_elevate_btn_tooltip", "را افزایش دهید UAC اتصال را بپذیرید و مجوزهای."),
("clipboard_wait_response_timeout_tip", ""),
].iter().cloned().collect();
}

View File

@@ -511,5 +511,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Collapse toolbar", ""),
("Accept and Elevate", ""),
("accept_and_elevate_btn_tooltip", ""),
("clipboard_wait_response_timeout_tip", ""),
].iter().cloned().collect();
}

View File

@@ -511,5 +511,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Collapse toolbar", ""),
("Accept and Elevate", ""),
("accept_and_elevate_btn_tooltip", ""),
("clipboard_wait_response_timeout_tip", ""),
].iter().cloned().collect();
}

View File

@@ -511,5 +511,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Collapse toolbar", ""),
("Accept and Elevate", ""),
("accept_and_elevate_btn_tooltip", ""),
("clipboard_wait_response_timeout_tip", ""),
].iter().cloned().collect();
}

View File

@@ -511,5 +511,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Collapse toolbar", "Comprimi barra strumenti"),
("Accept and Elevate", "Accetta ed eleva"),
("accept_and_elevate_btn_tooltip", "Accetta la connessione ed eleva le autorizzazioni UAC."),
("clipboard_wait_response_timeout_tip", ""),
].iter().cloned().collect();
}

View File

@@ -511,5 +511,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Collapse toolbar", ""),
("Accept and Elevate", ""),
("accept_and_elevate_btn_tooltip", ""),
("clipboard_wait_response_timeout_tip", ""),
].iter().cloned().collect();
}

View File

@@ -511,5 +511,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Collapse toolbar", ""),
("Accept and Elevate", ""),
("accept_and_elevate_btn_tooltip", ""),
("clipboard_wait_response_timeout_tip", ""),
].iter().cloned().collect();
}

View File

@@ -511,5 +511,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Collapse toolbar", ""),
("Accept and Elevate", ""),
("accept_and_elevate_btn_tooltip", ""),
("clipboard_wait_response_timeout_tip", ""),
].iter().cloned().collect();
}

View File

@@ -511,5 +511,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Collapse toolbar", ""),
("Accept and Elevate", ""),
("accept_and_elevate_btn_tooltip", ""),
("clipboard_wait_response_timeout_tip", ""),
].iter().cloned().collect();
}

View File

@@ -511,5 +511,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Collapse toolbar", "Werkbalk samenvouwen"),
("Accept and Elevate", "Accepteren en Verheffen"),
("accept_and_elevate_btn_tooltip", "Accepteer de verbinding en verhoog de UAC-machtigingen."),
("clipboard_wait_response_timeout_tip", ""),
].iter().cloned().collect();
}

View File

@@ -511,5 +511,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Collapse toolbar", "Zwiń pasek narzędzi"),
("Accept and Elevate", "Akceptuj i Podnieś uprawnienia"),
("accept_and_elevate_btn_tooltip", ""),
("clipboard_wait_response_timeout_tip", ""),
].iter().cloned().collect();
}

View File

@@ -511,5 +511,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Collapse toolbar", ""),
("Accept and Elevate", ""),
("accept_and_elevate_btn_tooltip", ""),
("clipboard_wait_response_timeout_tip", ""),
].iter().cloned().collect();
}

View File

@@ -511,5 +511,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Collapse toolbar", ""),
("Accept and Elevate", ""),
("accept_and_elevate_btn_tooltip", ""),
("clipboard_wait_response_timeout_tip", ""),
].iter().cloned().collect();
}

View File

@@ -511,5 +511,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Collapse toolbar", ""),
("Accept and Elevate", ""),
("accept_and_elevate_btn_tooltip", ""),
("clipboard_wait_response_timeout_tip", ""),
].iter().cloned().collect();
}

View File

@@ -511,5 +511,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Collapse toolbar", "Свернуть панель инструментов"),
("Accept and Elevate", "Принять и повысить"),
("accept_and_elevate_btn_tooltip", "Разрешить подключение и повысить права UAC."),
("clipboard_wait_response_timeout_tip", ""),
].iter().cloned().collect();
}

View File

@@ -511,5 +511,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Collapse toolbar", ""),
("Accept and Elevate", ""),
("accept_and_elevate_btn_tooltip", ""),
("clipboard_wait_response_timeout_tip", ""),
].iter().cloned().collect();
}

View File

@@ -511,5 +511,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Collapse toolbar", ""),
("Accept and Elevate", ""),
("accept_and_elevate_btn_tooltip", ""),
("clipboard_wait_response_timeout_tip", ""),
].iter().cloned().collect();
}

View File

@@ -511,5 +511,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Collapse toolbar", ""),
("Accept and Elevate", ""),
("accept_and_elevate_btn_tooltip", ""),
("clipboard_wait_response_timeout_tip", ""),
].iter().cloned().collect();
}

View File

@@ -511,5 +511,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Collapse toolbar", ""),
("Accept and Elevate", ""),
("accept_and_elevate_btn_tooltip", ""),
("clipboard_wait_response_timeout_tip", ""),
].iter().cloned().collect();
}

View File

@@ -511,5 +511,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Collapse toolbar", ""),
("Accept and Elevate", ""),
("accept_and_elevate_btn_tooltip", ""),
("clipboard_wait_response_timeout_tip", ""),
].iter().cloned().collect();
}

View File

@@ -511,5 +511,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Collapse toolbar", ""),
("Accept and Elevate", ""),
("accept_and_elevate_btn_tooltip", ""),
("clipboard_wait_response_timeout_tip", ""),
].iter().cloned().collect();
}

View File

@@ -511,5 +511,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Collapse toolbar", ""),
("Accept and Elevate", ""),
("accept_and_elevate_btn_tooltip", ""),
("clipboard_wait_response_timeout_tip", ""),
].iter().cloned().collect();
}

View File

@@ -511,5 +511,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Collapse toolbar", ""),
("Accept and Elevate", ""),
("accept_and_elevate_btn_tooltip", ""),
("clipboard_wait_response_timeout_tip", ""),
].iter().cloned().collect();
}

View File

@@ -511,5 +511,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Collapse toolbar", ""),
("Accept and Elevate", ""),
("accept_and_elevate_btn_tooltip", ""),
("clipboard_wait_response_timeout_tip", ""),
].iter().cloned().collect();
}

View File

@@ -511,5 +511,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Collapse toolbar", ""),
("Accept and Elevate", ""),
("accept_and_elevate_btn_tooltip", ""),
("clipboard_wait_response_timeout_tip", ""),
].iter().cloned().collect();
}

View File

@@ -511,5 +511,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Collapse toolbar", "Thu nhỏ thanh công cụ"),
("Accept and Elevate", "Chấp nhận và Cấp Quyền"),
("accept_and_elevate_btn_tooltip", "Chấp nhận kết nối và cấp các quyền UAC."),
("clipboard_wait_response_timeout_tip", ""),
].iter().cloned().collect();
}

View File

@@ -987,7 +987,7 @@ fn try_get_displays() -> ResultType<Vec<Display>> {
}
#[inline]
#[cfg(windows)]
#[cfg(all(windows, feature = "virtual_display_driver"))]
fn no_displays(displays: &Vec<Display>) -> bool {
let display_len = displays.len();
if display_len == 0 {

View File

@@ -5,6 +5,15 @@ function translate_text(text) {
fds[i] = translate(fds[i]);
}
text = fds.join(': ');
} else {
var fds = text.split(' ');
if (fds.length > 1 && fds[0].slice(-4) === '_tip') {
fds[0] = translate(fds[0]);
var rest = text.substring(fds[0].length + 1);
text = fds[0] + ' ' + translate(rest);
} else {
text = translate(text);
}
}
return text;
}

View File

@@ -423,7 +423,7 @@ impl<T: InvokeUiCM> IpcTaskRunner<T> {
Data::ClipboardFileEnabled(_enabled) => {
#[cfg(windows)]
{
self.file_transfer_enabled_peer =_enabled;
self.file_transfer_enabled_peer = _enabled;
}
}
Data::Theme(dark) => {