mirror of
https://github.com/aljazceru/njump.git
synced 2025-12-17 22:34:25 +01:00
Manage not NIP-27 contents
This commit is contained in:
14
render.go
14
render.go
@@ -207,6 +207,20 @@ func render(w http.ResponseWriter, r *http.Request) {
|
||||
description = prettyJsonOrRaw(event.Content)
|
||||
}
|
||||
|
||||
// Manage not NIP-27 content replacing #[..] note/npub occurrences
|
||||
for index, value := range event.Tags {
|
||||
placeholderTag := "#[" + fmt.Sprintf("%d", index) + "]"
|
||||
nreplace := ""
|
||||
if value[0] == "p" {
|
||||
nreplace, _ = nip19.EncodePublicKey(value[1])
|
||||
} else if value[0] == "e" {
|
||||
nreplace, _ = nip19.EncodeNote(value[1])
|
||||
} else {
|
||||
continue
|
||||
}
|
||||
content = strings.ReplaceAll(content, placeholderTag, "nostr:"+nreplace)
|
||||
}
|
||||
|
||||
eventJSON, _ := json.MarshalIndent(event, "", " ")
|
||||
|
||||
params := map[string]any{
|
||||
|
||||
Reference in New Issue
Block a user