v0.0.24: ETH display in TUI header/messages, web peer resolve, click-focus

TUI:
- Header shows peer ETH address (resolved on /peer set)
- Own messages show ETH format
- Resolve display shows full formatted fingerprint (xxxx:xxxx:...)
- peer_eth field stored on App for header display

Web:
- Pasting 0x address in peer input box now resolves via /v1/resolve/
- Send path resolves 0x/@ before encrypting
- Click messages area → focuses text input
- Own messages show ETH format

Version: 0.0.23 → 0.0.24, SW cache wz-v4 → wz-v5
Build script: --local, --local-ship, --local-clean commands

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Siavash Sameni
2026-03-29 09:04:37 +04:00
parent ea04405199
commit 1851728a09
7 changed files with 43 additions and 20 deletions

View File

@@ -371,6 +371,8 @@ impl App {
if text.starts_with("/peer ") || text.starts_with("/p ") {
let text = if text.starts_with("/p ") { format!("/peer {}", &text[3..]) } else { text.clone() };
let raw = text[6..].trim().to_string();
let is_eth_input = raw.starts_with("0x") || raw.starts_with("0X");
let eth_input = if is_eth_input { Some(raw.clone()) } else { None };
let fp = if raw.starts_with('@') {
match self.resolve_alias(&raw[1..], client).await {
Some(resolved) => resolved,
@@ -389,9 +391,22 @@ impl App {
self.add_message(ChatLine { sender: "system".into(), text: "Cannot set yourself as peer".into(), is_system: true, is_self: false, message_id: None, timestamp: Local::now() });
return;
}
// Resolve peer ETH for display
if is_eth_input {
self.peer_eth = eth_input;
} else {
// Try to look up ETH for this fingerprint
let resolve_url = format!("{}/v1/resolve/{}", client.base_url, normfp(&fp));
if let Ok(resp) = client.client.get(&resolve_url).send().await {
if let Ok(data) = resp.json::<serde_json::Value>().await {
self.peer_eth = data.get("eth_address").and_then(|v| v.as_str()).map(String::from);
}
}
}
let display = self.peer_eth.as_deref().unwrap_or(&fp);
self.add_message(ChatLine {
sender: "system".into(),
text: format!("Peer set to {}", fp),
text: format!("Peer set to {}", display),
is_system: true,
is_self: false,
message_id: None, timestamp: Local::now(),
@@ -938,7 +953,11 @@ impl App {
Ok(resp) => {
if let Ok(data) = resp.json::<serde_json::Value>().await {
if let Some(fp) = data.get("fingerprint").and_then(|v| v.as_str()) {
self.add_message(ChatLine { sender: "system".into(), text: format!("{} → {}", addr, &fp[..fp.len().min(16)]), is_system: true, is_self: false, message_id: None, timestamp: Local::now() });
// Format fingerprint with colons: xxxx:xxxx:xxxx:...
let formatted: String = fp.chars().enumerate()
.flat_map(|(i, c)| if i > 0 && i % 4 == 0 { vec![':', c] } else { vec![c] })
.collect();
self.add_message(ChatLine { sender: "system".into(), text: format!("{} → {}", addr, formatted), is_system: true, is_self: false, message_id: None, timestamp: Local::now() });
return Some(fp.to_string());
}
if let Some(err) = data.get("error") {