diff options
author | sommerfeld <sommerfeld@sommerfeld.dev> | 2024-07-05 15:23:53 +0100 |
---|---|---|
committer | sommerfeld <sommerfeld@sommerfeld.dev> | 2024-07-05 15:30:41 +0100 |
commit | 8c52d1f31ac6066e178de994fec42a11ce018fde (patch) | |
tree | 3081d3bb7e8ce0dccbbef1ffb96f8d56827351a0 /src/main.rs | |
parent | db13ee769d674d9fd8b30e79dca974ff93c018c4 (diff) | |
download | viewercount-8c52d1f31ac6066e178de994fec42a11ce018fde.tar.gz viewercount-8c52d1f31ac6066e178de994fec42a11ce018fde.tar.bz2 viewercount-8c52d1f31ac6066e178de994fec42a11ce018fde.zip |
Print QRcode for nostrconnect URI
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs index dcd28e6..dfbbc25 100644 --- a/src/main.rs +++ b/src/main.rs @@ -26,6 +26,7 @@ use nostr_sdk::{ use nostr_signer::{Nip46Signer, NostrSigner}; #[cfg(any(target_os = "linux", target_os = "android"))] use procfs::net::TcpState; +use qrcode::{render::unicode, QrCode}; use serde::{Deserialize, Serialize}; use serde_json::{from_reader, to_string}; #[cfg(unix)] @@ -94,6 +95,13 @@ impl ClientData { println!( "Use your NIP46 signer app (e.g. Amber) to connect by using this URI:\n{uri}" ); + let code = QrCode::new(uri.clone()).unwrap(); + let image = code + .render::<unicode::Dense1x2>() + .dark_color(unicode::Dense1x2::Light) + .light_color(unicode::Dense1x2::Dark) + .build(); + println!("{}", image); uri } }; |