diff --git a/main.go b/main.go
index 81a5dd6..5ca5d59 100644
--- a/main.go
+++ b/main.go
@@ -3,7 +3,6 @@ package main
import (
"context"
"embed"
- "fmt"
"html"
"net/http"
"os"
@@ -39,7 +38,6 @@ func updateArchives(ctx context.Context) {
for {
select {
case <-ctx.Done():
- fmt.Println("exit updateArchives gracefully...")
return
default:
loadNpubsArchive(ctx)
diff --git a/nostr.go b/nostr.go
index ace0d29..f7f5842 100644
--- a/nostr.go
+++ b/nostr.go
@@ -213,7 +213,7 @@ func contactsForPubkey(ctx context.Context, pubkey string, extraRelays ...string
pubkeyContacts := make([]string, 0, 100)
relays := make([]string, 0, 12)
if ok := cache.GetJSON("cc:"+pubkey, &pubkeyContacts); !ok {
- fmt.Printf("Searching contacts for %s\n", pubkey)
+ log.Debug().Msgf("searching contacts for %s", pubkey)
ctx, cancel := context.WithTimeout(ctx, time.Second*3)
pubkeyRelays := relaysForPubkey(ctx, pubkey, relays...)
diff --git a/render.go b/render.go
index bec2fa2..3a0f184 100644
--- a/render.go
+++ b/render.go
@@ -304,7 +304,7 @@ func render(w http.ResponseWriter, r *http.Request) {
content = strings.ReplaceAll(content, placeholderTag, "nostr:"+nreplace)
}
if event.Kind == 30023 || event.Kind == 30024 {
- content = mdToHTML(content)
+ content = mdToHTML(content, typ == "telegram_instant_view")
} else {
content = renderInlineMentions(basicFormatting(html.EscapeString(content)))
}
@@ -327,6 +327,7 @@ func render(w http.ResponseWriter, r *http.Request) {
"authorLong": authorLong,
"subject": subject,
"description": description,
+ "summary": summary,
"event": event,
"eventJSON": string(eventJSON),
"content": content,
diff --git a/templates/telegram_instant_view.html b/templates/telegram_instant_view.html
index d80f27b..70782e0 100644
--- a/templates/telegram_instant_view.html
+++ b/templates/telegram_instant_view.html
@@ -6,7 +6,10 @@
-
+
{{ if .description }}
{{ end }}
@@ -28,8 +31,14 @@
- {{ if (not (eq .subject ""))}} {{.subject | escapeString}} {{ else }}
- {{.metadata.Name | escapeString}} wrote: {{ end }}
+ {{ if .subject }} {{.subject | escapeString}} {{ else }} {{.metadata.Name |
+ escapeString}} wrote: {{ end }}
+
+ {{ if .summary }}
+ {{ .summary }}
+ {{ end }}
+
+
{{.content}}
=> `
`
// or markdown !()[...] tags for further processing => ``
@@ -221,7 +224,7 @@ func replateImageURLsWithTags(input string, replacement string) string {
return input
}
-func replateVideoURLsWithTags(input string, replacement string) string {
+func replaceVideoURLsWithTags(input string, replacement string) string {
// Match and replace video URLs with a custom replacement
// Usually is html
`)) + } + return ast.GoToNext, true + } + return ast.GoToNext, false + } + } + // create HTML renderer with extensions - htmlFlags := mdhtml.CommonFlags | mdhtml.HrefTargetBlank - opts := mdhtml.RendererOptions{Flags: htmlFlags} + opts := mdhtml.RendererOptions{ + Flags: mdhtml.CommonFlags | mdhtml.HrefTargetBlank, + RenderNodeHook: customNodeHook, + } renderer := mdhtml.NewRenderer(opts) output := string(markdown.Render(doc, renderer)) - // Sanitize content + // sanitize content output = sanitizeXSS(output) return output