mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-09-13 16:01:00 +03:00
Compare commits
2 Commits
82d704b2d2
...
2f342e7730
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2f342e7730 | ||
|
|
9efe392ca2 |
@@ -516,14 +516,17 @@ fn stage_err(stage: &str, kind: &str, detail: &str) -> String {
|
||||
format!("wl-stage:{}:{}:{}", stage, kind, detail.trim())
|
||||
}
|
||||
|
||||
fn dbus_detail(err: &dbus::Error) -> String {
|
||||
match (err.name(), err.message()) {
|
||||
// The name alone is usually the generic `org.freedesktop.DBus.Error.Failed`; the message is
|
||||
// where a backend says what it objected to. This ends up in the log, so carry both.
|
||||
fn dbus_stage_err(stage: &str, err: &dbus::Error) -> String {
|
||||
let detail = match (err.name(), err.message()) {
|
||||
(Some(name), Some(message)) if !name.is_empty() && !message.is_empty() => {
|
||||
format!("{}: {}", name, message)
|
||||
}
|
||||
(Some(name), _) if !name.is_empty() => name.to_owned(),
|
||||
(_, message) => message.unwrap_or_default().to_owned(),
|
||||
}
|
||||
};
|
||||
stage_err(stage, "dbus", &detail)
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
@@ -746,8 +749,8 @@ pub fn request_remote_desktop(
|
||||
INIT = true;
|
||||
}
|
||||
}
|
||||
let conn = SyncConnection::new_session()
|
||||
.map_err(|e| anyhow!(stage_err("session-bus", "dbus", &dbus_detail(&e))))?;
|
||||
let conn =
|
||||
SyncConnection::new_session().map_err(|e| anyhow!(dbus_stage_err("session-bus", &e)))?;
|
||||
let portal = get_portal(&conn);
|
||||
let mut args: PropMap = HashMap::new();
|
||||
let fd: Arc<Mutex<Option<OwnedFd>>> = Arc::new(Mutex::new(None));
|
||||
@@ -783,7 +786,8 @@ pub fn request_remote_desktop(
|
||||
// the caller to subscribe to the signal before making the method call.
|
||||
handle_response(
|
||||
&conn,
|
||||
get_request_path(&conn, create_session_handle_token)?,
|
||||
get_request_path(&conn, create_session_handle_token)
|
||||
.map_err(|e| anyhow!(dbus_stage_err("create-session", &e)))?,
|
||||
on_create_session_response(
|
||||
fd.clone(),
|
||||
streams.clone(),
|
||||
@@ -794,18 +798,20 @@ pub fn request_remote_desktop(
|
||||
),
|
||||
trace.clone(),
|
||||
PortalStage::CreateSession,
|
||||
)?;
|
||||
)
|
||||
.map_err(|e| anyhow!(dbus_stage_err("create-session", &e)))?;
|
||||
if is_server_running() {
|
||||
let _ = screencast_portal::create_session(&portal, args)
|
||||
.map_err(|e| anyhow!(stage_err("create-session", "dbus", &dbus_detail(&e))))?;
|
||||
.map_err(|e| anyhow!(dbus_stage_err("create-session", &e)))?;
|
||||
} else {
|
||||
let _ = remote_desktop_portal::create_session(&portal, args)
|
||||
.map_err(|e| anyhow!(stage_err("create-session", "dbus", &dbus_detail(&e))))?;
|
||||
.map_err(|e| anyhow!(dbus_stage_err("create-session", &e)))?;
|
||||
}
|
||||
|
||||
// wait 3 minutes for user interaction
|
||||
for _ in 0..1800 {
|
||||
conn.process(Duration::from_millis(100))?;
|
||||
conn.process(Duration::from_millis(100))
|
||||
.map_err(|e| anyhow!(dbus_stage_err(trace_res.waiting_stage().as_str(), &e)))?;
|
||||
// Once we got a file descriptor we are done!
|
||||
if fd_res.lock().unwrap().is_some() {
|
||||
break;
|
||||
|
||||
@@ -770,7 +770,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("port-forward-mux-tip", "同一条端口转发规则上的所有连接共用一条到对方的连接,而不是每条连接都重新连接并登录一次。"),
|
||||
("Enable WebRTC P2P connection", "启用 WebRTC P2P 连接"),
|
||||
("Enable TCP hole punching", "启用 TCP 打洞"),
|
||||
("The screen sharing request was declined on the remote device", "远程设备上拒绝了屏幕共享请求"),
|
||||
("The screen sharing request was declined on the remote device", "远程设备上的用户拒绝了屏幕共享请求"),
|
||||
("No one responded to the screen sharing request on the remote device", "远程设备上无人响应屏幕共享请求"),
|
||||
("The XDG Desktop Portal ended the screen sharing request ({})", "XDG Desktop Portal 结束了屏幕共享请求 ({})"),
|
||||
("The XDG Desktop Portal returned no screen to capture, the PipeWire library may be too old", "XDG Desktop Portal 未返回可捕获的屏幕,PipeWire 库可能过旧"),
|
||||
|
||||
@@ -770,7 +770,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("port-forward-mux-tip", "同一條連接埠轉送規則上的所有連線共用一條到對方的連線,而不是每條連線都重新連線並登入一次。"),
|
||||
("Enable WebRTC P2P connection", "啟用 WebRTC P2P 連線"),
|
||||
("Enable TCP hole punching", "啟用 TCP 打洞"),
|
||||
("The screen sharing request was declined on the remote device", "遠端裝置上拒絕了螢幕分享要求"),
|
||||
("The screen sharing request was declined on the remote device", "遠端裝置上的使用者拒絕了螢幕分享要求"),
|
||||
("No one responded to the screen sharing request on the remote device", "遠端裝置上無人回應螢幕分享要求"),
|
||||
("The XDG Desktop Portal ended the screen sharing request ({})", "XDG Desktop Portal 結束了螢幕分享要求 ({})"),
|
||||
("The XDG Desktop Portal returned no screen to capture, the PipeWire library may be too old", "XDG Desktop Portal 未傳回可擷取的螢幕,PipeWire 函式庫可能過舊"),
|
||||
|
||||
Reference in New Issue
Block a user