mirror of
https://github.com/aljazceru/njump.git
synced 2026-01-31 11:44:34 +01:00
fix .metadata.Website without a leading "https://"
This commit is contained in:
1
main.go
1
main.go
@@ -82,6 +82,7 @@ func main() {
|
||||
"escapeString": html.EscapeString,
|
||||
"sanitizeXSS": sanitizeXSS,
|
||||
"trimProtocol": trimProtocol,
|
||||
"normalizeWebsiteURL": normalizeWebsiteURL,
|
||||
}
|
||||
|
||||
tmpl = template.Must(
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
</header>
|
||||
<div class="field separator long"></div>
|
||||
<div class="field">
|
||||
<a href="{{.metadata.Website | escapeString}}"
|
||||
<a href="{{.metadata.Website | normalizeWebsiteURL | escapeString}}"
|
||||
>{{.metadata.Website | escapeString}}</a
|
||||
>
|
||||
</div>
|
||||
|
||||
7
utils.go
7
utils.go
@@ -435,6 +435,13 @@ func trimProtocol(relay string) string {
|
||||
return relay
|
||||
}
|
||||
|
||||
func normalizeWebsiteURL(u string) string {
|
||||
if strings.HasPrefix(u, "http") {
|
||||
return u
|
||||
}
|
||||
return "https://" + u
|
||||
}
|
||||
|
||||
func loadNpubsArchive(ctx context.Context) {
|
||||
log.Debug().Msg("refreshing the npubs archive")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user