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:
fufesou
2025-02-04 20:33:02 +08:00
committed by GitHub
parent a27fa43081
commit fbba8f0b34
42 changed files with 2026 additions and 1778 deletions

View File

@@ -89,7 +89,7 @@ lazy_static::lazy_static! {
pub struct SimpleCallOnReturn {
pub b: bool,
pub f: Box<dyn Fn() + 'static>,
pub f: Box<dyn Fn() + Send + 'static>,
}
impl Drop for SimpleCallOnReturn {
@@ -127,6 +127,18 @@ pub fn is_support_multi_ui_session_num(ver: i64) -> bool {
ver >= hbb_common::get_version_number(MIN_VER_MULTI_UI_SESSION)
}
#[inline]
#[cfg(feature = "unix-file-copy-paste")]
pub fn is_support_file_copy_paste(ver: &str) -> bool {
is_support_file_copy_paste_num(hbb_common::get_version_number(ver))
}
#[inline]
#[cfg(feature = "unix-file-copy-paste")]
pub fn is_support_file_copy_paste_num(ver: i64) -> bool {
ver >= hbb_common::get_version_number("1.3.8")
}
// is server process, with "--server" args
#[inline]
pub fn is_server() -> bool {
@@ -751,7 +763,6 @@ pub fn get_sysinfo() -> serde_json::Value {
os = format!("{os} - {}", system.os_version().unwrap_or_default());
}
let hostname = hostname(); // sys.hostname() return localhost on android in my test
use serde_json::json;
#[cfg(any(target_os = "android", target_os = "ios"))]
let out;
#[cfg(not(any(target_os = "android", target_os = "ios")))]
@@ -1057,7 +1068,6 @@ pub fn make_fd_to_json(id: i32, path: String, entries: &Vec<FileEntry>) -> Strin
}
pub fn _make_fd_to_json(id: i32, path: String, entries: &Vec<FileEntry>) -> Map<String, Value> {
use serde_json::json;
let mut fd_json = serde_json::Map::new();
fd_json.insert("id".into(), json!(id));
fd_json.insert("path".into(), json!(path));