From 172221192f675102bb2ad67b1cc576ed45e570bd Mon Sep 17 00:00:00 2001 From: fufesou Date: Tue, 21 Mar 2023 13:21:00 +0800 Subject: [PATCH] better peer info Signed-off-by: fufesou --- src/server/connection.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/server/connection.rs b/src/server/connection.rs index 07c37b12c..4b65013a3 100644 --- a/src/server/connection.rs +++ b/src/server/connection.rs @@ -843,14 +843,15 @@ impl Connection { pi.hostname = DEVICE_NAME.lock().unwrap().clone(); pi.platform = "Android".into(); } - + let mut platform_additions = serde_json::Map::new(); #[cfg(target_os = "linux")] { - pi.platform_additions = format!(r#" - {{ - "is_wayland": {} - }} - "#, crate::platform::current_is_wayland()); + if crate::platform::current_is_wayland() { + platform_additions.insert("is_wayland".into(), json!(true)); + } + } + if !platform_additions.is_empty() { + pi.platform_additions = serde_json::to_string(&platform_additions).unwrap_or("".into()); } #[cfg(feature = "hwcodec")]