From 3732277241ad8d6f1d74a7cc56ccd91cf46085d3 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Wed, 15 Nov 2023 14:43:29 -0300 Subject: [PATCH] render as telegram instant view in more cases. --- render_event.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/render_event.go b/render_event.go index 0cfb0e7..9f9626f 100644 --- a/render_event.go +++ b/render_event.go @@ -111,6 +111,8 @@ func renderEvent(w http.ResponseWriter, r *http.Request) { // do telegram instant preview (only works on telegram mobile apps, not desktop) if data.event.Kind == 30023 || // do it for longform articles (data.event.Kind == 1 && len(data.event.Content) > 650) || // or very long notes + (data.parentLink != "") || // or notes that are replies (so we can navigate to them from telegram) + (strings.Contains(data.content, "nostr:")) || // or notes that quote other stuff (idem) // or shorter notes that should be using text-to-image stuff but are not because they have video or images (data.event.Kind == 1 && len(data.event.Content)-len(data.image) > 133 && !useTextImage) { data.templateId = TelegramInstantView @@ -230,7 +232,7 @@ func renderEvent(w http.ResponseWriter, r *http.Request) { data.content = basicFormatting(html.EscapeString(data.content), true, false) // then we render quotes as HTML, which will also apply basicFormatting to all the internal quotes data.content = renderQuotesAsHTML(r.Context(), data.content, data.templateId == TelegramInstantView) - // we must do this because inside we must treat s different when telegram_instant_view + // we must do this because inside we must treat s differently when telegram_instant_view } w.Header().Set("Content-Type", "text/html")