better peers formatting
This commit is contained in:
parent
29034e09d1
commit
c829a4b188
2 changed files with 14 additions and 2 deletions
|
@ -338,7 +338,7 @@ fn peers(peers: &[Peer], state: &mut ListState, area: Rect, buf: &mut Buffer) {
|
|||
fingerprint,
|
||||
} in peers
|
||||
{
|
||||
let item = format!("{:?}: {} ({})", addr, alias, fingerprint);
|
||||
let item = format!("{alias} ({addr:?}) -- {fingerprint}");
|
||||
let s = Line::from(item.yellow());
|
||||
let item = ListItem::new(s);
|
||||
items.push(item);
|
||||
|
|
14
src/lib.rs
14
src/lib.rs
|
@ -6,6 +6,7 @@ pub mod transfer;
|
|||
|
||||
use std::{
|
||||
collections::BTreeMap,
|
||||
fmt::Debug,
|
||||
net::{Ipv4Addr, SocketAddr, SocketAddrV4},
|
||||
sync::{Arc, OnceLock},
|
||||
};
|
||||
|
@ -51,13 +52,22 @@ pub enum TransferEvent {
|
|||
ReceiveRequest { id: Julid, request: ReceiveRequest },
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
#[derive(Clone)]
|
||||
pub struct ReceiveRequest {
|
||||
pub alias: String,
|
||||
pub files: BTreeMap<String, FileMetadata>,
|
||||
pub tx: UnboundedSender<ReceiveDialog>,
|
||||
}
|
||||
|
||||
impl Debug for ReceiveRequest {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.debug_struct("ReceiveRequest")
|
||||
.field("alias", &self.alias)
|
||||
.field("files", &self.files)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
/// Contains the main network and backend state for an application session.
|
||||
#[derive(Clone)]
|
||||
pub struct JocalService {
|
||||
|
@ -185,6 +195,7 @@ pub struct Config {
|
|||
pub multicast_addr: SocketAddrV4,
|
||||
pub port: u16,
|
||||
pub download_dir: String,
|
||||
pub local_ip_addr: SocketAddr,
|
||||
}
|
||||
|
||||
impl Default for Config {
|
||||
|
@ -195,6 +206,7 @@ impl Default for Config {
|
|||
multicast_addr: SocketAddrV4::new(MULTICAST_IP, DEFAULT_PORT),
|
||||
port: DEFAULT_PORT,
|
||||
download_dir: dd.to_string_lossy().into(),
|
||||
local_ip_addr: ([0u8; 4], DEFAULT_PORT).into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue