replace nostr user references with names in meta description.

This commit is contained in:
fiatjaf
2023-09-22 18:03:59 -03:00
parent 112e204133
commit 06cbbff096
2 changed files with 14 additions and 22 deletions

View File

@@ -2,7 +2,6 @@ package main
import (
"context"
"encoding/json"
"fmt"
"io"
"net/http"
@@ -21,7 +20,6 @@ import (
"github.com/nbd-wtf/go-nostr"
"github.com/nbd-wtf/go-nostr/nip10"
"github.com/nbd-wtf/go-nostr/nip19"
"github.com/pelletier/go-toml"
)
var (
@@ -161,23 +159,6 @@ func generateClientList(code string, event *nostr.Event) []ClientReference {
return nil
}
func mergeMaps[K comparable, V any](m1 map[K]V, m2 map[K]V) map[K]V {
for k, v := range m2 {
m1[k] = v
}
return m1
}
func prettyJsonOrRaw(j string) string {
var parsedContent any
if err := json.Unmarshal([]byte(j), &parsedContent); err == nil {
if t, err := toml.Marshal(parsedContent); err == nil && len(t) > 0 {
return string(t)
}
}
return j
}
func getPreviewStyle(r *http.Request) string {
ua := strings.ToLower(r.Header.Get("User-Agent"))
accept := r.Header.Get("Accept")