mirror of
https://github.com/aljazceru/njump.git
synced 2025-12-18 14:54:24 +01:00
Add basic support for repost (kind 6)
This commit is contained in:
10
render.go
10
render.go
@@ -59,6 +59,7 @@ func render(w http.ResponseWriter, r *http.Request) {
|
|||||||
note := ""
|
note := ""
|
||||||
naddr := ""
|
naddr := ""
|
||||||
createdAt := time.Unix(int64(event.CreatedAt), 0).Format("2006-01-02 15:04:05")
|
createdAt := time.Unix(int64(event.CreatedAt), 0).Format("2006-01-02 15:04:05")
|
||||||
|
content := ""
|
||||||
|
|
||||||
typ := ""
|
typ := ""
|
||||||
author := event
|
author := event
|
||||||
@@ -85,6 +86,13 @@ func render(w http.ResponseWriter, r *http.Request) {
|
|||||||
if event.Kind == 1 || event.Kind == 7 || event.Kind == 30023 {
|
if event.Kind == 1 || event.Kind == 7 || event.Kind == 30023 {
|
||||||
typ = "note"
|
typ = "note"
|
||||||
note, _ = nip19.EncodeNote(event.ID)
|
note, _ = nip19.EncodeNote(event.ID)
|
||||||
|
content = event.Content
|
||||||
|
} else if event.Kind == 6 {
|
||||||
|
typ = "note"
|
||||||
|
if reposted := event.Tags.GetFirst([]string{"e", ""}); reposted != nil {
|
||||||
|
original_nevent, _ := nip19.EncodeNote((*reposted)[1])
|
||||||
|
content = "Repost of nostr:" + original_nevent
|
||||||
|
}
|
||||||
} else if event.Kind >= 30000 && event.Kind < 40000 {
|
} else if event.Kind >= 30000 && event.Kind < 40000 {
|
||||||
typ = "address"
|
typ = "address"
|
||||||
if d := event.Tags.GetFirst([]string{"d", ""}); d != nil {
|
if d := event.Tags.GetFirst([]string{"d", ""}); d != nil {
|
||||||
@@ -191,8 +199,6 @@ func render(w http.ResponseWriter, r *http.Request) {
|
|||||||
description = prettyJsonOrRaw(event.Content)
|
description = prettyJsonOrRaw(event.Content)
|
||||||
}
|
}
|
||||||
|
|
||||||
content := prettyJsonOrRaw(event.Content)
|
|
||||||
|
|
||||||
eventJSON, _ := json.MarshalIndent(event, "", " ")
|
eventJSON, _ := json.MarshalIndent(event, "", " ")
|
||||||
|
|
||||||
params := map[string]any{
|
params := map[string]any{
|
||||||
|
|||||||
Reference in New Issue
Block a user