Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image of type other than BLOB? #763

Closed
myConsciousness opened this issue Apr 5, 2023 · 7 comments
Closed

Image of type other than BLOB? #763

myConsciousness opened this issue Apr 5, 2023 · 7 comments

Comments

@myConsciousness
Copy link
Contributor

Hi,

While using app.bsky.feed.getTimeline to collect test data, I noticed that the app.bsky.embed.images is different from the app.bsky.embed.images defined in the current Lexicon.

And this is what I found (see image object):

      "record": {
        "text": "This Bluesky multi-national conglomerate is getting out of hand. Decentralized farming?? What’s next ",
        "$type": "app.bsky.feed.post",
        "embed": {
          "$type": "app.bsky.embed.images",
          "images": [
            {
              "alt": "",
              "image": {
                "cid": "bafkreigyia5vqnnpapjc6p5k23ukzc47kadxhbeuzfvjq52bftz7k2d56a",
                "mimeType": "image/jpeg"
              }
            }
          ]
        },
        "createdAt": "2023-02-06T13:15:26.655Z"
      }

In the latest Lexicon, this structure appears to be a BLOB, but in fact a different structure is set up. Is this still a pre-transition protocol process? Or is there really an image object like the above?

@dholms
Copy link
Collaborator

dholms commented Apr 5, 2023

hey @myConsciousness thanks for asking!

We still support the old blob format as well as the new format on reads. However, for writes we strongly encourage the new format as it allows a PDS to handle blobs without being lexicon aware.

You can see the class we use to abstract over blob refs here: https://github.com/bluesky-social/atproto/blob/main/packages/lexicon/src/blob-refs.ts

@pfrazee
Copy link
Collaborator

pfrazee commented Apr 5, 2023

@dholms is that the correct image form though? Shouldn't there be some $-sign keys in there?

@dholms
Copy link
Collaborator

dholms commented Apr 6, 2023

I don't think so, the union is on embed 🧐

@pfrazee
Copy link
Collaborator

pfrazee commented Apr 6, 2023

@myConsciousness can you show us the entire "row" object which that snippet comes from?

@myConsciousness
Copy link
Contributor Author

Hi @dholms @pfrazee ,

This is entire object under feed object :) This is a different post than the snippet I shared earlier, but it seems to use the same old object structure.

The object in question is under reply.

