diff --git a/live_event.templ b/live_event.templ
index 33b947a..97a19f8 100644
--- a/live_event.templ
+++ b/live_event.templ
@@ -1,6 +1,6 @@
package main
-templ liveEventTemplate(params LiveEventMessagePageParams) {
+templ liveEventTemplate(params LiveEventPageParams) {
@@ -40,7 +40,7 @@ templ liveEventTemplate(params LiveEventMessagePageParams) {
if params.LiveEvent.HostNpub != "" {
Streaming hosted by
-
+
{ params.LiveEvent.Host.Name }
}
@@ -60,12 +60,7 @@ templ liveEventTemplate(params LiveEventMessagePageParams) {

}
diff --git a/main.go b/main.go
index d72220f..6a49aa6 100644
--- a/main.go
+++ b/main.go
@@ -111,7 +111,6 @@ func main() {
mux.HandleFunc("/p/", redirectFromPSlash)
mux.HandleFunc("/favicon.ico", redirectToFavicon)
mux.HandleFunc("/embed/", renderEmbedjs)
- mux.HandleFunc("/profile-lastnotes/", renderEvent)
mux.HandleFunc("/", renderEvent)
log.Print("listening at http://0.0.0.0:" + s.Port)
diff --git a/oembed.go b/oembed.go
index ae952d3..5bfab18 100644
--- a/oembed.go
+++ b/oembed.go
@@ -65,7 +65,7 @@ func renderOEmbed(w http.ResponseWriter, r *http.Request) {
ProviderURL: "https://" + host,
Title: data.metadata.Name + " wrote",
AuthorName: data.authorLong,
- AuthorURL: fmt.Sprintf("https://%s/%s", host, data.npub),
+ AuthorURL: fmt.Sprintf("https://%s/%s", host, data.metadata.Npub()),
}
switch {
diff --git a/opengraph.templ b/opengraph.templ
index e2f6aaa..4c8176e 100644
--- a/opengraph.templ
+++ b/opengraph.templ
@@ -40,5 +40,5 @@ templ openGraphTemplate(params OpenGraphParams) {
}
templ bigImagePrerender(bigImage string) {
-

+

}
diff --git a/pages.go b/pages.go
index e9b6a13..385259a 100644
--- a/pages.go
+++ b/pages.go
@@ -10,6 +10,19 @@ import (
"github.com/nbd-wtf/go-nostr/nip11"
)
+type TemplateID int
+
+const (
+ Note TemplateID = iota
+ Profile
+ LongForm
+ TelegramInstantView
+ FileMetadata
+ LiveEvent
+ LiveEventMessage
+ Other
+)
+
type OpenGraphParams struct {
SingleTitle string
// x (we will always render just the singletitle if we have that)
@@ -31,9 +44,9 @@ type DetailsParams struct {
HideDetails bool
CreatedAt string
EventJSON template.HTML
+ Metadata Metadata
Nevent string
Nprofile string
- Npub string
SeenOn []string
Kind int
KindNIP string
@@ -45,11 +58,10 @@ type DetailsParams struct {
}
type HeadParams struct {
- IsProfile bool
- TailwindDebugStuff template.HTML
- NaddrNaked string
- NeventNaked string
- Oembed string
+ IsProfile bool
+ NaddrNaked string
+ NeventNaked string
+ Oembed string
}
type TelegramInstantViewParams struct {
@@ -69,7 +81,6 @@ type TelegramInstantViewParams struct {
type HomePageParams struct {
HeadParams
- Host string
Npubs []string
LastNotes []string
}
@@ -103,8 +114,6 @@ type NotePageParams struct {
Content template.HTML
CreatedAt string
Metadata Metadata
- Npub string
- NpubShort string
ParentLink template.HTML
SeenOn []string
Subject string
@@ -116,8 +125,6 @@ type EmbeddedNoteParams struct {
Content template.HTML
CreatedAt string
Metadata Metadata
- Npub string
- NpubShort string
SeenOn []string
Subject string
Url string
@@ -136,7 +143,6 @@ type ProfilePageParams struct {
NormalizedAuthorWebsiteURL string
RenderedAuthorAboutText template.HTML
Nevent string
- Npub string
Nprofile string
IsReply string
Proxy string
@@ -153,7 +159,6 @@ type EmbeddedProfileParams struct {
NormalizedAuthorWebsiteURL string
RenderedAuthorAboutText template.HTML
Nevent string
- Npub string
Nprofile string
Proxy string
Title string
@@ -167,8 +172,6 @@ type FileMetadataPageParams struct {
Content template.HTML
CreatedAt string
Metadata Metadata
- Npub string
- NpubShort string
ParentLink template.HTML
SeenOn []string
Style Style
@@ -191,8 +194,6 @@ type LiveEventPageParams struct {
Content template.HTML
CreatedAt string
Metadata Metadata
- Npub string
- NpubShort string
ParentLink template.HTML
SeenOn []string
Style Style
@@ -213,8 +214,6 @@ type LiveEventMessagePageParams struct {
Content template.HTML
CreatedAt string
Metadata Metadata
- Npub string
- NpubShort string
ParentLink template.HTML
SeenOn []string
Style Style
@@ -240,14 +239,15 @@ type RelayPageParams struct {
type ErrorPageParams struct {
HeadParams
- Message string
Errors string
+ Message string
}
-func (e *ErrorPageParams) MessageHTML() string {
+func (e *ErrorPageParams) MessageHTML() template.HTML {
if e.Message != "" {
- return "<error omitted>"
+ return template.HTML(e.Message)
}
+
switch {
case strings.Contains(e.Errors, "invalid checksum"):
return "It looks like you entered an invalid event code.
Check if you copied it fully, a good idea is compare the first and the last characters."
diff --git a/profile.templ b/profile.templ
index 809b324..5204026 100644
--- a/profile.templ
+++ b/profile.templ
@@ -10,10 +10,10 @@ templ profileTemplate(params ProfilePageParams) {
{ params.Metadata.Name } / { params.Metadata.DisplayName } is on Nostr
-
+
if params.Metadata.Picture != "" {
@@ -22,18 +22,18 @@ templ profileTemplate(params ProfilePageParams) {
}
-
+
@headCommonTemplate(params.HeadParams)
@@ -96,7 +96,7 @@ templ profileTemplate(params ProfilePageParams) {
}
Public Key
- { params.Npub }
+ { params.Metadata.Npub() }
if params.Metadata.NIP05 != "" {
@@ -129,7 +129,7 @@ templ profileTemplate(params ProfilePageParams) {
}
@detailsTemplate(params.DetailsParams)
if len(params.LastNotes) != 0 {