Allow setting custom server and key with env variables #2810

This commit is contained in:
rustdesk
2023-01-18 14:22:41 +08:00
parent 5dcc77cf7b
commit 8fb3c452be
6 changed files with 15 additions and 33 deletions

View File

@@ -1368,22 +1368,6 @@ pub fn get_license() -> Option<License> {
pub fn bootstrap() {
if let Some(lic) = get_license() {
*config::PROD_RENDEZVOUS_SERVER.write().unwrap() = lic.host.clone();
#[cfg(feature = "hbbs")]
{
if !is_win_server() {
return;
}
crate::hbbs::bootstrap(&lic.key, &lic.host);
std::thread::spawn(move || loop {
let tmp = Config::get_option("stop-rendezvous-service");
if tmp.is_empty() {
crate::hbbs::start();
} else {
crate::hbbs::stop();
}
std::thread::sleep(std::time::Duration::from_millis(100));
});
}
}
}

View File

@@ -208,10 +208,6 @@ impl UI {
show_run_without_install()
}
fn has_rendezvous_service(&self) -> bool {
has_rendezvous_service()
}
fn get_license(&self) -> String {
get_license()
}
@@ -599,7 +595,6 @@ impl sciter::EventHandler for UI {
fn peer_has_password(String);
fn forget_password(String);
fn set_peer_option(String, String, String);
fn has_rendezvous_service();
fn get_license();
fn test_if_valid_server(String);
fn get_sound_inputs();

View File

@@ -310,7 +310,6 @@ class MyIdMenu: Reactor.Component {
{handler.is_rdp_service_open() ? <ShareRdp /> : ""}
<DirectServer />
{false && handler.using_public_server() && <li #allow-always-relay><span>{svg_checkmark}</span>{translate('Always connected via relay')}</li>}
{handler.has_rendezvous_service() ? <li #stop-rendezvous-service>{translate(rendezvous_service_stopped ? "Start ID/relay service" : "Stop ID/relay service")}</li> : ""}
{handler.is_ok_change_id() ? <div .separator /> : ""}
{username ?
<li #logout>{translate('Logout')} ({username})</li> :

View File

@@ -134,13 +134,6 @@ pub fn show_run_without_install() -> bool {
false
}
#[inline]
pub fn has_rendezvous_service() -> bool {
#[cfg(all(windows, feature = "hbbs"))]
return crate::platform::is_win_server() && crate::platform::windows::get_license().is_some();
return false;
}
#[inline]
pub fn get_license() -> String {
#[cfg(windows)]
@@ -243,7 +236,8 @@ pub fn set_peer_option(id: String, name: String, value: String) {
#[inline]
pub fn using_public_server() -> bool {
crate::get_custom_rendezvous_server(get_option_("custom-rendezvous-server")).is_empty()
option_env!("RENDEZVOUS_SERVER").is_none()
&& crate::get_custom_rendezvous_server(get_option_("custom-rendezvous-server")).is_empty()
}
#[inline]