Skip to content

Commit 0114657

Browse files
committed
prepare no-register-device
1 parent 3915153 commit 0114657

4 files changed

Lines changed: 7 additions & 3 deletions

File tree

src/core_main.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,9 @@ pub fn core_main() -> Option<Vec<String>> {
454454
}
455455
return None;
456456
} else if args[0] == "--assign" {
457-
if crate::platform::is_installed() && is_root() {
457+
if config::Config::no_register_device() {
458+
println!("Cannot assign an unregistrable device!");
459+
} else if crate::platform::is_installed() && is_root() {
458460
let max = args.len() - 1;
459461
let pos = args.iter().position(|x| x == "--token").unwrap_or(max);
460462
if pos < max {

src/hbbs_http/sync.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ async fn start_hbbs_sync_async() {
127127
// Though the username comparison is only necessary on Windows,
128128
// we still keep the comparison on other platforms for consistency.
129129
let need_upload = (!info_uploaded.uploaded || info_uploaded.username.as_ref() != Some(&sys_username)) &&
130-
info_uploaded.last_uploaded.map(|x| x.elapsed() >= UPLOAD_SYSINFO_TIMEOUT).unwrap_or(true);
130+
info_uploaded.last_uploaded.map(|x| x.elapsed() >= UPLOAD_SYSINFO_TIMEOUT).unwrap_or(true)
131+
&& !Config::no_register_device();
131132
if need_upload {
132133
v["version"] = json!(crate::VERSION);
133134
v["id"] = json!(id);

src/rendezvous_mediator.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,7 @@ impl RendezvousMediator {
568568
id,
569569
uuid: uuid.into(),
570570
pk: pk.into(),
571+
no_register_device: Config::no_register_device(),
571572
..Default::default()
572573
});
573574
socket.send(&msg_out).await?;

0 commit comments

Comments
 (0)