mirror of
https://github.com/aljazceru/njump.git
synced 2025-12-19 07:14:24 +01:00
actually verify the nip05 and strikethrough it if invalid.
This commit is contained in:
@@ -143,7 +143,7 @@ templ profileTemplate(params ProfilePageParams) {
|
|||||||
<span itemprop="identifier">{ params.Metadata.Npub() }</span>
|
<span itemprop="identifier">{ params.Metadata.Npub() }</span>
|
||||||
</div>
|
</div>
|
||||||
if params.Metadata.NIP05 != "" {
|
if params.Metadata.NIP05 != "" {
|
||||||
<div class="mb-6 leading-5">
|
<div class={ "mb-6", "leading-5", templ.KV("line-through", !params.Metadata.NIP05Valid(ctx)) }>
|
||||||
<div class="text-sm text-strongpink">NIP-05 Address</div>
|
<div class="text-sm text-strongpink">NIP-05 Address</div>
|
||||||
<a href={ templ.URL(nip05.IdentifierToURL(params.Metadata.NIP05)) } class="underline-offset-[6px] hover:underline">
|
<a href={ templ.URL(nip05.IdentifierToURL(params.Metadata.NIP05)) } class="underline-offset-[6px] hover:underline">
|
||||||
<span itemprop="alternateName">{ nip05.NormalizeIdentifier(params.Metadata.NIP05) }</span>
|
<span itemprop="alternateName">{ nip05.NormalizeIdentifier(params.Metadata.NIP05) }</span>
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
"html/template"
|
"html/template"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func renderProfile(ctx context.Context, r *http.Request, w http.ResponseWriter, code string) {
|
func renderProfile(ctx context.Context, r *http.Request, w http.ResponseWriter, code string) {
|
||||||
@@ -117,6 +118,10 @@ func renderProfile(ctx context.Context, r *http.Request, w http.ResponseWriter,
|
|||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// give this global context a timeout because it may used inside the template to validate the nip05 address
|
||||||
|
ctx, cancel := context.WithTimeout(ctx, time.Second*3)
|
||||||
|
defer cancel()
|
||||||
|
|
||||||
if isEmbed {
|
if isEmbed {
|
||||||
err = embeddedProfileTemplate(params).Render(ctx, w)
|
err = embeddedProfileTemplate(params).Render(ctx, w)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user