[verified] feat(tui): drop unicode QR, share onionwire:v1 invite
Some checks failed
ci / test (push) Has been cancelled

F2 shows the invite string with fp/onion hints instead of a terminal QR.
Keep encode/decode and F3 paste; drop the qrcode crate.
This commit is contained in:
Sirius DevOps 2026-09-10 16:53:03 -04:00
commit 4fb47444d5
No known key found for this signature in database
9 changed files with 64 additions and 55 deletions

View file

@ -27,7 +27,7 @@ pub fn rotate_screen_text() -> &'static str {
"Rotate onion address?\n\
Your identity key stays the same.\n\
Online friends get a signed location update.\n\
Offline friends CANNOT find you until they rescan your QR.\n\
Offline friends CANNOT find you until they F3-paste your new invite.\n\
Type ROTATE to confirm Esc to cancel"
}
@ -61,8 +61,8 @@ OnionWire keys\n\
g / G jump to top / bottom\n\
Enter /wipe /wipe-all /profile /who /pay /tip\n\
Esc close overlay, go back, clear composer\n\
F2 share QR\n\
F3 paste a friend QR\n\
F2 share invite\n\
F3 paste invite\n\
F4 rotate onion locator\n\
F5 selected friend's profile (/who)\n\
/profile edit name, bio, Monero address\n\
@ -528,7 +528,6 @@ struct App {
enum Screen {
Main,
Share {
art: String,
payload: String,
},
Paste {
@ -981,8 +980,7 @@ impl App {
fn open_share(&mut self) -> Result<(), String> {
let payload = self.node.qr_payload()?;
let art = qr::render_unicode(&payload).map_err(|e| e.to_string())?;
self.screen = Screen::Share { art, payload };
self.screen = Screen::Share { payload };
Ok(())
}
@ -1090,7 +1088,7 @@ impl App {
fn draw(&self, f: &mut Frame) {
match &self.screen {
Screen::Main => self.draw_main(f),
Screen::Share { art, payload } => draw_share(f, art, payload),
Screen::Share { payload } => draw_share(f, payload),
Screen::Paste { buf, err } => draw_paste(f, buf, err.as_deref()),
Screen::Approve { payload } => draw_approve(f, payload),
Screen::Rotate { prompt } => draw_rotate(f, prompt.typed()),
@ -1244,7 +1242,7 @@ impl App {
fn chat_lines(&self) -> Vec<String> {
let Some(friend) = self.friends.get(self.selected) else {
return vec!["no friends yet".into(), "F3 paste a QR to add one".into()];
return vec!["no friends yet".into(), "F3 paste an invite to add one".into()];
};
match self.node.list_messages(&friend.pubkey) {
Ok(msgs) if msgs.is_empty() => vec!["no messages".into()],
@ -1355,14 +1353,19 @@ fn themed_block(title: &str) -> Block<'_> {
.title_style(Style::default().fg(C_ACCENT).add_modifier(Modifier::BOLD))
}
fn draw_share(f: &mut Frame, art: &str, payload: &str) {
let glyph = onion_glyph();
let body = format!("{glyph}\n\n{art}\n{payload}\n\nEsc back");
pub fn draw_share(f: &mut Frame, payload: &str) {
let (fp, onion) = match qr::decode(payload) {
Ok(p) => (truncate_fp(&to_hex(&p.pubkey)), p.onion),
Err(_) => ("?".into(), "?".into()),
};
let body = format!(
"give this string to a friend; they F3 paste it\n\nfp {fp}\nonion {onion}\n\n{payload}"
);
f.render_widget(
Paragraph::new(body)
.style(Style::default().fg(C_TEXT))
.wrap(Wrap { trim: false })
.block(themed_block("(o) share")),
.block(themed_block("(o) invite")),
f.area(),
);
}
@ -1379,7 +1382,7 @@ fn draw_paste(f: &mut Frame, buf: &str, err: Option<&str>) {
Paragraph::new(body)
.style(style)
.wrap(Wrap { trim: false })
.block(themed_block("(o) paste QR")),
.block(themed_block("(o) paste invite")),
f.area(),
);
}