damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit b688fa98a5498ebd7d27e59d8709af10e7b88ce2
parent 61a451184b19f9f38c1cd0b75a6d6e117d65144c
Author: Joel Klabo <joelklabo@gmail.com>
Date:   Thu,  5 Jan 2023 15:04:21 -0800

Allow Adding Relay Without wss:// Prefix

Closes: #261
Changelog-Added: Allow Adding Relay Without wss:// Prefix

Diffstat:
Mdamus/Views/ConfigView.swift | 12++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/damus/Views/ConfigView.swift b/damus/Views/ConfigView.swift @@ -134,14 +134,18 @@ struct ConfigView: View { } .sheet(isPresented: $show_add_relay) { AddRelayView(show_add_relay: $show_add_relay, relay: $new_relay) { m_relay in - guard let relay = m_relay else { + guard var relay = m_relay else { return } + if relay.starts(with: "wss://") == false { + relay = "wss://" + relay + } + guard let url = URL(string: relay) else { return } - + guard let ev = state.contacts.event else { return } @@ -156,9 +160,9 @@ struct ConfigView: View { return } - state.pool.connect(to: [new_relay]) + state.pool.connect(to: [relay]) - guard let new_ev = add_relay(ev: ev, privkey: privkey, current_relays: state.pool.descriptors, relay: new_relay, info: info) else { + guard let new_ev = add_relay(ev: ev, privkey: privkey, current_relays: state.pool.descriptors, relay: relay, info: info) else { return }