diff --git a/utils.go b/utils.go index 287b8e7..9f524f2 100644 --- a/utils.go +++ b/utils.go @@ -120,41 +120,41 @@ var kindNIPs = map[int]string{ type ClientReference struct { ID string Name string - URL string + URL template.URL } func generateClientList(code string, event *nostr.Event) []ClientReference { if event.Kind == 1 || event.Kind == 6 { return []ClientReference{ - {ID: "native", Name: "Your native client", URL: "nostr:" + code}, - {ID: "snort", Name: "Snort", URL: "https://Snort.social/e/" + code}, - {ID: "nostrudel", Name: "Nostrudel", URL: "https://nostrudel.ninja/#/n/" + code}, - {ID: "satellite", Name: "Satellite", URL: "https://satellite.earth/thread/" + event.ID}, - {ID: "coracle", Name: "Coracle", URL: "https://coracle.social/" + code}, - {ID: "primal", Name: "Primal", URL: "https://primal.net/thread/" + event.ID}, - {ID: "nostter", Name: "Nostter", URL: "https://nostter.vercel.app/" + code}, - {ID: "highlighter", Name: "Highlighter", URL: "https://highlighter.com/a/" + code}, - {ID: "iris", Name: "Iris", URL: "https://iris.to/" + code}, + {ID: "native", Name: "Your native client", URL: template.URL("nostr:" + code)}, + {ID: "snort", Name: "Snort", URL: template.URL("https://Snort.social/e/" + code)}, + {ID: "nostrudel", Name: "Nostrudel", URL: template.URL("https://nostrudel.ninja/#/n/" + code)}, + {ID: "satellite", Name: "Satellite", URL: template.URL("https://satellite.earth/thread/" + event.ID)}, + {ID: "coracle", Name: "Coracle", URL: template.URL("https://coracle.social/" + code)}, + {ID: "primal", Name: "Primal", URL: template.URL("https://primal.net/thread/" + event.ID)}, + {ID: "nostter", Name: "Nostter", URL: template.URL("https://nostter.vercel.app/" + code)}, + {ID: "highlighter", Name: "Highlighter", URL: template.URL("https://highlighter.com/a/" + code)}, + {ID: "iris", Name: "Iris", URL: template.URL("https://iris.to/" + code)}, } } else if event.Kind == 0 { return []ClientReference{ - {ID: "native", Name: "Your native client", URL: "nostr:" + code}, - {ID: "nosta", Name: "Nosta", URL: "https://nosta.me/" + code}, - {ID: "snort", Name: "Snort", URL: "https://snort.social/p/" + code}, - {ID: "satellite", Name: "Satellite", URL: "https://satellite.earth/@" + code}, - {ID: "coracle", Name: "Coracle", URL: "https://coracle.social/" + code}, - {ID: "primal", Name: "Primal", URL: "https://primal.net/profile/" + event.PubKey}, - {ID: "nostrudel", Name: "Nostrudel", URL: "https://nostrudel.ninja/#/u/" + code}, - {ID: "nostter", Name: "Nostter", URL: "https://nostter.vercel.app/" + code}, - {ID: "iris", Name: "Iris", URL: "https://iris.to/" + code}, + {ID: "native", Name: "Your native client", URL: template.URL("nostr:" + code)}, + {ID: "nosta", Name: "Nosta", URL: template.URL("https://nosta.me/" + code)}, + {ID: "snort", Name: "Snort", URL: template.URL("https://snort.social/p/" + code)}, + {ID: "satellite", Name: "Satellite", URL: template.URL("https://satellite.earth/@" + code)}, + {ID: "coracle", Name: "Coracle", URL: template.URL("https://coracle.social/" + code)}, + {ID: "primal", Name: "Primal", URL: template.URL("https://primal.net/profile/" + event.PubKey)}, + {ID: "nostrudel", Name: "Nostrudel", URL: template.URL("https://nostrudel.ninja/#/u/" + code)}, + {ID: "nostter", Name: "Nostter", URL: template.URL("https://nostter.vercel.app/" + code)}, + {ID: "iris", Name: "Iris", URL: template.URL("https://iris.to/" + code)}, } } else if event.Kind == 30023 || event.Kind == 30024 { return []ClientReference{ - {ID: "native", Name: "Your native client", URL: "nostr:" + code}, - {ID: "yakihonne", Name: "YakiHonne", URL: "https://yakihonne.com/article/" + code}, - {ID: "habla", Name: "Habla", URL: "https://habla.news/a/" + code}, - {ID: "highlighter", Name: "Highlighter", URL: "https://highlighter.com/a/" + code}, - {ID: "blogstack", Name: "Blogstack", URL: "https://blogstack.io/" + code}, + {ID: "native", Name: "Your native client", URL: template.URL("nostr:" + code)}, + {ID: "yakihonne", Name: "YakiHonne", URL: template.URL("https://yakihonne.com/article/" + code)}, + {ID: "habla", Name: "Habla", URL: template.URL("https://habla.news/a/" + code)}, + {ID: "highlighter", Name: "Highlighter", URL: template.URL("https://highlighter.com/a/" + code)}, + {ID: "blogstack", Name: "Blogstack", URL: template.URL("https://blogstack.io/" + code)}, } } return nil @@ -162,7 +162,7 @@ func generateClientList(code string, event *nostr.Event) []ClientReference { func generateRelayBrowserClientList(host string) []ClientReference { return []ClientReference{ - {ID: "coracle", Name: "Coracle", URL: "https://coracle.social/relays/" + host}, + {ID: "coracle", Name: "Coracle", URL: template.URL("https://coracle.social/relays/" + host)}, } }