Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

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

Ensure OG:Image is filled when post contains a record (#2586)

authored by

Gargaj and committed by
GitHub
cdbdb37a cda4fe4a

+13 -5
+13 -5
bskyweb/cmd/bskyweb/server.go
··· 336 336 postView := tpv.Thread.FeedDefs_ThreadViewPost.Post 337 337 data["postView"] = postView 338 338 data["requestURI"] = fmt.Sprintf("https://%s%s", req.Host, req.URL.Path) 339 - if postView.Embed != nil && postView.Embed.EmbedImages_View != nil { 340 - var thumbUrls []string 341 - for i := range postView.Embed.EmbedImages_View.Images { 342 - thumbUrls = append(thumbUrls, postView.Embed.EmbedImages_View.Images[i].Thumb) 339 + if postView.Embed != nil { 340 + if postView.Embed.EmbedImages_View != nil { 341 + var thumbUrls []string 342 + for i := range postView.Embed.EmbedImages_View.Images { 343 + thumbUrls = append(thumbUrls, postView.Embed.EmbedImages_View.Images[i].Thumb) 344 + } 345 + data["imgThumbUrls"] = thumbUrls 346 + } else if postView.Embed.EmbedRecordWithMedia_View != nil && postView.Embed.EmbedRecordWithMedia_View.Media != nil && postView.Embed.EmbedRecordWithMedia_View.Media.EmbedImages_View != nil { 347 + var thumbUrls []string 348 + for i := range postView.Embed.EmbedRecordWithMedia_View.Media.EmbedImages_View.Images { 349 + thumbUrls = append(thumbUrls, postView.Embed.EmbedRecordWithMedia_View.Media.EmbedImages_View.Images[i].Thumb) 350 + } 351 + data["imgThumbUrls"] = thumbUrls 343 352 } 344 - data["imgThumbUrls"] = thumbUrls 345 353 } 346 354 return c.Render(http.StatusOK, "post.html", data) 347 355 }