diff --git a/pages.go b/pages.go index b0f8071..6d00337 100644 --- a/pages.go +++ b/pages.go @@ -60,6 +60,9 @@ type DetailsPartial struct { CreatedAt string EventJSON template.HTML Nevent string + Nprofile string + Npub string + SeenOn []string Kind int KindNIP string KindDescription string @@ -178,7 +181,6 @@ type OtherPage struct { IsParameterizedReplaceable bool Naddr string - Npub string Kind int KindDescription string } @@ -250,6 +252,7 @@ type ProfilePage struct { RenderedAuthorAboutText template.HTML Nevent string Npub string + Nprofile string IsReply string Proxy string Title string diff --git a/render_event.go b/render_event.go index 45990ee..e3e84aa 100644 --- a/render_event.go +++ b/render_event.go @@ -211,7 +211,18 @@ func renderEvent(w http.ResponseWriter, r *http.Request) { w.Header().Add("Link", "<"+oembed+"&format=xml>; rel=\"alternate\"; type=\"text/xml+oembed\"") } - // migrating to templ + detailsData := DetailsPartial{ + HideDetails: true, + CreatedAt: data.createdAt, + KindDescription: data.kindDescription, + KindNIP: data.kindNIP, + EventJSON: eventToHTML(data.event), + Kind: data.event.Kind, + SeenOn: data.relays, + Npub: data.npub, + Nprofile: data.nprofile, + } + switch data.templateId { case TelegramInstantView: err = TelegramInstantViewTemplate.Render(w, &TelegramInstantViewPage{ @@ -229,14 +240,7 @@ func renderEvent(w http.ResponseWriter, r *http.Request) { case Note: err = NoteTemplate.Render(w, &NotePage{ HeadCommonPartial: HeadCommonPartial{IsProfile: false}, - DetailsPartial: DetailsPartial{ - HideDetails: true, - CreatedAt: data.createdAt, - KindDescription: data.kindDescription, - KindNIP: data.kindNIP, - EventJSON: eventToHTML(data.event), - Kind: data.event.Kind, - }, + DetailsPartial: detailsData, ClientsPartial: ClientsPartial{ Clients: generateClientList(code, data.event), }, @@ -253,7 +257,6 @@ func renderEvent(w http.ResponseWriter, r *http.Request) { Oembed: oembed, ParentLink: data.parentLink, Proxy: "https://" + host + "/njump/proxy?src=", - SeenOn: data.relays, Style: style, Subject: subject, TextImageURL: textImageURL, @@ -265,19 +268,10 @@ func renderEvent(w http.ResponseWriter, r *http.Request) { }) case Other: err = OtherTemplate.Render(w, &OtherPage{ - HeadCommonPartial: HeadCommonPartial{IsProfile: false}, - DetailsPartial: DetailsPartial{ - HideDetails: false, - CreatedAt: data.createdAt, - KindDescription: data.kindDescription, - KindNIP: data.kindNIP, - EventJSON: eventToHTML(data.event), - Kind: data.event.Kind, - }, - + HeadCommonPartial: HeadCommonPartial{IsProfile: false}, + DetailsPartial: detailsData, IsParameterizedReplaceable: data.event.Kind >= 30000 && data.event.Kind < 40000, Naddr: data.naddr, - Npub: data.npub, Kind: data.event.Kind, KindDescription: data.kindDescription, }) diff --git a/render_profile.go b/render_profile.go index 5439919..f37dde7 100644 --- a/render_profile.go +++ b/render_profile.go @@ -48,6 +48,7 @@ func renderProfile(w http.ResponseWriter, r *http.Request, code string) { NormalizedAuthorWebsiteURL: normalizeWebsiteURL(data.metadata.Website), RenderedAuthorAboutText: template.HTML(basicFormatting(html.EscapeString(data.metadata.About), false, false)), Npub: data.npub, + Nprofile: data.nprofile, AuthorRelays: data.authorRelays, LastNotes: data.renderableLastNotes, }) diff --git a/templates/details.html b/templates/details.html index d8d2fc2..789df1d 100644 --- a/templates/details.html +++ b/templates/details.html @@ -1,3 +1,26 @@ + +
+ +{{ if not (eq "" .Npub) }} +
+
Author Public Key
+ {{.Npub}} +
+{{ end }} + + + +{{ if not (eq 0 (len .SeenOn)) }} +
+
Seen on
+ {{ range .SeenOn }}{{.}} + {{ end }} +
+{{ end }} + + {{ if .HideDetails }}
{{ end }} + +
+ + {{ if not (eq "" .Nprofile) }} +
+
Author Profile Code
+ {{.Nprofile}} +
+ {{ end }}
diff --git a/templates/note.html b/templates/note.html index 884925d..4ae88ec 100644 --- a/templates/note.html +++ b/templates/note.html @@ -112,26 +112,7 @@ {{ .Content }} -
- -
-
Author Public key
- {{.Npub}} -
- - {{ if not (eq 0 (len .SeenOn)) }} -
-
Seen on
- {{ range .SeenOn }}{{.}} - {{ end }} -
- {{ end }} - - - - {{template "details" .}} + {{template "details" .DetailsPartial}}
{{.KindDescription}}
-
- -
-
Author Public key
- {{.Npub}} -
- {{template "details" .DetailsPartial}}
-
Public key
+
Public Key
{{.Npub}}
-
NIP-05
+
NIP-05 Address
{{.Metadata.NIP05}}
-
LN Address
+
NIP-57 Address
{{.Metadata.LUD16}}
+
+
Profile Code
+ {{.Nprofile}} +
{{ if not (eq 0 (len .AuthorRelays)) }}