simplify jsonld post urls
This commit is contained in:
@@ -493,14 +493,8 @@ func buildPostNode(pv *appbsky.FeedDefs_PostView, replies []*appbsky.FeedDefs_Th
|
|||||||
thumb = images[0]
|
thumb = images[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
postURL := bskyPostURLFromATURI(pv.Author.Handle, pv.Uri)
|
postURL := bskyPostURLFromATURIWithDIDFallback(pv.Author.Handle, pv.Uri)
|
||||||
postText := postRecordText(pv)
|
postText := postRecordText(pv)
|
||||||
// videoEmbedURL prefers the handle-form URL but falls back to DID-form
|
|
||||||
// for handle.invalid authors so VideoObject.embedUrl is never empty.
|
|
||||||
videoEmbedURL := postURL
|
|
||||||
if videoEmbedURL == "" {
|
|
||||||
videoEmbedURL = bskyPostURLFromATURIWithDIDFallback(pv.Author.Handle, pv.Uri)
|
|
||||||
}
|
|
||||||
|
|
||||||
node := discussionForumPosting{
|
node := discussionForumPosting{
|
||||||
Type: "DiscussionForumPosting",
|
Type: "DiscussionForumPosting",
|
||||||
@@ -510,7 +504,7 @@ func buildPostNode(pv *appbsky.FeedDefs_PostView, replies []*appbsky.FeedDefs_Th
|
|||||||
Text: postText,
|
Text: postText,
|
||||||
Image: images,
|
Image: images,
|
||||||
ThumbnailURL: thumb,
|
ThumbnailURL: thumb,
|
||||||
Video: buildVideoObject(pv, videoEmbedURL, postText, embedHidden),
|
Video: buildVideoObject(pv, postURL, postText, embedHidden),
|
||||||
DatePublished: pv.IndexedAt,
|
DatePublished: pv.IndexedAt,
|
||||||
InteractionStat: buildPostStats(pv),
|
InteractionStat: buildPostStats(pv),
|
||||||
}
|
}
|
||||||
@@ -573,12 +567,8 @@ func buildReplyNode(pv *appbsky.FeedDefs_PostView, hideLabels map[string]bool) c
|
|||||||
if len(images) > 0 {
|
if len(images) > 0 {
|
||||||
thumb = images[0]
|
thumb = images[0]
|
||||||
}
|
}
|
||||||
postURL := bskyPostURLFromATURI(pv.Author.Handle, pv.Uri)
|
postURL := bskyPostURLFromATURIWithDIDFallback(pv.Author.Handle, pv.Uri)
|
||||||
postText := postRecordText(pv)
|
postText := postRecordText(pv)
|
||||||
videoEmbedURL := postURL
|
|
||||||
if videoEmbedURL == "" {
|
|
||||||
videoEmbedURL = bskyPostURLFromATURIWithDIDFallback(pv.Author.Handle, pv.Uri)
|
|
||||||
}
|
|
||||||
return comment{
|
return comment{
|
||||||
Type: "Comment",
|
Type: "Comment",
|
||||||
URL: postURL,
|
URL: postURL,
|
||||||
@@ -587,7 +577,7 @@ func buildReplyNode(pv *appbsky.FeedDefs_PostView, hideLabels map[string]bool) c
|
|||||||
Text: postText,
|
Text: postText,
|
||||||
Image: images,
|
Image: images,
|
||||||
ThumbnailURL: thumb,
|
ThumbnailURL: thumb,
|
||||||
Video: buildVideoObject(pv, videoEmbedURL, postText, embedHidden),
|
Video: buildVideoObject(pv, postURL, postText, embedHidden),
|
||||||
DatePublished: pv.IndexedAt,
|
DatePublished: pv.IndexedAt,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user