Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Serve og:video tags on post URLs (#10039)

authored by

Eric Bailey and committed by
GitHub
0937f522 f5994af6

+24
+16
bskyweb/cmd/bskyweb/server.go
··· 590 590 if postView.Embed.EmbedVideo_View.Thumbnail != nil { 591 591 data["imgThumbUrls"] = []string{*postView.Embed.EmbedVideo_View.Thumbnail} 592 592 } 593 + if postView.Embed.EmbedVideo_View.Playlist != "" { 594 + data["videoUrl"] = postView.Embed.EmbedVideo_View.Playlist 595 + data["videoType"] = "application/vnd.apple.mpegurl" 596 + if postView.Embed.EmbedVideo_View.AspectRatio != nil { 597 + data["videoWidth"] = postView.Embed.EmbedVideo_View.AspectRatio.Width 598 + data["videoHeight"] = postView.Embed.EmbedVideo_View.AspectRatio.Height 599 + } 600 + } 593 601 } else if hasMediaImages { 594 602 var thumbUrls []string 595 603 for i := range postView.Embed.EmbedRecordWithMedia_View.Media.EmbedImages_View.Images { ··· 599 607 } else if hasMediaVideo { 600 608 if postView.Embed.EmbedRecordWithMedia_View.Media.EmbedVideo_View.Thumbnail != nil { 601 609 data["imgThumbUrls"] = []string{*postView.Embed.EmbedRecordWithMedia_View.Media.EmbedVideo_View.Thumbnail} 610 + } 611 + if postView.Embed.EmbedRecordWithMedia_View.Media.EmbedVideo_View.Playlist != "" { 612 + data["videoUrl"] = postView.Embed.EmbedRecordWithMedia_View.Media.EmbedVideo_View.Playlist 613 + data["videoType"] = "application/vnd.apple.mpegurl" 614 + if postView.Embed.EmbedRecordWithMedia_View.Media.EmbedVideo_View.AspectRatio != nil { 615 + data["videoWidth"] = postView.Embed.EmbedRecordWithMedia_View.Media.EmbedVideo_View.AspectRatio.Width 616 + data["videoHeight"] = postView.Embed.EmbedRecordWithMedia_View.Media.EmbedVideo_View.AspectRatio.Height 617 + } 602 618 } 603 619 } 604 620 }
+8
bskyweb/templates/post.html
··· 34 34 <meta property="twitter:image" content="{{ imgThumbUrl }}"> 35 35 {% endfor %} 36 36 <meta name="twitter:card" content="summary_large_image"> 37 + {%- if videoUrl %} 38 + <meta property="og:video" content="{{ videoUrl }}"> 39 + <meta property="og:video:type" content="{{ videoType }}"> 40 + {%- if videoWidth %} 41 + <meta property="og:video:width" content="{{ videoWidth }}"> 42 + <meta property="og:video:height" content="{{ videoHeight }}"> 43 + {% endif -%} 44 + {% endif -%} 37 45 {% else %} 38 46 <meta property="og:image" content="{{ postView.Author.Avatar|avatar_thumbnail }}"> 39 47 <meta property="twitter:image" content="{{ postView.Author.Avatar|avatar_thumbnail }}">