mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
upgrade some crates, fix scrap benchmark on mac, fix compile issue on
osx10.14
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user