{
  "post": {
    "uri": "at://did:plc:qlj52k6xjk2nbx4ilx25lzo7/app.bsky.feed.post/3jsny2o7snk2n",
    "cid": "bafyreih5i5g37gogew2hz4iwbdvl5jgzmfrvdq3uoltilb7knrkznyvczm",
    "author": {
      "did": "did:plc:qlj52k6xjk2nbx4ilx25lzo7",
      "handle": "marciotalves.bsky.social",
      "displayName": "Marcio Tatiano Alves ✔️",
      "avatar": "https://cdn.bsky.social/imgproxy/Z4u6obVk98Qx5xtIODsAhxzRepf9YvAaBezQTeMFT_A/rs:fill:1000:1000:1:0/plain/bafkreidhw3f3zlukpg7nvtjzs53xoj4ji3ibylhdj6tultkx2w232zym54@jpeg",
      "viewer": {
        "muted": false,
        "following": "at://did:plc:iijrtk7ocored6zuziwmqq3c/app.bsky.graph.follow/3js4wzjwnis2y"
      }
    },
    "record": {
      "text": "O passarinho do twitter se perdeu no céu azul 😅",
      "$type": "app.bsky.feed.post",
      "reply": {
        "root": {
          "cid": "bafyreia6ujh4keoss6c7kg73tybaqfcd6sybkky43c26e25mwzegh65xhy",
          "uri": "at://did:plc:jxfvk2btaphys5yymnhvo3un/app.bsky.feed.post/3jqolxaw3xk2g"
        },
        "parent": {
          "cid": "bafyreia6ujh4keoss6c7kg73tybaqfcd6sybkky43c26e25mwzegh65xhy",
          "uri": "at://did:plc:jxfvk2btaphys5yymnhvo3un/app.bsky.feed.post/3jqolxaw3xk2g"
        }
      },
      "createdAt": "2023-04-05T23:53:54.311Z"
    },
    "replyCount": 0,
    "repostCount": 0,
    "likeCount": 0,
    "indexedAt": "2023-04-05T23:53:55.686Z",
    "viewer": {}
  },
  "reply": {
    "root": {
      "uri": "at://did:plc:jxfvk2btaphys5yymnhvo3un/app.bsky.feed.post/3jqolxaw3xk2g",
      "cid": "bafyreia6ujh4keoss6c7kg73tybaqfcd6sybkky43c26e25mwzegh65xhy",
      "author": {
        "did": "did:plc:jxfvk2btaphys5yymnhvo3un",
        "handle": "shahab.bsky.social",
        "displayName": "Shahab",
        "avatar": "https://cdn.bsky.social/imgproxy/m_SWdtGaCqc81djYVE8Sy14qTwacY7zcv-tyBNE2LvQ/rs:fill:1000:1000:1:0/plain/bafkreifmqzfb5oil47bf7fdj4yl3jxmxisdr6tkroqdtqldxqoq57wvnt4@jpeg",
        "viewer": {
          "muted": false,
          "following": "at://did:plc:iijrtk7ocored6zuziwmqq3c/app.bsky.graph.follow/3jrmqiemr5k2p"
        }
      },
      "record": {
        "text": "Noticed this and can‘t unsee it now!",
        "$type": "app.bsky.feed.post",
        "embed": {
          "$type": "app.bsky.embed.images",
          "images": [
            {
              "alt": "",
              "image": {
                "cid": "bafkreig4swmwfjoeyf7simttypdftyozjs53hwqntotathkphu626qci6a",
                "mimeType": "image/jpeg"
              }
            }
          ]
        },
        "createdAt": "2023-03-11T18:59:32.541Z"
      },
      "embed": {
        "$type": "app.bsky.embed.images#view",
        "images": [
          {
            "thumb": "https://cdn.bsky.social/imgproxy/RfAGY6fOdV3tpC0j6dKxK5l_vgxs-yFY5q-1ZqUlDsg/rs:fit:1000:1000:1:0/plain/bafkreig4swmwfjoeyf7simttypdftyozjs53hwqntotathkphu626qci6a@jpeg",
            "fullsize": "https://cdn.bsky.social/imgproxy/D7Qty2rBTYdka6Su2lOExA6wkHa3BgvtdUWtUeusCZE/rs:fit:2000:2000:1:0/plain/bafkreig4swmwfjoeyf7simttypdftyozjs53hwqntotathkphu626qci6a@jpeg",
            "alt": ""
          }
        ]
      },
      "replyCount": 2,
      "repostCount": 8,
      "likeCount": 53,
      "indexedAt": "2023-03-11T18:59:32.654Z",
      "viewer": {
        "repost": "at://did:plc:iijrtk7ocored6zuziwmqq3c/app.bsky.feed.repost/3jrpqk4ewsc2d",
        "like": "at://did:plc:iijrtk7ocored6zuziwmqq3c/app.bsky.feed.like/3jrpqk34pos2r"
      }
    },
    "parent": {
      "uri": "at://did:plc:jxfvk2btaphys5yymnhvo3un/app.bsky.feed.post/3jqolxaw3xk2g",
      "cid": "bafyreia6ujh4keoss6c7kg73tybaqfcd6sybkky43c26e25mwzegh65xhy",
      "author": {
        "did": "did:plc:jxfvk2btaphys5yymnhvo3un",
        "handle": "shahab.bsky.social",
        "displayName": "Shahab",
        "avatar": "https://cdn.bsky.social/imgproxy/m_SWdtGaCqc81djYVE8Sy14qTwacY7zcv-tyBNE2LvQ/rs:fill:1000:1000:1:0/plain/bafkreifmqzfb5oil47bf7fdj4yl3jxmxisdr6tkroqdtqldxqoq57wvnt4@jpeg",
        "viewer": {
          "muted": false,
          "following": "at://did:plc:iijrtk7ocored6zuziwmqq3c/app.bsky.graph.follow/3jrmqiemr5k2p"
        }
      },
      "record": {
        "text": "Noticed this and can‘t unsee it now!",
        "$type": "app.bsky.feed.post",
        "embed": {
          "$type": "app.bsky.embed.images",
          "images": [
            {
              "alt": "",
              "image": {
                "cid": "bafkreig4swmwfjoeyf7simttypdftyozjs53hwqntotathkphu626qci6a",
                "mimeType": "image/jpeg"
              }
            }
          ]
        },
        "createdAt": "2023-03-11T18:59:32.541Z"
      },
      "embed": {
        "$type": "app.bsky.embed.images#view",
        "images": [
          {
            "thumb": "https://cdn.bsky.social/imgproxy/RfAGY6fOdV3tpC0j6dKxK5l_vgxs-yFY5q-1ZqUlDsg/rs:fit:1000:1000:1:0/plain/bafkreig4swmwfjoeyf7simttypdftyozjs53hwqntotathkphu626qci6a@jpeg",
            "fullsize": "https://cdn.bsky.social/imgproxy/D7Qty2rBTYdka6Su2lOExA6wkHa3BgvtdUWtUeusCZE/rs:fit:2000:2000:1:0/plain/bafkreig4swmwfjoeyf7simttypdftyozjs53hwqntotathkphu626qci6a@jpeg",
            "alt": ""
          }
        ]
      },
      "replyCount": 2,
      "repostCount": 8,
      "likeCount": 53,
      "indexedAt": "2023-03-11T18:59:32.654Z",
      "viewer": {
        "repost": "at://did:plc:iijrtk7ocored6zuziwmqq3c/app.bsky.feed.repost/3jrpqk4ewsc2d",
        "like": "at://did:plc:iijrtk7ocored6zuziwmqq3c/app.bsky.feed.like/3jrpqk34pos2r"
      }
    }
  }
}
      "record": {
        "text": "Noticed this and can‘t unsee it now!",
        "$type": "app.bsky.feed.post",
        "embed": {
          "$type": "app.bsky.embed.images",
          "images": [
            {
              "alt": "",
              "image": {
                "cid": "bafkreig4swmwfjoeyf7simttypdftyozjs53hwqntotathkphu626qci6a",
                "mimeType": "image/jpeg"
              }
            }
          ]
        },
        "createdAt": "2023-03-11T18:59:32.541Z"
      },

