mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-03-22 04:31:00 +03:00
refact: file copy&paste, cross platform (no macOS) (#10671)
* feat: unix, file copy&paste Signed-off-by: fufesou <linlong1266@gmail.com> * refact: unix file c&p, check peer version Signed-off-by: fufesou <linlong1266@gmail.com> * Update pubspec.yaml --------- Signed-off-by: fufesou <linlong1266@gmail.com> Co-authored-by: RustDesk <71636191+rustdesk@users.noreply.github.com>
This commit is contained in:
@@ -66,6 +66,39 @@ impl SciterHandler {
|
||||
}
|
||||
displays_value
|
||||
}
|
||||
|
||||
fn make_platform_additions(data: &str) -> Option<Value> {
|
||||
if let Ok(v2) = serde_json::from_str::<HashMap<String, serde_json::Value>>(data) {
|
||||
let mut value = Value::map();
|
||||
for (k, v) in v2 {
|
||||
match v {
|
||||
serde_json::Value::String(s) => {
|
||||
value.set_item(k, s);
|
||||
}
|
||||
serde_json::Value::Number(n) => {
|
||||
if let Some(n) = n.as_i64() {
|
||||
value.set_item(k, n as i32);
|
||||
} else if let Some(n) = n.as_f64() {
|
||||
value.set_item(k, n);
|
||||
}
|
||||
}
|
||||
serde_json::Value::Bool(b) => {
|
||||
value.set_item(k, b);
|
||||
}
|
||||
_ => {
|
||||
// ignore for now
|
||||
}
|
||||
}
|
||||
}
|
||||
if value.len() > 0 {
|
||||
return Some(value);
|
||||
} else {
|
||||
None
|
||||
}
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl InvokeUiSession for SciterHandler {
|
||||
@@ -245,6 +278,9 @@ impl InvokeUiSession for SciterHandler {
|
||||
pi_sciter.set_item("displays", Self::make_displays_array(&pi.displays));
|
||||
pi_sciter.set_item("current_display", pi.current_display);
|
||||
pi_sciter.set_item("version", pi.version.clone());
|
||||
if let Some(v) = Self::make_platform_additions(&pi.platform_additions) {
|
||||
pi_sciter.set_item("platform_additions", v);
|
||||
}
|
||||
self.call("updatePi", &make_args!(pi_sciter));
|
||||
}
|
||||
|
||||
@@ -500,6 +536,7 @@ impl sciter::EventHandler for SciterSession {
|
||||
fn version_cmp(String, String);
|
||||
fn set_selected_windows_session_id(String);
|
||||
fn is_recording();
|
||||
fn has_file_clipboard();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -607,6 +644,10 @@ impl SciterSession {
|
||||
self.send_selected_session_id(u_sid);
|
||||
}
|
||||
|
||||
fn has_file_clipboard(&self) -> bool {
|
||||
cfg!(any(target_os = "windows", feature = "unix-file-copy-paste"))
|
||||
}
|
||||
|
||||
fn get_port_forwards(&mut self) -> Value {
|
||||
let port_forwards = self.lc.read().unwrap().port_forwards.clone();
|
||||
let mut v = Value::array(0);
|
||||
|
||||
Reference in New Issue
Block a user