From c42fbe3d45a4285f5252aa03011ca6a09473f352 Mon Sep 17 00:00:00 2001 From: 21pages Date: Sun, 2 Jul 2023 17:13:23 +0800 Subject: [PATCH] update machine-uid for x86 sciter access x64 machine id Signed-off-by: 21pages --- Cargo.lock | 6 +++--- Cargo.toml | 1 - libs/hbb_common/Cargo.toml | 2 +- libs/hbb_common/src/lib.rs | 2 ++ src/ui.rs | 2 +- src/ui_interface.rs | 7 ++++++- 6 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2cf7ddf15..c999d7c6d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3598,9 +3598,10 @@ dependencies = [ [[package]] name = "machine-uid" version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26141aceb9f046065617266f41a4a652e4583da643472a10a89b4b3664d99eb6" +source = "git+https://github.com/21pages/machine-uid#381ff579c1dc3a6c54db9dfec47c44bcb0246542" dependencies = [ + "bindgen 0.59.2", + "cc", "winreg 0.11.0", ] @@ -5191,7 +5192,6 @@ dependencies = [ "libpulse-binding", "libpulse-simple-binding", "mac_address", - "machine-uid", "magnum-opus", "mouce", "num_cpus", diff --git a/Cargo.toml b/Cargo.toml index 6f7e8c08f..67d2440f0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -80,7 +80,6 @@ cpal = "0.15" ringbuf = "0.3" [target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies] -machine-uid = "0.3" mac_address = "1.1" sciter-rs = { git = "https://github.com/open-trade/rust-sciter", branch = "dyn" } sys-locale = "0.3" diff --git a/libs/hbb_common/Cargo.toml b/libs/hbb_common/Cargo.toml index 864bdded0..74a2d40cc 100644 --- a/libs/hbb_common/Cargo.toml +++ b/libs/hbb_common/Cargo.toml @@ -40,7 +40,7 @@ uuid = { version = "1.3", features = ["v4"] } [target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies] mac_address = "1.1" -machine-uid = "0.3" +machine-uid = { git = "https://github.com/21pages/machine-uid" } sysinfo = "0.29" [features] diff --git a/libs/hbb_common/src/lib.rs b/libs/hbb_common/src/lib.rs index 192ee8a65..22347840c 100644 --- a/libs/hbb_common/src/lib.rs +++ b/libs/hbb_common/src/lib.rs @@ -45,6 +45,8 @@ pub mod keyboard; #[cfg(not(any(target_os = "android", target_os = "ios")))] pub use dlopen; #[cfg(not(any(target_os = "android", target_os = "ios")))] +pub use machine_uid; +#[cfg(not(any(target_os = "android", target_os = "ios")))] pub use sysinfo; pub use toml; pub use uuid; diff --git a/src/ui.rs b/src/ui.rs index baa7fef4c..8f075b7de 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -552,7 +552,7 @@ impl UI { } fn is_ok_change_id(&self) -> bool { - machine_uid::get().is_ok() + hbb_common::machine_uid::get().is_ok() } fn get_async_job_status(&self) -> String { diff --git a/src/ui_interface.rs b/src/ui_interface.rs index 2232f3c42..982436b53 100644 --- a/src/ui_interface.rs +++ b/src/ui_interface.rs @@ -1037,7 +1037,12 @@ pub async fn change_id_shared_(id: String, old_id: String) -> &'static str { } #[cfg(not(any(target_os = "android", target_os = "ios")))] - let uuid = Bytes::from(machine_uid::get().unwrap_or("".to_owned()).as_bytes().to_vec()); + let uuid = Bytes::from( + hbb_common::machine_uid::get() + .unwrap_or("".to_owned()) + .as_bytes() + .to_vec(), + ); #[cfg(any(target_os = "android", target_os = "ios"))] let uuid = Bytes::from(hbb_common::get_uuid());