mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-03-22 04:31:00 +03:00
Refact/options (#9318)
* refact options Signed-off-by: fufesou <linlong1266@gmail.com> * Remove unused msg Signed-off-by: fufesou <linlong1266@gmail.com> * web, toggle virtual display Signed-off-by: fufesou <linlong1266@gmail.com> --------- Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
@@ -1800,28 +1800,6 @@ impl LoginConfigHandler {
|
||||
)
|
||||
}
|
||||
|
||||
pub fn get_option_message_after_login(&self) -> Option<OptionMessage> {
|
||||
if self.conn_type.eq(&ConnType::FILE_TRANSFER)
|
||||
|| self.conn_type.eq(&ConnType::PORT_FORWARD)
|
||||
|| self.conn_type.eq(&ConnType::RDP)
|
||||
{
|
||||
return None;
|
||||
}
|
||||
let mut n = 0;
|
||||
let mut msg = OptionMessage::new();
|
||||
if self.version < hbb_common::get_version_number("1.2.4") {
|
||||
if self.get_toggle_option("privacy-mode") {
|
||||
msg.privacy_mode = BoolOption::Yes.into();
|
||||
n += 1;
|
||||
}
|
||||
}
|
||||
if n > 0 {
|
||||
Some(msg)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
/// Parse the image quality option.
|
||||
/// Return [`ImageQuality`] if the option is valid, otherwise return `None`.
|
||||
///
|
||||
|
||||
@@ -958,22 +958,6 @@ impl<T: InvokeUiSession> Remote<T> {
|
||||
true
|
||||
}
|
||||
|
||||
async fn send_opts_after_login(&self, peer: &mut Stream) {
|
||||
if let Some(opts) = self
|
||||
.handler
|
||||
.lc
|
||||
.read()
|
||||
.unwrap()
|
||||
.get_option_message_after_login()
|
||||
{
|
||||
let mut misc = Misc::new();
|
||||
misc.set_option(opts);
|
||||
let mut msg_out = Message::new();
|
||||
msg_out.set_misc(misc);
|
||||
allow_err!(peer.send(&msg_out).await);
|
||||
}
|
||||
}
|
||||
|
||||
async fn send_toggle_virtual_display_msg(&self, peer: &mut Stream) {
|
||||
if !self.peer_info.is_support_virtual_display() {
|
||||
return;
|
||||
@@ -1135,7 +1119,6 @@ impl<T: InvokeUiSession> Remote<T> {
|
||||
self.first_frame = true;
|
||||
self.handler.close_success();
|
||||
self.handler.adapt_size();
|
||||
self.send_opts_after_login(peer).await;
|
||||
self.send_toggle_virtual_display_msg(peer).await;
|
||||
self.send_toggle_privacy_mode_msg(peer).await;
|
||||
}
|
||||
|
||||
@@ -802,13 +802,13 @@ impl InvokeUiSession for FlutterHandler {
|
||||
|
||||
fn set_peer_info(&self, pi: &PeerInfo) {
|
||||
let displays = Self::make_displays_msg(&pi.displays);
|
||||
let mut features: HashMap<&str, i32> = Default::default();
|
||||
let mut features: HashMap<&str, bool> = Default::default();
|
||||
for ref f in pi.features.iter() {
|
||||
features.insert("privacy_mode", if f.privacy_mode { 1 } else { 0 });
|
||||
features.insert("privacy_mode", f.privacy_mode);
|
||||
}
|
||||
// compatible with 1.1.9
|
||||
if get_version_number(&pi.version) < get_version_number("1.2.0") {
|
||||
features.insert("privacy_mode", 0);
|
||||
features.insert("privacy_mode", false);
|
||||
}
|
||||
let features = serde_json::ser::to_string(&features).unwrap_or("".to_owned());
|
||||
let resolutions = serialize_resolutions(&pi.resolutions.resolutions);
|
||||
|
||||
Reference in New Issue
Block a user