From 8621b9343619ad50a696673ab801f0307558bf12 Mon Sep 17 00:00:00 2001 From: rustdesk Date: Sat, 6 Jul 2024 23:10:50 +0800 Subject: [PATCH] add display-name option for https://github.com/rustdesk/rustdesk-server-pro/issues/277 --- libs/hbb_common/src/config.rs | 4 ++++ src/client.rs | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/libs/hbb_common/src/config.rs b/libs/hbb_common/src/config.rs index 711d5af37..88a24d1b3 100644 --- a/libs/hbb_common/src/config.rs +++ b/libs/hbb_common/src/config.rs @@ -2122,6 +2122,8 @@ pub mod keys { pub const OPTION_DISABLE_GROUP_PANEL: &str = "disable-group-panel"; pub const OPTION_PRE_ELEVATE_SERVICE: &str = "pre-elevate-service"; + pub const OPTION_DISPLAY_NAME: &str = "display-name"; + // proxy settings // The following options are not real keys, they are just used for custom client advanced settings. // The real keys are in Config2::socks. @@ -2185,6 +2187,8 @@ pub mod keys { OPTION_KEEP_SCREEN_ON, OPTION_DISABLE_GROUP_PANEL, OPTION_PRE_ELEVATE_SERVICE, + OPTION_DISPLAY_NAME, + "remove-preset-password-warning", ]; // DEFAULT_SETTINGS, OVERWRITE_SETTINGS pub const KEYS_SETTINGS: &[&str] = &[ diff --git a/src/client.rs b/src/client.rs index c3fe10688..4c3f53b03 100644 --- a/src/client.rs +++ b/src/client.rs @@ -2019,11 +2019,15 @@ impl LoginConfigHandler { } else { (my_id, self.id.clone()) }; + let mut display_name = LocalConfig::get_option(&config::keys::OPTION_DISPLAY_NAME); + if display_name.is_empty() { + display_name = crate::username(); + } let mut lr = LoginRequest { username: pure_id, password: password.into(), my_id, - my_name: crate::username(), + my_name: display_name, option: self.get_option_message(true).into(), session_id: self.session_id, version: crate::VERSION.to_string(),