Merge pull request #4826 from 21pages/password

fix encrypt
This commit is contained in:
RustDesk 2023-07-02 22:56:43 +08:00 committed by GitHub
commit 1e63b4c937
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 14 additions and 12 deletions

6
Cargo.lock generated
View File

@ -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",

View File

@ -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"

View File

@ -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]

View File

@ -1031,12 +1031,8 @@ impl PeerConfig {
};
let c = PeerConfig::load(&id_decoded_string);
if c.info.platform.is_empty() {
fs::remove_file(p).ok();
}
(id_decoded_string, t, c)
})
.filter(|p| !p.2.info.platform.is_empty())
.collect();
peers.sort_unstable_by(|a, b| b.1.cmp(&a.1));
return peers;

View File

@ -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;

View File

@ -149,7 +149,7 @@ pub fn decrypt_vec_or_original(v: &[u8], current_version: &str) -> (Vec<u8>, boo
}
fn encrypt(v: &[u8]) -> Result<String, ()> {
if !v.is_empty() {
if !v.is_empty() && v.len() <= 128 {
symmetric_crypt(v, true).map(|v| base64::encode(v, base64::Variant::Original))
} else {
Err(())

View File

@ -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 {

View File

@ -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());