From ae961f359b00f22d47ef55ef3b9b2d7ac006b778 Mon Sep 17 00:00:00 2001 From: Ali Mirjamali Date: Mon, 25 Aug 2025 18:05:24 +0330 Subject: [PATCH] Draft work on notification proxy (not ready for reveiw) Related: https://github.com/QubesOS/qubes-issues/issues/9648 --- .gitignore | 1 + src/bin/notification-proxy-client.rs | 5 ++++- src/bin/notification-proxy-server.rs | 14 ++++---------- src/lib.rs | 10 +++++----- 4 files changed, 14 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index ea8c4bf..96ef6c0 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /target +Cargo.lock diff --git a/src/bin/notification-proxy-client.rs b/src/bin/notification-proxy-client.rs index 0106740..8187f2b 100644 --- a/src/bin/notification-proxy-client.rs +++ b/src/bin/notification-proxy-client.rs @@ -102,7 +102,7 @@ impl Server { // Ignored. We pass an empty string. _app_name: &str, replaces_id: u32, - _app_icon: String, + app_icon: String, summary: String, body: String, actions: Vec, @@ -119,6 +119,9 @@ impl Server { let mut urgency = None; let mut resident = false; let mut category = None; + if !app_icon.is_empty() { + eprintln!("app_icon parameter is not yet supported") + } for (i, j) in hints.into_iter() { match &*i { "action-icons" => {} diff --git a/src/bin/notification-proxy-server.rs b/src/bin/notification-proxy-server.rs index 181f486..4c11646 100644 --- a/src/bin/notification-proxy-server.rs +++ b/src/bin/notification-proxy-server.rs @@ -43,16 +43,10 @@ async fn client_server(qube_name: String) { .expect("Cannot read reply") .to_le(); let (reply_major, reply_minor) = notification_emitter::split_version(reply_version); - if reply_major != MAJOR_VERSION { + if reply_major != MAJOR_VERSION || reply_minor > MINOR_VERSION { panic!( - "Version mismatch: client supports version {reply_major} \ - but the version supported by this server is {MAJOR_VERSION}" - ); - } - if reply_minor > MINOR_VERSION { - panic!( - "Version mismatch: client supports version {reply_minor} \ -but this server only supports version {MINOR_VERSION}" + "Version mismatch: client supports version {reply_major}.{reply_minor} \ +but this server only supports version {MAJOR_VERSION}.{MINOR_VERSION}" ); } let stdout = MessageWriter::new(); @@ -164,7 +158,7 @@ but this server only supports version {MINOR_VERSION}" } }) .expect("Serialization failed?"); - stdout.transmit(&*data).await + stdout.transmit(&*data).await; }); } } diff --git a/src/lib.rs b/src/lib.rs index 1282396..9b13a73 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -122,8 +122,8 @@ pub enum Urgency { } pub const MAX_SIZE: usize = 1usize << 21; // This is 2MiB, more than enough -pub const MAX_WIDTH: i32 = 255; -pub const MAX_HEIGHT: i32 = 255; +pub const MAX_WIDTH: i32 = 256; +pub const MAX_HEIGHT: i32 = 256; pub const MAJOR_VERSION: u16 = 1; pub const MINOR_VERSION: u16 = 0; @@ -630,15 +630,15 @@ impl NotificationEmitter { // sanitize end hints.insert("category", Value::from(category)); } - // Temporarily disabled due to lack of image processing - if false { + // Temporarily enable to work on image processing + // if false { if let Some(image) = image { match serialize_image(image) { Ok(value) => hints.insert("image-data", value), Err(e) => return Err(zbus::Error::MissingParameter(e)), }; } - } + // } let mut escaped_body; if self.body_markup() { let body = sanitize_str(&*untrusted_body);