From cb5855a2730e41ae3c5c899a0182bc2059248253 Mon Sep 17 00:00:00 2001 From: rustdesk Date: Thu, 26 Jan 2023 11:25:05 +0800 Subject: [PATCH] fix issue #2921 --- src/ui_interface.rs | 2 +- src/ui_session_interface.rs | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ui_interface.rs b/src/ui_interface.rs index ebaf8c317..403951eaa 100644 --- a/src/ui_interface.rs +++ b/src/ui_interface.rs @@ -236,7 +236,7 @@ pub fn set_peer_option(id: String, name: String, value: String) { #[inline] pub fn using_public_server() -> bool { - option_env!("RENDEZVOUS_SERVER").is_none() + option_env!("RENDEZVOUS_SERVER").unwrap_or("").is_empty() && crate::get_custom_rendezvous_server(get_option_("custom-rendezvous-server")).is_empty() } diff --git a/src/ui_session_interface.rs b/src/ui_session_interface.rs index 3fb3f2621..48f6c1090 100644 --- a/src/ui_session_interface.rs +++ b/src/ui_session_interface.rs @@ -6,10 +6,11 @@ use crate::client::{ }; use crate::common::{self, GrabState}; use crate::keyboard; +use crate::ui_interface::using_public_server; use crate::{client::Data, client::Interface}; use async_trait::async_trait; use bytes::Bytes; -use hbb_common::config::{Config, LocalConfig, PeerConfig}; +use hbb_common::config::{Config, LocalConfig, PeerConfig, RS_PUB_KEY}; use hbb_common::rendezvous_proto::ConnType; use hbb_common::tokio::{self, sync::mpsc}; use hbb_common::{allow_err, message_proto::*}; @@ -835,6 +836,9 @@ pub async fn io_loop(handler: Session) { if key.is_empty() { key = crate::platform::get_license_key(); } + if key.is_empty() && !option_env!("RENDEZVOUS_SERVER").unwrap_or("").is_empty() { + key = RS_PUB_KEY.to_owned(); + } #[cfg(not(any(target_os = "android", target_os = "ios")))] if handler.is_port_forward() { if handler.is_rdp() {