Skip to content

Commit

Permalink
Relay links now jump to your relay config page for that relay
Browse files Browse the repository at this point in the history
  • Loading branch information
mikedilger committed Sep 28, 2024
1 parent 906fede commit 26f5f1c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion gossip-bin/src/ui/feed/note/content.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use egui::{Button, Color32, Pos2, RichText, Stroke, Ui};
use gossip_lib::comms::ToOverlordMessage;
use gossip_lib::FeedKind;
use gossip_lib::GLOBALS;
use nostr_types::{ContentSegment, Id, IdHex, NAddr, NostrBech32, PublicKey, Span, Url};
use nostr_types::{ContentSegment, Id, IdHex, NAddr, NostrBech32, PublicKey, RelayUrl, Span, Url};
use std::{
cell::{Ref, RefCell},
rc::Rc,
Expand Down Expand Up @@ -204,6 +204,11 @@ pub(super) fn render_hyperlink(
) {
let link = note.shattered_content.slice(linkspan).unwrap();

if let Ok(relay_url) = RelayUrl::try_from_str(link) {
render_relay_link(app, ui, relay_url);
return;
}

// In DMs, fetching an image allows someone to associate your pubkey with your IP address
// by controlling the image URL, and since only you see the URL it must have been you
let privacy_issue = note.direct_message;
Expand Down Expand Up @@ -274,6 +279,12 @@ pub(super) fn render_profile_link(app: &mut GossipUi, ui: &mut Ui, pubkey: &Publ
};
}

pub fn render_relay_link(app: &mut GossipUi, ui: &mut Ui, relay_url: RelayUrl) {
if ui.link(relay_url.as_str()).clicked() {
app.set_page(ui.ctx(), Page::RelaysKnownNetwork(Some(relay_url)));
};
}

pub(super) fn render_event_link(
app: &mut GossipUi,
ui: &mut Ui,
Expand Down

0 comments on commit 26f5f1c

Please sign in to comment.