This commit is contained in:
parent
57570c3ba6
commit
78d7bfac01
@ -71,41 +71,45 @@ async fn start_hbbs_sync_async() {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let conns = Connection::alive_conns();
|
let conns = Connection::alive_conns();
|
||||||
if info_uploaded.0 && (url != info_uploaded.1 || id != info_uploaded.3){
|
if info_uploaded.0 && (url != info_uploaded.1 || id != info_uploaded.3) {
|
||||||
info_uploaded.0 = false;
|
info_uploaded.0 = false;
|
||||||
*PRO.lock().unwrap() = false;
|
*PRO.lock().unwrap() = false;
|
||||||
}
|
}
|
||||||
if !info_uploaded.0 && info_uploaded.2.map(|x| x.elapsed() >= UPLOAD_SYSINFO_TIMEOUT).unwrap_or(true){
|
if !info_uploaded.0 && info_uploaded.2.map(|x| x.elapsed() >= UPLOAD_SYSINFO_TIMEOUT).unwrap_or(true) {
|
||||||
let mut v = crate::get_sysinfo();
|
let mut v = crate::get_sysinfo();
|
||||||
v["version"] = json!(crate::VERSION);
|
// username is empty in login screen of windows, but here we only upload sysinfo once, causing
|
||||||
v["id"] = json!(id);
|
// real user name not uploaded after login screen. https://github.com/rustdesk/rustdesk/discussions/8031
|
||||||
v["uuid"] = json!(crate::encode64(hbb_common::get_uuid()));
|
if !cfg!(windows) || !v["username"].as_str().unwrap_or_default().is_empty() {
|
||||||
let ab_name = Config::get_option("preset-address-book-name");
|
v["version"] = json!(crate::VERSION);
|
||||||
if !ab_name.is_empty() {
|
v["id"] = json!(id);
|
||||||
v["preset-address-book-name"] = json!(ab_name);
|
v["uuid"] = json!(crate::encode64(hbb_common::get_uuid()));
|
||||||
}
|
let ab_name = Config::get_option("preset-address-book-name");
|
||||||
let ab_tag = Config::get_option("preset-address-book-tag");
|
if !ab_name.is_empty() {
|
||||||
if !ab_tag.is_empty() {
|
v["preset-address-book-name"] = json!(ab_name);
|
||||||
v["preset-address-book-tag"] = json!(ab_tag);
|
}
|
||||||
}
|
let ab_tag = Config::get_option("preset-address-book-tag");
|
||||||
match crate::post_request(url.replace("heartbeat", "sysinfo"), v.to_string(), "").await {
|
if !ab_tag.is_empty() {
|
||||||
Ok(x) => {
|
v["preset-address-book-tag"] = json!(ab_tag);
|
||||||
if x == "SYSINFO_UPDATED" {
|
}
|
||||||
info_uploaded = (true, url.clone(), None, id.clone());
|
match crate::post_request(url.replace("heartbeat", "sysinfo"), v.to_string(), "").await {
|
||||||
hbb_common::log::info!("sysinfo updated");
|
Ok(x) => {
|
||||||
*PRO.lock().unwrap() = true;
|
if x == "SYSINFO_UPDATED" {
|
||||||
} else if x == "ID_NOT_FOUND" {
|
info_uploaded = (true, url.clone(), None, id.clone());
|
||||||
info_uploaded.2 = None; // next heartbeat will upload sysinfo again
|
hbb_common::log::info!("sysinfo updated");
|
||||||
} else {
|
*PRO.lock().unwrap() = true;
|
||||||
|
} else if x == "ID_NOT_FOUND" {
|
||||||
|
info_uploaded.2 = None; // next heartbeat will upload sysinfo again
|
||||||
|
} else {
|
||||||
|
info_uploaded.2 = Some(Instant::now());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => {
|
||||||
info_uploaded.2 = Some(Instant::now());
|
info_uploaded.2 = Some(Instant::now());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {
|
|
||||||
info_uploaded.2 = Some(Instant::now());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if conns.is_empty() && last_sent.map(|x| x.elapsed() < TIME_HEARTBEAT).unwrap_or(false){
|
if conns.is_empty() && last_sent.map(|x| x.elapsed() < TIME_HEARTBEAT).unwrap_or(false) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
last_sent = Some(Instant::now());
|
last_sent = Some(Instant::now());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user