@ianklatzco
Copy link
Contributor

It looks like images before the lex refactor might still be in the DB/PDS in the old format.

Here's a sample truncated response from getAuthorFeed showing a new image followed by an old image.

// image posted yesterday
                "record": {
                    "text": "",
                    "$type": "app.bsky.feed.post",
                    "embed": {
                        "$type": "app.bsky.embed.images",
                        "images": [
                            {
                                "alt": "",
                                "image": {
                                    "$type": "blob",
                                    "ref": {
                                        "$link": "bafkreihcrabxisugjyiw6zclsdrrwihllaexxahrdxt5gtmyzpwzb5gpoi"
                                    },
                                    "mimeType": "image/jpeg",
                                    "size": 34923
                                }
                            }
                        ]
                    },
                    "createdAt": "2023-04-05T21:32:18.973Z"
                },
// image posted before refactor
                "record": {
                    "text": "blue skies today in Puebla, Mexico",
                    "$type": "app.bsky.feed.post",
                    "embed": {
                        "$type": "app.bsky.embed.images",
                        "images": [
                            {
                                "alt": "blue sky",
                                "image": {
                                    "cid": "bafkreifnoqdfn3jup6gqjmsnmyhq35wet6nadqbgcvfgrsqafxtpgdplky",
                                    "mimeType": "image/jpeg"
                                }
                            }
                        ]
                    },
                    "createdAt": "2023-04-01T19:00:44.040616Z"
                },

Full response (view on GitHub for pretty rendering):

