mirror of
https://github.com/aljazceru/njump.git
synced 2025-12-19 07:14:24 +01:00
use a static type for client urls.
This commit is contained in:
@@ -35,8 +35,8 @@
|
|||||||
<div class="clients_wrapper">
|
<div class="clients_wrapper">
|
||||||
{{range .clients}}
|
{{range .clients}}
|
||||||
<div class="btn">
|
<div class="btn">
|
||||||
<a class="client" href="{{.url}}"
|
<a class="client" href="{{.URL}}"
|
||||||
><span>Open {{.type}} in</span> {{.name}}</a
|
><span>Open {{.type}} in</span> {{.Name}}</a
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|||||||
66
utils.go
66
utils.go
@@ -92,43 +92,49 @@ var kindNIPS = map[int]string{
|
|||||||
30078: "78",
|
30078: "78",
|
||||||
}
|
}
|
||||||
|
|
||||||
func generateClientList(code string, event *nostr.Event) []map[string]string {
|
type ClientReference struct {
|
||||||
|
Name string
|
||||||
|
URL string
|
||||||
|
}
|
||||||
|
|
||||||
|
func generateClientList(code string, event *nostr.Event) []ClientReference {
|
||||||
if strings.HasPrefix(code, "nevent") || strings.HasPrefix(code, "note") {
|
if strings.HasPrefix(code, "nevent") || strings.HasPrefix(code, "note") {
|
||||||
return []map[string]string{
|
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},
|
||||||
{"name": "Coracle", "url": "https://coracle.social/" + code},
|
{Name: "Coracle", URL: "https://coracle.social/" + code},
|
||||||
{"name": "Satellite", "url": "https://satellite.earth/thread/" + event.ID},
|
{Name: "Satellite", URL: "https://satellite.earth/thread/" + event.ID},
|
||||||
{"name": "Iris", "url": "https://iris.to/" + code},
|
{Name: "Iris", URL: "https://iris.to/" + code},
|
||||||
{"name": "Yosup", "url": "https://yosup.app/thread/" + event.ID},
|
{Name: "Yosup", URL: "https://yosup.app/thread/" + event.ID},
|
||||||
{"name": "Nostr.band", "url": "https://nostr.band/" + code},
|
{Name: "Nostr.band", URL: "https://nostr.band/" + code},
|
||||||
{"name": "Primal", "url": "https://primal.net/thread/" + event.ID},
|
{Name: "Primal", URL: "https://primal.net/thread/" + event.ID},
|
||||||
{"name": "Nostribe", "url": "https://www.nostribe.com/post/" + event.ID},
|
{Name: "Nostribe", URL: "https://www.nostribe.com/post/" + event.ID},
|
||||||
{"name": "Nostrid", "url": "https://web.nostrid.app/note/" + event.ID},
|
{Name: "Nostrid", URL: "https://web.nostrid.app/note/" + event.ID},
|
||||||
}
|
}
|
||||||
} else if strings.HasPrefix(code, "npub") || strings.HasPrefix(code, "nprofile") {
|
} else if strings.HasPrefix(code, "npub") || strings.HasPrefix(code, "nprofile") {
|
||||||
return []map[string]string{
|
return []ClientReference{
|
||||||
{"name": "Your native client", "url": "nostr:" + code},
|
{Name: "Your native client", URL: "nostr:" + code},
|
||||||
{"name": "Snort", "url": "https://snort.social/p/" + code},
|
{Name: "Nosta", URL: "https://nosta.me/" + code},
|
||||||
{"name": "Coracle", "url": "https://coracle.social/" + code},
|
{Name: "Snort", URL: "https://snort.social/p/" + code},
|
||||||
{"name": "Satellite", "url": "https://satellite.earth/@" + code},
|
{Name: "Coracle", URL: "https://coracle.social/" + code},
|
||||||
{"name": "Iris", "url": "https://iris.to/" + code},
|
{Name: "Satellite", URL: "https://satellite.earth/@" + code},
|
||||||
{"name": "Yosup", "url": "https://yosup.app/profile/" + event.PubKey},
|
{Name: "Iris", URL: "https://iris.to/" + code},
|
||||||
{"name": "Nostr.band", "url": "https://nostr.band/" + code},
|
{Name: "Yosup", URL: "https://yosup.app/profile/" + event.PubKey},
|
||||||
{"name": "Primal", "url": "https://primal.net/profile/" + event.PubKey},
|
{Name: "Nostr.band", URL: "https://nostr.band/" + code},
|
||||||
{"name": "Nostribe", "url": "https://www.nostribe.com/profile/" + event.PubKey},
|
{Name: "Primal", URL: "https://primal.net/profile/" + event.PubKey},
|
||||||
{"name": "Nostrid", "url": "https://web.nostrid.app/account/" + event.PubKey},
|
{Name: "Nostribe", URL: "https://www.nostribe.com/profile/" + event.PubKey},
|
||||||
|
{Name: "Nostrid", URL: "https://web.nostrid.app/account/" + event.PubKey},
|
||||||
}
|
}
|
||||||
} else if strings.HasPrefix(code, "naddr") {
|
} else if strings.HasPrefix(code, "naddr") {
|
||||||
return []map[string]string{
|
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},
|
||||||
{"name": "Habla", "url": "https://habla.news/a/" + code},
|
{Name: "Habla", URL: "https://habla.news/a/" + code},
|
||||||
{"name": "Blogstack", "url": "https://blogstack.io/" + code},
|
{Name: "Blogstack", URL: "https://blogstack.io/" + code},
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return []map[string]string{
|
return []ClientReference{
|
||||||
{"name": "native client", "url": "nostr:" + code},
|
{Name: "native client", URL: "nostr:" + code},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user