mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
@@ -298,6 +298,13 @@ fn core_main_invoke_new_connection(mut args: std::env::Args) -> Option<Vec<Strin
|
||||
eprintln!("please provide a valid peer id");
|
||||
return None;
|
||||
}
|
||||
let mut switch_uuid = None;
|
||||
while let Some(item) = args.next() {
|
||||
if item == "--switch_uuid" {
|
||||
switch_uuid = args.next();
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
use crate::dbus::invoke_new_connection;
|
||||
@@ -315,8 +322,14 @@ fn core_main_invoke_new_connection(mut args: std::env::Args) -> Option<Vec<Strin
|
||||
}
|
||||
#[cfg(windows)]
|
||||
{
|
||||
let switch_uuid = switch_uuid.map_or("".to_string(), |p| format!("switch_uuid={}", p));
|
||||
let params = vec![switch_uuid].join("&");
|
||||
let params_flag = if params.is_empty() { "" } else { "?" };
|
||||
use winapi::um::winuser::WM_USER;
|
||||
let uni_links = format!("rustdesk://connection/new/{}", peer_id);
|
||||
let uni_links = format!(
|
||||
"rustdesk://connection/new/{}{}{}",
|
||||
peer_id, params_flag, params
|
||||
);
|
||||
let res = crate::platform::send_message_to_hnwd(
|
||||
"FLUTTER_RUNNER_WIN32_WINDOW",
|
||||
"RustDesk",
|
||||
|
||||
@@ -612,17 +612,3 @@ pub fn set_cur_session_id(id: String) {
|
||||
*CUR_SESSION_ID.write().unwrap() = id;
|
||||
}
|
||||
}
|
||||
|
||||
pub fn switch_sides(peer_id: &str, uuid: &Bytes) {
|
||||
if let Some(stream) = GLOBAL_EVENT_STREAM.read().unwrap().get(APP_TYPE_MAIN) {
|
||||
if let Ok(uuid) = uuid::Uuid::from_slice(uuid.to_vec().as_ref()) {
|
||||
let uuid = uuid.to_string();
|
||||
let data = HashMap::from([
|
||||
("name", "switch_sides"),
|
||||
("peer_id", peer_id),
|
||||
("uuid", &uuid),
|
||||
]);
|
||||
stream.add(serde_json::ser::to_string(&data).unwrap_or("".into()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1573,8 +1573,16 @@ impl Connection {
|
||||
},
|
||||
#[cfg(feature = "flutter")]
|
||||
Some(misc::Union::SwitchSidesRequest(s)) => {
|
||||
crate::flutter::switch_sides(&self.lr.my_id, &s.uuid);
|
||||
return false;
|
||||
if let Ok(uuid) = uuid::Uuid::from_slice(&s.uuid.to_vec()[..]) {
|
||||
crate::run_me(vec![
|
||||
"--connect",
|
||||
&self.lr.my_id,
|
||||
"--switch_uuid",
|
||||
uuid.to_string().as_ref(),
|
||||
])
|
||||
.ok();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user