An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.
Rust androidanydeskdartflatpakflutterflutter-appsioslinuxmacosp2prdpremote-controlremote-desktoprustrust-langteamviewervncwaylandwindows
remove deserializing config option using default config (#7491)
21pages96e1b5b0f6a0
diff --git a/libs/hbb_common/src/config.rs b/libs/hbb_common/src/config.rsindex cb673a22e..5af811047 100644--- a/libs/hbb_common/src/config.rs+++ b/libs/hbb_common/src/config.rs@@ -317,7 +317,11 @@ pub struct PeerConfig {pub custom_resolutions: HashMap<String, Resolution>,// The other scalar value must before this- #[serde(default, deserialize_with = "PeerConfig::deserialize_options")]+ #[serde(+ default,+ deserialize_with = "deserialize_hashmap_string_string",+ skip_serializing_if = "HashMap::is_empty"+ )]pub options: HashMap<String, String>, // not use delete to represent default values// Various data for flutter ui#[serde(default, deserialize_with = "deserialize_hashmap_string_string")]@@ -1230,22 +1234,8 @@ impl PeerConfig {}}- fn deserialize_options<'de, D>(deserializer: D) -> Result<HashMap<String, String>, D::Error>- where- D: de::Deserializer<'de>,- {- let mut mp: HashMap<String, String> = de::Deserialize::deserialize(deserializer)?;- Self::insert_default_options(&mut mp);- Ok(mp)- }-fn default_options() -> HashMap<String, String> {let mut mp: HashMap<String, String> = Default::default();- Self::insert_default_options(&mut mp);- return mp;- }-- fn insert_default_options(mp: &mut HashMap<String, String>) {["codec-preference","custom-fps",@@ -1255,10 +1245,9 @@ impl PeerConfig {"swap-left-right-mouse",].map(|key| {- if !mp.contains_key(key) {- mp.insert(key.to_owned(), UserDefaultConfig::read(key));- }+ mp.insert(key.to_owned(), UserDefaultConfig::read(key));});+ mp}}diff --git a/src/client.rs b/src/client.rsindex e03b765b2..875b4a594 100644--- a/src/client.rs+++ b/src/client.rs@@ -1481,12 +1481,7 @@ impl LoginConfigHandler {.map(|o| !o.is_empty()).unwrap_or(false);if is_set {- if name == "zoom-cursor" {- self.config.options.insert(name, "".to_owned());- } else {- // Notice: When PeerConfig loads, the default value is taken when the option key does not exist.- self.config.options.remove(&name);- }+ self.config.options.remove(&name);} else {self.config.options.insert(name, "Y".to_owned());}