{
    "feed": [
        {
            "post": {
                "uri": "at://did:plc:o2hywbrivbyxugiukoexum57/app.bsky.feed.post/3jsnq5hbdsc27",
                "cid": "bafyreigr7gqs3lmbvpzb2p3o2edcdds2paw4yme55a7yodhqtlwk6nilgu",
                "author": {
                    "did": "did:plc:o2hywbrivbyxugiukoexum57",
                    "handle": "klatz.co",
                    "displayName": "ian",
                    "avatar": "https://cdn.bsky.social/imgproxy/GJx4y5xTsEPFOxKrSQWNr6ya9JVsHxPuuTgobe6FaSU/rs:fill:1000:1000:1:0/plain/bafkreihzhtpsabgwzod3455oraevg6t5oz4nyll4jdxc72sms33rucs5ne@jpeg",
                    "viewer": {
                        "muted": false
                    }
                },
                "record": {
                    "text": "",
                    "$type": "app.bsky.feed.post",
                    "embed": {
                        "$type": "app.bsky.embed.images",
                        "images": [
                            {
                                "alt": "",
                                "image": {
                                    "$type": "blob",
                                    "ref": {
                                        "$link": "bafkreihcrabxisugjyiw6zclsdrrwihllaexxahrdxt5gtmyzpwzb5gpoi"
                                    },
                                    "mimeType": "image/jpeg",
                                    "size": 34923
                                }
                            }
                        ]
                    },
                    "createdAt": "2023-04-05T21:32:18.973Z"
                },
                "embed": {
                    "$type": "app.bsky.embed.images#view",
                    "images": [
                        {
                            "thumb": "https://cdn.bsky.social/imgproxy/QJC3GELNbeReVdZ85orK8LIgm6R3Eeg4BpxxFxFW8kI/rs:fit:1000:1000:1:0/plain/bafkreihcrabxisugjyiw6zclsdrrwihllaexxahrdxt5gtmyzpwzb5gpoi@jpeg",
                            "fullsize": "https://cdn.bsky.social/imgproxy/Fx7yAwcybIVMOQ5I-2EMljCbis8ZUbuUgN59xhNYX04/rs:fit:2000:2000:1:0/plain/bafkreihcrabxisugjyiw6zclsdrrwihllaexxahrdxt5gtmyzpwzb5gpoi@jpeg",
                            "alt": ""
                        }
                    ]
                },
                "replyCount": 0,
                "repostCount": 0,
                "likeCount": 0,
                "indexedAt": "2023-04-05T21:32:19.125Z",
                "viewer": {}
            }
        },
        {
            "post": {
                "uri": "at://did:plc:n5ddwqolbjpv2czaronz6q3d/app.bsky.feed.post/3jsdfspwphc2j",
                "cid": "bafyreidopcfk2wbh4utejxn5quwn57wgtv5g6vl5jopzvsnzpekvwysy5y",
                "author": {
                    "did": "did:plc:n5ddwqolbjpv2czaronz6q3d",
                    "handle": "blueskies.bsky.social",
                    "displayName": "blueskies!",
                    "avatar": "https://cdn.bsky.social/imgproxy/6RNfmcvsSx30EtNeEe9sBjXZhPdhlgF_TOoPJFTtOwE/rs:fill:1000:1000:1:0/plain/bafkreibxmqaqdmr4u4urlaq2cjefftxwayb53xxiw5dqnn55o2gkiaqh3q@jpeg",
                    "viewer": {
                        "muted": false,
                        "following": "at://did:plc:o2hywbrivbyxugiukoexum57/app.bsky.graph.follow/3jn5q2xkwdy2p",
                        "followedBy": "at://did:plc:n5ddwqolbjpv2czaronz6q3d/app.bsky.graph.follow/3jrznxvr4a22p"
                    }
                },
                "record": {
                    "text": "blue skies today in Puebla, Mexico",
                    "$type": "app.bsky.feed.post",
                    "embed": {
                        "$type": "app.bsky.embed.images",
                        "images": [
                            {
                                "alt": "blue sky",
                                "image": {
                                    "cid": "bafkreifnoqdfn3jup6gqjmsnmyhq35wet6nadqbgcvfgrsqafxtpgdplky",
                                    "mimeType": "image/jpeg"
                                }
                            }
                        ]
                    },
                    "createdAt": "2023-04-01T19:00:44.040616Z"
                },
                "embed": {
                    "$type": "app.bsky.embed.images#view",
                    "images": [
                        {
                            "thumb": "https://cdn.bsky.social/imgproxy/4l1YmyNHPo_ucEkuPlGOoQ0hb5zyBAzuLntL4zi1XTc/rs:fit:1000:1000:1:0/plain/bafkreifnoqdfn3jup6gqjmsnmyhq35wet6nadqbgcvfgrsqafxtpgdplky@jpeg",
                            "fullsize": "https://cdn.bsky.social/imgproxy/WBNJ-APINV1zsRVGNB79xgniH_uhMbNsdrHsvHaUoxE/rs:fit:2000:2000:1:0/plain/bafkreifnoqdfn3jup6gqjmsnmyhq35wet6nadqbgcvfgrsqafxtpgdplky@jpeg",
                            "alt": "blue sky"
                        }
                    ]
                },
                "replyCount": 0,
                "repostCount": 3,
                "likeCount": 17,
                "indexedAt": "2023-04-01T19:00:44.313Z",
                "viewer": {
                    "repost": "at://did:plc:o2hywbrivbyxugiukoexum57/app.bsky.feed.repost/3jsdxedsjs22n"
                }
            },
            "reason": {
                "$type": "app.bsky.feed.defs#reasonRepost",
                "by": {
                    "did": "did:plc:o2hywbrivbyxugiukoexum57",
                    "handle": "klatz.co",
                    "displayName": "ian",
                    "avatar": "https://cdn.bsky.social/imgproxy/GJx4y5xTsEPFOxKrSQWNr6ya9JVsHxPuuTgobe6FaSU/rs:fill:1000:1000:1:0/plain/bafkreihzhtpsabgwzod3455oraevg6t5oz4nyll4jdxc72sms33rucs5ne@jpeg",
                    "viewer": {
                        "muted": false
                    }
                },
                "indexedAt": "2023-04-02T00:14:49.184Z"
            }
        }
    ],
    "cursor": "1680125969668::bafyreig6g7y3e5sr4znavvjmfod45xxhuah6h7x6cyydmvmqhtjec476oe"
}

@devinivy
Copy link
Collaborator

Closing as stale (and I think also answered!). If there are any loose ends, we can reopen or create a new issue 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants