show fingerprint

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages
2023-04-19 14:39:22 +08:00
parent 08c4d2a1cf
commit 1100b2a465
53 changed files with 350 additions and 28 deletions

View File

@@ -24,13 +24,12 @@ use hbb_common::{
rendezvous_proto::*,
};
use crate::common::SOFTWARE_UPDATE_URL;
#[cfg(feature = "flutter")]
use crate::hbbs_http::account;
use crate::{common::SOFTWARE_UPDATE_URL};
#[cfg(not(any(target_os = "ios")))]
use crate::ipc;
type Message = RendezvousMessage;
pub type Children = Arc<Mutex<(bool, HashMap<(String, String), Child>)>>;
@@ -515,8 +514,7 @@ pub fn get_error() -> String {
#[cfg(target_os = "linux")]
{
let dtype = crate::platform::linux::get_display_server();
if crate::platform::linux::DISPLAY_SERVER_WAYLAND == dtype
{
if crate::platform::linux::DISPLAY_SERVER_WAYLAND == dtype {
return crate::server::wayland::common_get_error();
}
if dtype != crate::platform::linux::DISPLAY_SERVER_X11 {
@@ -852,6 +850,17 @@ pub fn get_user_default_option(key: String) -> String {
UserDefaultConfig::load().get(&key)
}
pub fn get_fingerprint() -> String {
#[cfg(any(target_os = "android", target_os = "ios"))]
if Config::get_key_confirmed() {
return crate::common::pk_to_fingerprint(Config::get_key_pair().1);
} else {
return "".to_owned();
}
#[cfg(not(any(target_os = "android", target_os = "ios")))]
return ipc::get_fingerprint();
}
// notice: avoiding create ipc connection repeatedly,
// because windows named pipe has serious memory leak issue.
#[cfg(not(any(target_os = "android", target_os = "ios")))]