mirror of
https://github.com/aljazceru/njump.git
synced 2025-12-17 14:24:27 +01:00
client list rendering based on event kind, not code.
This commit is contained in:
12
utils.go
12
utils.go
@@ -98,7 +98,7 @@ type ClientReference struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func generateClientList(code string, event *nostr.Event) []ClientReference {
|
func generateClientList(code string, event *nostr.Event) []ClientReference {
|
||||||
if strings.HasPrefix(code, "nevent") || strings.HasPrefix(code, "note") {
|
if event.Kind == 1 || event.Kind == 6 {
|
||||||
return []ClientReference{
|
return []ClientReference{
|
||||||
{Name: "native client", URL: "nostr:" + code},
|
{Name: "native client", URL: "nostr:" + code},
|
||||||
{Name: "Snort", URL: "https://Snort.social/e/" + code},
|
{Name: "Snort", URL: "https://Snort.social/e/" + code},
|
||||||
@@ -111,7 +111,7 @@ func generateClientList(code string, event *nostr.Event) []ClientReference {
|
|||||||
{Name: "Nostr.band", URL: "https://nostr.band/" + code},
|
{Name: "Nostr.band", URL: "https://nostr.band/" + code},
|
||||||
{Name: "Highlighter", URL: "https://highlighter.com/a/" + code},
|
{Name: "Highlighter", URL: "https://highlighter.com/a/" + code},
|
||||||
}
|
}
|
||||||
} else if strings.HasPrefix(code, "npub") || strings.HasPrefix(code, "nprofile") {
|
} else if event.Kind == 0 {
|
||||||
return []ClientReference{
|
return []ClientReference{
|
||||||
{Name: "Your native client", URL: "nostr:" + code},
|
{Name: "Your native client", URL: "nostr:" + code},
|
||||||
{Name: "Nosta", URL: "https://nosta.me/" + code},
|
{Name: "Nosta", URL: "https://nosta.me/" + code},
|
||||||
@@ -125,7 +125,7 @@ func generateClientList(code string, event *nostr.Event) []ClientReference {
|
|||||||
{Name: "Nostr.band", URL: "https://nostr.band/" + code},
|
{Name: "Nostr.band", URL: "https://nostr.band/" + code},
|
||||||
{Name: "Highlighter", URL: "https://highlighter.com/p/" + event.PubKey},
|
{Name: "Highlighter", URL: "https://highlighter.com/p/" + event.PubKey},
|
||||||
}
|
}
|
||||||
} else if strings.HasPrefix(code, "naddr") {
|
} else if event.Kind == 30023 {
|
||||||
return []ClientReference{
|
return []ClientReference{
|
||||||
{Name: "Your native client", URL: "nostr:" + code},
|
{Name: "Your native client", URL: "nostr:" + code},
|
||||||
{Name: "YakiHonne", URL: "https://yakihonne.com/article/" + code},
|
{Name: "YakiHonne", URL: "https://yakihonne.com/article/" + code},
|
||||||
@@ -133,11 +133,9 @@ func generateClientList(code string, event *nostr.Event) []ClientReference {
|
|||||||
{Name: "Highlighter", URL: "https://highlighter.com/a/" + code},
|
{Name: "Highlighter", URL: "https://highlighter.com/a/" + code},
|
||||||
{Name: "Blogstack", URL: "https://blogstack.io/" + code},
|
{Name: "Blogstack", URL: "https://blogstack.io/" + code},
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return []ClientReference{
|
|
||||||
{Name: "native client", URL: "nostr:" + code},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func mergeMaps[K comparable, V any](m1 map[K]V, m2 map[K]V) map[K]V {
|
func mergeMaps[K comparable, V any](m1 map[K]V, m2 map[K]V) map[K]V {
|
||||||
|
|||||||
Reference in New Issue
Block a user