diff options
Diffstat (limited to 'notes/app.bsky.feed.go')
| -rw-r--r-- | notes/app.bsky.feed.go | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/notes/app.bsky.feed.go b/notes/app.bsky.feed.go index 21b94f9..1ee3cca 100644 --- a/notes/app.bsky.feed.go +++ b/notes/app.bsky.feed.go @@ -9,7 +9,9 @@ import ( type EmbedImage struct { Alt string `json:"alt"` Image struct { - CID string `json:"$link"` + Ref struct { + CID string `json:"$link"` + } `json:"ref"` } `json:"image"` AspectRatio *struct { Width int `json:"width"` @@ -54,7 +56,7 @@ type AppBskyFeedPostRecord struct { } `json:"value"` } -func extractImages(embed *AppBskyFeedPostEmbed, did, pdsURL string) []Media { +func extractImages(embed *AppBskyFeedPostEmbed, did string) []Media { if embed == nil { return nil } @@ -65,7 +67,7 @@ func extractImages(embed *AppBskyFeedPostEmbed, did, pdsURL string) []Media { var media []Media for _, img := range images { m := Media{ - URL: fmt.Sprintf("%s/xrpc/com.atproto.sync.getBlob?did=%s&cid=%s", pdsURL, did, img.Image.CID), + URL: fmt.Sprintf("/api/blob/%s/%s", did, img.Image.Ref.CID), Alt: img.Alt, } if img.AspectRatio != nil { @@ -77,7 +79,7 @@ func extractImages(embed *AppBskyFeedPostEmbed, did, pdsURL string) []Media { return media } -func NoteFromAppBskyFeedPostRecord(record AppBskyFeedPostRecord, author *Author) (*Note, error) { +func NoteFromAppBskyFeedPostRecord(record AppBskyFeedPostRecord, author *Author, porxieURL string) (*Note, error) { if record.URI == "" { return nil, fmt.Errorf("missing required field: uri") } @@ -145,6 +147,6 @@ func NoteFromAppBskyFeedPostRecord(record AppBskyFeedPostRecord, author *Author) Text: record.Value.Text, ReplyTo: replyTo, Facets: facets, - Media: extractImages(record.Value.Embed, did, author.PDS), + Media: extractImages(record.Value.Embed, did), }, nil } |
