An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.
Rust androidanydeskdartflatpakflutterflutter-appsioslinuxmacosp2prdpremote-controlremote-desktoprustrust-langteamviewervncwaylandwindows
fix sysinfo update when id change, and add debug info for pk change
hzhou7fb2464d84b6
diff --git a/libs/hbb_common/src/config.rs b/libs/hbb_common/src/config.rsindex 5af811047..5446b7a01 100644--- a/libs/hbb_common/src/config.rs+++ b/libs/hbb_common/src/config.rs@@ -867,6 +867,7 @@ impl Config {}let mut config = Config::load_::<Config>("");if config.key_pair.0.is_empty() {+ log::info!("Generated new keypair for id: {}", config.id);let (pk, sk) = sign::gen_keypair();let key_pair = (sk.0.to_vec(), pk.0.into());config.key_pair = key_pair.clone();diff --git a/src/hbbs_http/sync.rs b/src/hbbs_http/sync.rsindex 2a33b3114..8cf925434 100644--- a/src/hbbs_http/sync.rs+++ b/src/hbbs_http/sync.rs@@ -56,11 +56,13 @@ async fn start_hbbs_sync_async() {TIME_CONN,));let mut last_sent: Option<Instant> = None;- let mut info_uploaded: (bool, String, Option<Instant>) = (false, "".to_owned(), None);+ let mut info_uploaded: (bool, String, Option<Instant>, String) =+ (false, "".to_owned(), None, "".to_owned());loop {tokio::select! {_ = interval.tick() => {let url = heartbeat_url();+ let id = Config::get_id();if url.is_empty() {*PRO.lock().unwrap() = false;continue;@@ -69,19 +71,19 @@ async fn start_hbbs_sync_async() {continue;}let conns = Connection::alive_conns();- if info_uploaded.0 && url != info_uploaded.1 {+ if info_uploaded.0 && (url != info_uploaded.1 || id != info_uploaded.3){info_uploaded.0 = false;*PRO.lock().unwrap() = false;}if !info_uploaded.0 && info_uploaded.2.map(|x| x.elapsed() >= UPLOAD_SYSINFO_TIMEOUT).unwrap_or(true){let mut v = crate::get_sysinfo();v["version"] = json!(crate::VERSION);- v["id"] = json!(Config::get_id());+ v["id"] = json!(id);v["uuid"] = json!(crate::encode64(hbb_common::get_uuid()));match crate::post_request(url.replace("heartbeat", "sysinfo"), v.to_string(), "").await {Ok(x) => {if x == "SYSINFO_UPDATED" {- info_uploaded = (true, url.clone(), None);+ info_uploaded = (true, url.clone(), None, id.clone());hbb_common::log::info!("sysinfo updated");*PRO.lock().unwrap() = true;} else if x == "ID_NOT_FOUND" {@@ -100,7 +102,7 @@ async fn start_hbbs_sync_async() {}last_sent = Some(Instant::now());let mut v = Value::default();- v["id"] = json!(Config::get_id());+ v["id"] = json!(id);v["uuid"] = json!(crate::encode64(hbb_common::get_uuid()));v["ver"] = json!(hbb_common::get_version_number(crate::VERSION));if !conns.is_empty() {