diff --git a/src/relay.rs b/src/relay.rs index e61532a76..102c8e718 100644 --- a/src/relay.rs +++ b/src/relay.rs @@ -113,15 +113,3 @@ impl Relay { Ok(None) } } - -/** - * Static helper functions - */ -impl Relay { - pub fn domain_from_relay_url(relay: &RelayUrl) -> &str /* domain */ { - let domain = relay.0.trim_start_matches("wss://"); - let domain = domain.trim_start_matches("ws://"); - let domain = domain.trim_end_matches('/'); - domain - } -} diff --git a/src/ui/relays/coverage.rs b/src/ui/relays/coverage.rs index 298d74abe..021971f13 100644 --- a/src/ui/relays/coverage.rs +++ b/src/ui/relays/coverage.rs @@ -4,7 +4,6 @@ use nostr_types::{PublicKey, RelayUrl}; use crate::{ comms::ToOverlordMessage, globals::GLOBALS, - relay::Relay, ui::{ widgets::{ self, @@ -107,7 +106,7 @@ impl<'a> CoverageEntry<'a> { let relays_string = self .relays .iter() - .map(|rurl| Relay::domain_from_relay_url(rurl).to_string()) + .map(|rurl| rurl.domain()) .collect::>() .join(", "); draw_text_at(ui, pos, relays_string.into(), Align::LEFT, None, None); diff --git a/src/ui/widgets/relay_entry.rs b/src/ui/widgets/relay_entry.rs index 10cb645a5..55726100f 100644 --- a/src/ui/widgets/relay_entry.rs +++ b/src/ui/widgets/relay_entry.rs @@ -222,8 +222,8 @@ impl RelayEntry { impl RelayEntry { fn paint_title(&self, ui: &mut Ui, rect: &Rect) { - let title = Relay::domain_from_relay_url(&self.relay.url); - let mut title = safe_truncate(title, TITLE_MAX_LEN).to_string(); + let title = self.relay.url.domain(); + let mut title = safe_truncate(&title, TITLE_MAX_LEN).to_string(); if self.relay.url.0.len() > TITLE_MAX_LEN { title.push('\u{2026}'); // append ellipsis }