use event relays when searching for pubkey metadata, compute nprofile.

This commit is contained in:
fiatjaf
2023-10-26 08:07:07 -03:00
parent 19310fbcd2
commit 92d8b6a6d1
4 changed files with 29 additions and 10 deletions

View File

@@ -266,7 +266,7 @@ func shortenNostrURLs(input string) string {
}
func getNameFromNip19(ctx context.Context, nip19 string) string {
author, _, err := getEvent(ctx, nip19)
author, _, err := getEvent(ctx, nip19, nil)
if err != nil {
return nip19
}
@@ -305,7 +305,7 @@ func renderQuotesAsHTML(ctx context.Context, input string, usingTelegramInstantV
submatch := nostrNoteNeventMatcher.FindStringSubmatch(match)
nip19 := submatch[1]
event, _, err := getEvent(ctx, nip19)
event, _, err := getEvent(ctx, nip19, nil)
if err != nil {
log.Warn().Str("nip19", nip19).Msg("failed to get nip19")
return nip19
@@ -533,3 +533,10 @@ func eventToHTML(evt *nostr.Event) template.HTML {
}`, evt.ID, evt.PubKey, evt.CreatedAt, evt.Kind, tagsHTML, html.EscapeString(string(contentJSON)), evt.Sig),
)
}
func limitAt[V any](list []V, n int) []V {
if len(list) < n {
return list
}
return list[0:n]
}