From 8ad86b01839fbc818db75090e43daa19a43526ac Mon Sep 17 00:00:00 2001 From: dr-frmr Date: Mon, 6 May 2024 16:35:36 -0600 Subject: [PATCH] feat: make icon, path optional for homepage adds --- kinode/packages/homepage/homepage/src/lib.rs | 24 +++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/kinode/packages/homepage/homepage/src/lib.rs b/kinode/packages/homepage/homepage/src/lib.rs index 744258ee..c6930c1a 100644 --- a/kinode/packages/homepage/homepage/src/lib.rs +++ b/kinode/packages/homepage/homepage/src/lib.rs @@ -19,8 +19,8 @@ enum HomepageRequest { /// the icon is a base64 encoded image. Add { label: String, - icon: String, - path: String, + icon: Option, + path: Option, widget: Option, }, Remove, @@ -29,9 +29,9 @@ enum HomepageRequest { #[derive(Serialize, Deserialize)] struct HomepageApp { package_name: String, - path: String, + path: Option, label: String, - base64_icon: String, + base64_icon: Option, widget: Option, } @@ -96,13 +96,15 @@ fn init(our: Address) { message.source().process.to_string(), HomepageApp { package_name: message.source().package().to_string(), - path: format!( - "/{}:{}:{}/{}", - message.source().process(), - message.source().package(), - message.source().publisher(), - path.strip_prefix('/').unwrap_or(&path) - ), + path: path.map(|path| { + format!( + "/{}:{}:{}/{}", + message.source().process(), + message.source().package(), + message.source().publisher(), + path.strip_prefix('/').unwrap_or(&path) + ) + }), label, base64_icon: icon, widget,