mirror of
https://github.com/aljazceru/njump.git
synced 2026-02-06 06:34:25 +01:00
make instant view happen when there is video or image and the note is big enough.
This commit is contained in:
@@ -224,11 +224,14 @@ func render(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
useTextImage := (event.Kind == 1 || event.Kind == 30023) &&
|
||||
image == "" && video == "" && len(event.Content) > 120
|
||||
image == "" && video == "" && len(event.Content) > 133
|
||||
|
||||
if style == "telegram" {
|
||||
if event.Kind == 30023 ||
|
||||
(event.Kind == 1 && len(event.Content) > 650) {
|
||||
// do telegram instant preview (only works on telegram mobile apps, not desktop)
|
||||
if event.Kind == 30023 || // do it for longform articles
|
||||
(event.Kind == 1 && len(event.Content) > 650) || // or very long notes
|
||||
// or shorter notes that should be using text-to-image stuff but are not because they have video or images
|
||||
(event.Kind == 1 && len(event.Content) > 133 && !useTextImage) {
|
||||
typ = "telegram_instant_view"
|
||||
useTextImage = false
|
||||
}
|
||||
|
||||
@@ -14,6 +14,12 @@
|
||||
{{ if .image }}
|
||||
<meta property="og:image" content="{{.image | escapeString}}" />
|
||||
{{ end }}
|
||||
<!---->
|
||||
{{ if .video }}
|
||||
<meta property="og:video" content="{{.video | escapeString}}" />
|
||||
<meta property="og:video:secure_url" content="{{.video | escapeString}}" />
|
||||
<meta property="og:video:type" content="video/{{.videoType | escapeString}}" />
|
||||
{{ end }}
|
||||
|
||||
<!-- stuff that affects the content inside the preview window -->
|
||||
<meta name="author" content="{{.metadata.Name}}" />
|
||||
|
||||
Reference in New Issue
Block a user