From 523bcbdb1f1e2ca43894e8d5b380178e90bd75be Mon Sep 17 00:00:00 2001 From: pythcoiner Date: Tue, 5 Nov 2024 04:44:29 +0100 Subject: [PATCH 1/3] gui(settings): add a copy button to auth fields --- liana-gui/src/app/state/settings/bitcoind.rs | 3 ++- liana-gui/src/app/view/message.rs | 1 + liana-gui/src/app/view/settings.rs | 9 ++++++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/liana-gui/src/app/state/settings/bitcoind.rs b/liana-gui/src/app/state/settings/bitcoind.rs index 9be01bb50..cd4f78b14 100644 --- a/liana-gui/src/app/state/settings/bitcoind.rs +++ b/liana-gui/src/app/state/settings/bitcoind.rs @@ -5,7 +5,7 @@ use std::str::FromStr; use std::sync::Arc; use chrono::{NaiveDate, Utc}; -use iced::Command; +use iced::{clipboard, Command}; use tracing::info; use liana::miniscript::bitcoin::Network; @@ -361,6 +361,7 @@ impl BitcoindSettings { }); } } + view::SettingsEditMessage::Clipboard(text) => return clipboard::write(text), }; Command::none() } diff --git a/liana-gui/src/app/view/message.rs b/liana-gui/src/app/view/message.rs index c726b5fc5..eb5ee1cbf 100644 --- a/liana-gui/src/app/view/message.rs +++ b/liana-gui/src/app/view/message.rs @@ -91,6 +91,7 @@ pub enum SettingsEditMessage { BitcoindRpcAuthTypeSelected(RpcAuthType), Cancel, Confirm, + Clipboard(String), } #[derive(Debug, Clone)] diff --git a/liana-gui/src/app/view/settings.rs b/liana-gui/src/app/view/settings.rs index 72d986e05..4cd920f8a 100644 --- a/liana-gui/src/app/view/settings.rs +++ b/liana-gui/src/app/view/settings.rs @@ -507,7 +507,14 @@ pub fn bitcoind<'a>( col_fields = col_fields.push( Row::new() .push(Container::new(text(k).bold().small()).width(Length::Fill)) - .push(text(v).small()), + .push(text(v.clone()).small()) + .push(Space::with_width(10)) + .push( + Button::new(icon::clipboard_icon()) + .style(theme::Button::TransparentBorder) + .on_press(SettingsEditMessage::Clipboard(v.to_string())), + ) + .align_items(Alignment::Center), ); } From 46cb154b94b69de87941dd61855e24545003e6cc Mon Sep 17 00:00:00 2001 From: pythcoiner Date: Mon, 18 Nov 2024 12:38:19 +0100 Subject: [PATCH 2/3] gui(settings): replace node password by stars(*) --- liana-gui/src/app/view/settings.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/liana-gui/src/app/view/settings.rs b/liana-gui/src/app/view/settings.rs index 4cd920f8a..272b54b77 100644 --- a/liana-gui/src/app/view/settings.rs +++ b/liana-gui/src/app/view/settings.rs @@ -504,18 +504,23 @@ pub fn bitcoind<'a>( let mut col_fields = Column::new(); for (k, v) in rows { - col_fields = col_fields.push( + col_fields = col_fields.push({ + let t = if k == "Password:" { + "*".to_string().repeat(v.len()) + } else { + v.clone() + }; Row::new() .push(Container::new(text(k).bold().small()).width(Length::Fill)) - .push(text(v.clone()).small()) + .push(text(t).small()) .push(Space::with_width(10)) .push( Button::new(icon::clipboard_icon()) .style(theme::Button::TransparentBorder) .on_press(SettingsEditMessage::Clipboard(v.to_string())), ) - .align_items(Alignment::Center), - ); + .align_items(Alignment::Center) + }); } card::simple(Container::new( From 9679f0f2926e2bc90ba7b8b61f138dcabaf22451 Mon Sep 17 00:00:00 2001 From: pythcoiner Date: Fri, 20 Dec 2024 10:17:48 +0100 Subject: [PATCH 3/3] gui(settings): add a copy button for electrum server address --- liana-gui/src/app/state/settings/bitcoind.rs | 1 + liana-gui/src/app/view/settings.rs | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/liana-gui/src/app/state/settings/bitcoind.rs b/liana-gui/src/app/state/settings/bitcoind.rs index cd4f78b14..16d92953b 100644 --- a/liana-gui/src/app/state/settings/bitcoind.rs +++ b/liana-gui/src/app/state/settings/bitcoind.rs @@ -469,6 +469,7 @@ impl ElectrumSettings { }); } } + view::SettingsEditMessage::Clipboard(text) => return clipboard::write(text), _ => {} }; Command::none() diff --git a/liana-gui/src/app/view/settings.rs b/liana-gui/src/app/view/settings.rs index 272b54b77..39be3cf6d 100644 --- a/liana-gui/src/app/view/settings.rs +++ b/liana-gui/src/app/view/settings.rs @@ -697,7 +697,14 @@ pub fn electrum<'a>( col_fields = col_fields.push( Row::new() .push(Container::new(text(k).bold().small()).width(Length::Fill)) - .push(text(v).small()), + .push(text(v.clone()).small()) + .push(Space::with_width(10)) + .push( + Button::new(icon::clipboard_icon()) + .style(theme::Button::TransparentBorder) + .on_press(SettingsEditMessage::Clipboard(v.to_string())), + ) + .align_items(Alignment::Center), ); }