upgrade some crates, fix scrap benchmark on mac, fix compile issue on
osx10.14
This commit is contained in:
parent
08f9b3760f
commit
61679a1072
13 changed files with 1108 additions and 907 deletions
1939
Cargo.lock
generated
1939
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
17
Cargo.toml
17
Cargo.toml
|
|
@ -45,22 +45,22 @@ lazy_static = "1.4"
|
|||
sha2 = "0.10"
|
||||
repng = "0.2"
|
||||
parity-tokio-ipc = { git = "https://github.com/open-trade/parity-tokio-ipc" }
|
||||
runas = "0.2"
|
||||
runas = "1.0"
|
||||
magnum-opus = { git = "https://github.com/rustdesk/magnum-opus" }
|
||||
dasp = { version = "0.11", features = ["signal", "interpolate-linear", "interpolate"], optional = true }
|
||||
rubato = { version = "0.12", optional = true }
|
||||
samplerate = { version = "0.2", optional = true }
|
||||
async-trait = "0.1"
|
||||
uuid = { version = "1.0", features = ["v4"] }
|
||||
clap = "3.0"
|
||||
clap = "4.1"
|
||||
rpassword = "7.0"
|
||||
base64 = "0.13"
|
||||
base64 = "0.21"
|
||||
num_cpus = "1.13"
|
||||
bytes = { version = "1.2", features = ["serde"] }
|
||||
default-net = "0.12.0"
|
||||
wol-rs = "0.9.1"
|
||||
wol-rs = "1.0"
|
||||
flutter_rust_bridge = { version = "1.61.1", optional = true }
|
||||
errno = "0.2.8"
|
||||
errno = "0.3"
|
||||
rdev = { git = "https://github.com/fufesou/rdev" }
|
||||
url = { version = "2.1", features = ["serde"] }
|
||||
dlopen = "0.1"
|
||||
|
|
@ -71,7 +71,7 @@ chrono = "0.4.23"
|
|||
cidr-utils = "0.5.9"
|
||||
|
||||
[target.'cfg(not(any(target_os = "android", target_os = "linux")))'.dependencies]
|
||||
cpal = "0.13.5"
|
||||
cpal = "0.14"
|
||||
|
||||
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
|
||||
machine-uid = "0.2"
|
||||
|
|
@ -81,9 +81,9 @@ sys-locale = "0.2"
|
|||
enigo = { path = "libs/enigo", features = [ "with_serde" ] }
|
||||
clipboard = { path = "libs/clipboard" }
|
||||
ctrlc = "3.2"
|
||||
arboard = "2.0"
|
||||
arboard = "3.2"
|
||||
#minreq = { version = "2.4", features = ["punycode", "https-native"] }
|
||||
system_shutdown = "3.0.0"
|
||||
system_shutdown = "4.0"
|
||||
|
||||
[target.'cfg(target_os = "windows")'.dependencies]
|
||||
trayicon = { git = "https://github.com/open-trade/trayicon-rs", features = ["winit"] }
|
||||
|
|
@ -148,6 +148,7 @@ cc = "1.0"
|
|||
hbb_common = { path = "libs/hbb_common" }
|
||||
simple_rc = { path = "libs/simple_rc", optional = true }
|
||||
flutter_rust_bridge_codegen = "1.61.1"
|
||||
os-version = "0.2"
|
||||
|
||||
[dev-dependencies]
|
||||
hound = "3.5"
|
||||
|
|
|
|||
9
build.rs
9
build.rs
|
|
@ -9,7 +9,14 @@ fn build_windows() {
|
|||
#[cfg(target_os = "macos")]
|
||||
fn build_mac() {
|
||||
let file = "src/platform/macos.mm";
|
||||
cc::Build::new().file(file).compile("macos");
|
||||
let mut b = cc::Build::new();
|
||||
if let Ok(os_version::OsVersion::MacOS(v)) = os_version::detect() {
|
||||
let v = v.version;
|
||||
if v.contains("10.14") {
|
||||
b.flag("-DNO_InputMonitoringAuthStatus=1");
|
||||
}
|
||||
}
|
||||
b.file(file).compile("macos");
|
||||
println!("cargo:rerun-if-changed={}", file);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,17 +7,17 @@ edition = "2018"
|
|||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
flexi_logger = { version = "0.22", features = ["async", "use_chrono_for_offset"] }
|
||||
flexi_logger = { version = "0.25", features = ["async"] }
|
||||
protobuf = { version = "3.1", features = ["with-bytes"] }
|
||||
tokio = { version = "1.20", features = ["full"] }
|
||||
tokio-util = { version = "0.7", features = ["full"] }
|
||||
futures = "0.3"
|
||||
bytes = { version = "1.2", features = ["serde"] }
|
||||
log = "0.4"
|
||||
env_logger = "0.9"
|
||||
env_logger = "0.10"
|
||||
socket2 = { version = "0.3", features = ["reuseport"] }
|
||||
zstd = "0.9"
|
||||
quinn = {version = "0.8", optional = true }
|
||||
quinn = {version = "0.9", optional = true }
|
||||
anyhow = "1.0"
|
||||
futures-util = "0.3"
|
||||
directories-next = "2.0"
|
||||
|
|
@ -34,7 +34,7 @@ tokio-socks = { git = "https://github.com/open-trade/tokio-socks" }
|
|||
chrono = "0.4"
|
||||
backtrace = "0.3"
|
||||
libc = "0.2"
|
||||
sysinfo = "0.24"
|
||||
sysinfo = "0.26"
|
||||
|
||||
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
|
||||
mac_address = "1.1"
|
||||
|
|
@ -54,5 +54,5 @@ winapi = { version = "0.3", features = ["winuser"] }
|
|||
osascript = "0.3.0"
|
||||
|
||||
[dev-dependencies]
|
||||
toml = "0.5"
|
||||
serde_json = "1.0"
|
||||
toml = "0.7"
|
||||
serde_json = "1.0"
|
||||
|
|
@ -42,7 +42,7 @@ quest = "0.3"
|
|||
|
||||
[build-dependencies]
|
||||
target_build_utils = "0.3"
|
||||
bindgen = "0.59"
|
||||
bindgen = "0.64"
|
||||
|
||||
[target.'cfg(target_os = "linux")'.dependencies]
|
||||
dbus = { version = "0.9", optional = true }
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ impl crate::TraitCapturer for Capturer {
|
|||
}
|
||||
}
|
||||
|
||||
pub struct Frame<'a>(quartz::Frame, PhantomData<&'a [u8]>);
|
||||
pub struct Frame<'a>(pub quartz::Frame, PhantomData<&'a [u8]>);
|
||||
|
||||
impl<'a> ops::Deref for Frame<'a> {
|
||||
type Target = [u8];
|
||||
|
|
|
|||
|
|
@ -2233,7 +2233,7 @@ fn get_pk(pk: &[u8]) -> Option<[u8; 32]> {
|
|||
|
||||
#[inline]
|
||||
fn get_rs_pk(str_base64: &str) -> Option<sign::PublicKey> {
|
||||
if let Ok(pk) = base64::decode(str_base64) {
|
||||
if let Ok(pk) = crate::decode64(str_base64) {
|
||||
get_pk(&pk).map(|x| sign::PublicKey(x))
|
||||
} else {
|
||||
None
|
||||
|
|
|
|||
|
|
@ -787,3 +787,15 @@ pub fn handle_url_scheme(url: String) {
|
|||
let _ = crate::run_me(vec![url]);
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn encode64<T: AsRef<[u8]>>(input: T) -> String {
|
||||
#[allow(deprecated)]
|
||||
base64::encode(input)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn decode64<T: AsRef<[u8]>>(input: T) -> Result<Vec<u8>, base64::DecodeError> {
|
||||
#[allow(deprecated)]
|
||||
base64::decode(input)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
use base64::{engine::general_purpose::URL_SAFE_NO_PAD, Engine as _};
|
||||
use hbb_common::{bail, sodiumoxide::crypto::sign, ResultType};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
|
|
@ -18,7 +19,7 @@ fn get_license_from_string_(s: &str) -> ResultType<License> {
|
|||
12, 46, 129, 83, 17, 84, 193, 119, 197, 130, 103,
|
||||
];
|
||||
let pk = sign::PublicKey(*PK);
|
||||
let data = base64::decode_config(tmp, base64::URL_SAFE_NO_PAD)?;
|
||||
let data = URL_SAFE_NO_PAD.decode(tmp)?;
|
||||
if let Ok(lic) = serde_json::from_slice::<License>(&data) {
|
||||
return Ok(lic);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
mod license;
|
||||
use base64::{engine::general_purpose::URL_SAFE_NO_PAD, Engine as _};
|
||||
use hbb_common::ResultType;
|
||||
use license::*;
|
||||
|
||||
fn gen_name(lic: &License) -> ResultType<String> {
|
||||
let tmp = serde_json::to_vec::<License>(lic)?;
|
||||
let tmp = base64::encode_config(tmp, base64::URL_SAFE_NO_PAD);
|
||||
let tmp = URL_SAFE_NO_PAD.encode(&tmp);
|
||||
let tmp: String = tmp.chars().rev().collect();
|
||||
Ok(tmp)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,9 @@
|
|||
// https://github.com/codebytere/node-mac-permissions/blob/main/permissions.mm
|
||||
|
||||
extern "C" bool InputMonitoringAuthStatus(bool prompt) {
|
||||
#ifdef NO_InputMonitoringAuthStatus
|
||||
return true;
|
||||
#else
|
||||
if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_15) {
|
||||
IOHIDAccessType theType = IOHIDCheckAccess(kIOHIDRequestTypeListenEvent);
|
||||
NSLog(@"IOHIDCheckAccess = %d, kIOHIDAccessTypeGranted = %d", theType, kIOHIDAccessTypeGranted);
|
||||
|
|
@ -36,6 +39,7 @@ extern "C" bool InputMonitoringAuthStatus(bool prompt) {
|
|||
return true;
|
||||
}
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
extern "C" bool MacCheckAdminAuthorization() {
|
||||
|
|
|
|||
|
|
@ -735,7 +735,7 @@ impl Connection {
|
|||
let url = self.server_audit_conn.clone();
|
||||
let mut v = v;
|
||||
v["id"] = json!(Config::get_id());
|
||||
v["uuid"] = json!(base64::encode(hbb_common::get_uuid()));
|
||||
v["uuid"] = json!(crate::encode64(hbb_common::get_uuid()));
|
||||
v["conn_id"] = json!(self.inner.id);
|
||||
tokio::spawn(async move {
|
||||
allow_err!(Self::post_audit_async(url, v).await);
|
||||
|
|
@ -765,7 +765,7 @@ impl Connection {
|
|||
info["files"] = json!(files);
|
||||
let v = json!({
|
||||
"id":json!(Config::get_id()),
|
||||
"uuid":json!(base64::encode(hbb_common::get_uuid())),
|
||||
"uuid":json!(crate::encode64(hbb_common::get_uuid())),
|
||||
"peer_id":json!(self.lr.my_id),
|
||||
"type": r#type as i8,
|
||||
"path":path,
|
||||
|
|
@ -788,7 +788,7 @@ impl Connection {
|
|||
}
|
||||
let mut v = Value::default();
|
||||
v["id"] = json!(Config::get_id());
|
||||
v["uuid"] = json!(base64::encode(hbb_common::get_uuid()));
|
||||
v["uuid"] = json!(crate::encode64(hbb_common::get_uuid()));
|
||||
v["typ"] = json!(typ as i8);
|
||||
v["from_remote"] = json!(from_remote);
|
||||
v["info"] = serde_json::Value::String(info.to_string());
|
||||
|
|
|
|||
|
|
@ -605,7 +605,7 @@ pub fn remove_discovered(id: String) {
|
|||
|
||||
#[inline]
|
||||
pub fn get_uuid() -> String {
|
||||
base64::encode(hbb_common::get_uuid())
|
||||
crate::encode64(hbb_common::get_uuid())
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "android", target_os = "ios", feature = "flutter"))]
|
||||
|
|
@ -876,7 +876,7 @@ pub async fn change_id_shared(id: String, old_id: String) -> &'static str {
|
|||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
let uuid = machine_uid::get().unwrap_or("".to_owned());
|
||||
#[cfg(any(target_os = "android", target_os = "ios"))]
|
||||
let uuid = base64::encode(hbb_common::get_uuid());
|
||||
let uuid = crate::encode64(hbb_common::get_uuid());
|
||||
|
||||
if uuid.is_empty() {
|
||||
log::error!("Failed to change id, uuid is_empty");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue