From a7325ea79590d2464bb08d29e3d2958ba023900d Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Sun, 7 Jan 2024 21:18:53 -0300 Subject: [PATCH] multiple fixes and adjustments until it compiles and runs. --- archive.templ | 6 +- clients.go | 80 ++++++++++----------- clients.templ | 7 +- data.go | 16 +++-- details.templ | 4 +- embedded_note.templ | 6 +- embedded_profile.templ | 12 ++-- error.templ | 2 +- head_common.templ | 4 +- homepage.templ | 24 +++---- live_event.templ | 11 +-- main.go | 1 - oembed.go | 2 +- opengraph.templ | 2 +- pages.go | 44 ++++++------ profile.templ | 16 ++--- render_archive.go | 4 +- render_embedded.go | 26 +++---- render_embedjs.go | 12 ---- render_event.go | 137 ++++++++++++++---------------------- render_homepage.go | 7 +- render_image.go | 3 +- render_profile.go | 34 +++------ render_relay.go | 18 ++--- telegram_instant_view.templ | 19 +++-- xml-pages.go | 3 +- 26 files changed, 220 insertions(+), 280 deletions(-) delete mode 100644 render_embedjs.go diff --git a/archive.templ b/archive.templ index aafc5da..737ac28 100644 --- a/archive.templ +++ b/archive.templ @@ -1,5 +1,7 @@ package main +import "fmt" + templ archiveTemplate(params ArchivePageParams) { @@ -28,10 +30,10 @@ templ archiveTemplate(params ArchivePageParams) {
if params.PrevPage != 0 { - << Prev page + << Prev page } if params.NextPage != 0 { - Next page >> + Next page >> }
diff --git a/clients.go b/clients.go index 3c2546c..53b966b 100644 --- a/clients.go +++ b/clients.go @@ -1,75 +1,73 @@ package main import ( - "html/template" - "github.com/nbd-wtf/go-nostr" ) type ClientReference struct { ID string Name string - URL template.URL + URL string Platform string } func generateClientList(code string, event *nostr.Event) []ClientReference { clients := []ClientReference{ - {ID: "native", Name: "Your default app", URL: template.URL("nostr:" + code), Platform: "native"}, + {ID: "native", Name: "Your default app", URL: "nostr:" + code, Platform: "native"}, } webClients_1_6 := []ClientReference{ - {ID: "snort", Name: "Snort", URL: template.URL("https://Snort.social/e/" + code), Platform: "web"}, - {ID: "nostrudel", Name: "Nostrudel", URL: template.URL("https://nostrudel.ninja/#/n/" + code), Platform: "web"}, - {ID: "satellite", Name: "Satellite", URL: template.URL("https://satellite.earth/thread/" + event.ID), Platform: "web"}, - {ID: "coracle", Name: "Coracle", URL: template.URL("https://coracle.social/" + code), Platform: "web"}, - {ID: "primal", Name: "Primal", URL: template.URL("https://primal.net/thread/" + event.ID), Platform: "web"}, - {ID: "nostter", Name: "Nostter", URL: template.URL("https://nostter.app/" + code), Platform: "web"}, - {ID: "highlighter", Name: "Highlighter", URL: template.URL("https://highlighter.com/a/" + code), Platform: "web"}, - {ID: "iris", Name: "Iris", URL: template.URL("https://iris.to/" + code), Platform: "web"}, + {ID: "snort", Name: "Snort", URL: "https://Snort.social/e/" + code, Platform: "web"}, + {ID: "nostrudel", Name: "Nostrudel", URL: "https://nostrudel.ninja/#/n/" + code, Platform: "web"}, + {ID: "satellite", Name: "Satellite", URL: "https://satellite.earth/thread/" + event.ID, Platform: "web"}, + {ID: "coracle", Name: "Coracle", URL: "https://coracle.social/" + code, Platform: "web"}, + {ID: "primal", Name: "Primal", URL: "https://primal.net/thread/" + event.ID, Platform: "web"}, + {ID: "nostter", Name: "Nostter", URL: "https://nostter.app/" + code, Platform: "web"}, + {ID: "highlighter", Name: "Highlighter", URL: "https://highlighter.com/a/" + code, Platform: "web"}, + {ID: "iris", Name: "Iris", URL: "https://iris.to/" + code, Platform: "web"}, } webClients_0 := []ClientReference{ - {ID: "nosta", Name: "Nosta", URL: template.URL("https://nosta.me/" + code), Platform: "web"}, - {ID: "snort", Name: "Snort", URL: template.URL("https://snort.social/p/" + code), Platform: "web"}, - {ID: "satellite", Name: "Satellite", URL: template.URL("https://satellite.earth/@" + code), Platform: "web"}, - {ID: "coracle", Name: "Coracle", URL: template.URL("https://coracle.social/" + code), Platform: "web"}, - {ID: "primal", Name: "Primal", URL: template.URL("https://primal.net/profile/" + event.PubKey), Platform: "web"}, - {ID: "nostrudel", Name: "Nostrudel", URL: template.URL("https://nostrudel.ninja/#/u/" + code), Platform: "web"}, - {ID: "nostter", Name: "Nostter", URL: template.URL("https://nostter.app/" + code), Platform: "web"}, - {ID: "iris", Name: "Iris", URL: template.URL("https://iris.to/" + code), Platform: "web"}, + {ID: "nosta", Name: "Nosta", URL: "https://nosta.me/" + code, Platform: "web"}, + {ID: "snort", Name: "Snort", URL: "https://snort.social/p/" + code, Platform: "web"}, + {ID: "satellite", Name: "Satellite", URL: "https://satellite.earth/@" + code, Platform: "web"}, + {ID: "coracle", Name: "Coracle", URL: "https://coracle.social/" + code, Platform: "web"}, + {ID: "primal", Name: "Primal", URL: "https://primal.net/profile/" + event.PubKey, Platform: "web"}, + {ID: "nostrudel", Name: "Nostrudel", URL: "https://nostrudel.ninja/#/u/" + code, Platform: "web"}, + {ID: "nostter", Name: "Nostter", URL: "https://nostter.app/" + code, Platform: "web"}, + {ID: "iris", Name: "Iris", URL: "https://iris.to/" + code, Platform: "web"}, } webClients_30024 := []ClientReference{ - {ID: "yakihonne", Name: "YakiHonne", URL: template.URL("https://yakihonne.com/article/" + code), Platform: "web"}, - {ID: "habla", Name: "Habla", URL: template.URL("https://habla.news/a/" + code), Platform: "web"}, - {ID: "highlighter", Name: "Highlighter", URL: template.URL("https://highlighter.com/a/" + code), Platform: "web"}, - {ID: "blogstack", Name: "Blogstack", URL: template.URL("https://blogstack.io/" + code), Platform: "web"}, + {ID: "yakihonne", Name: "YakiHonne", URL: "https://yakihonne.com/article/" + code, Platform: "web"}, + {ID: "habla", Name: "Habla", URL: "https://habla.news/a/" + code, Platform: "web"}, + {ID: "highlighter", Name: "Highlighter", URL: "https://highlighter.com/a/" + code, Platform: "web"}, + {ID: "blogstack", Name: "Blogstack", URL: "https://blogstack.io/" + code, Platform: "web"}, } webClients_1063 := []ClientReference{ - {ID: "native", Name: "your native client", URL: template.URL("nostr:" + code), Platform: "web"}, - {ID: "snort", Name: "Snort", URL: template.URL("https://snort.social/p/" + code), Platform: "web"}, - {ID: "coracle", Name: "Coracle", URL: template.URL("https://coracle.social/" + code), Platform: "web"}, + {ID: "native", Name: "your native client", URL: "nostr:" + code, Platform: "web"}, + {ID: "snort", Name: "Snort", URL: "https://snort.social/p/" + code, Platform: "web"}, + {ID: "coracle", Name: "Coracle", URL: "https://coracle.social/" + code, Platform: "web"}, } androidClients := []ClientReference{ - {ID: "yana", Name: "Yana", URL: template.URL("intent:" + code + "#Intent;scheme=nostr;package=yana.nostr;end`;"), Platform: "android"}, - {ID: "spring", Name: "Spring", URL: template.URL("intent:" + code + "#Intent;scheme=nostr;package=com.nostr.universe;end`;"), Platform: "android"}, - {ID: "amethyst", Name: "Amethyst", URL: template.URL("intent:" + code + "#Intent;scheme=nostr;package=com.vitorpamplona.amethyst;end`;"), Platform: "android"}, - {ID: "freefrom", Name: "FreeFrom", URL: template.URL("intent:" + code + "#Intent;scheme=nostr;package=com.freefrom;end`;"), Platform: "android"}, - {ID: "current", Name: "Current", URL: template.URL("intent:" + code + "#Intent;scheme=nostr;package=io.getcurrent.current;end`;"), Platform: "android"}, - {ID: "plebstr", Name: "Plebstr", URL: template.URL("intent:" + code + "#Intent;scheme=nostr;package=com.plebstr.client;end`;"), Platform: "android"}, - // {ID: "", Name: "", URL: template.URL("intent:" + code + "#Intent;scheme=nostr;package=;end`;"), Platform: "app"}, + {ID: "yana", Name: "Yana", URL: "intent:" + code + "#Intent;scheme=nostr;package=yana.nostr;end`;", Platform: "android"}, + {ID: "spring", Name: "Spring", URL: "intent:" + code + "#Intent;scheme=nostr;package=com.nostr.universe;end`;", Platform: "android"}, + {ID: "amethyst", Name: "Amethyst", URL: "intent:" + code + "#Intent;scheme=nostr;package=com.vitorpamplona.amethyst;end`;", Platform: "android"}, + {ID: "freefrom", Name: "FreeFrom", URL: "intent:" + code + "#Intent;scheme=nostr;package=com.freefrom;end`;", Platform: "android"}, + {ID: "current", Name: "Current", URL: "intent:" + code + "#Intent;scheme=nostr;package=io.getcurrent.current;end`;", Platform: "android"}, + {ID: "plebstr", Name: "Plebstr", URL: "intent:" + code + "#Intent;scheme=nostr;package=com.plebstr.client;end`;", Platform: "android"}, + // {ID: "", Name: "", URL: "intent:" + code + "#Intent;scheme=nostr;package=;end`;", Platform: "app"}, } iosClients := []ClientReference{ - {ID: "nos", Name: "Nos", URL: template.URL("nos:" + code), Platform: "ios"}, - {ID: "damus", Name: "Damus", URL: template.URL("damus:" + code), Platform: "ios"}, - {ID: "nostur", Name: "Nostur", URL: template.URL("nostur:" + code), Platform: "ios"}, - {ID: "primal", Name: "Primal", URL: template.URL("primal:" + code), Platform: "ios"}, - {ID: "freefrom", Name: "FreeFrom", URL: template.URL("freefrom:" + code), Platform: "ios"}, - {ID: "plebstr", Name: "Plbestr", URL: template.URL("plebstr:" + code), Platform: "ios"}, + {ID: "nos", Name: "Nos", URL: "nos:" + code, Platform: "ios"}, + {ID: "damus", Name: "Damus", URL: "damus:" + code, Platform: "ios"}, + {ID: "nostur", Name: "Nostur", URL: "nostur:" + code, Platform: "ios"}, + {ID: "primal", Name: "Primal", URL: "primal:" + code, Platform: "ios"}, + {ID: "freefrom", Name: "FreeFrom", URL: "freefrom:" + code, Platform: "ios"}, + {ID: "plebstr", Name: "Plbestr", URL: "plebstr:" + code, Platform: "ios"}, } clients = append(clients, androidClients...) @@ -90,6 +88,6 @@ func generateClientList(code string, event *nostr.Event) []ClientReference { func generateRelayBrowserClientList(host string) []ClientReference { return []ClientReference{ - {ID: "coracle", Name: "Coracle", URL: template.URL("https://coracle.social/relays/" + host), Platform: "web"}, + {ID: "coracle", Name: "Coracle", URL: "https://coracle.social/relays/" + host, Platform: "web"}, } } diff --git a/clients.templ b/clients.templ index d876890..1f4688c 100644 --- a/clients.templ +++ b/clients.templ @@ -64,12 +64,13 @@ templ clientsTemplate(clients []ClientReference) {