snarfed / bridgy-fed

🌉 A bridge between decentralized social network protocols
https://fed.brid.gy/
Creative Commons Zero v1.0 Universal
481 stars 28 forks source link

Bluesky: GIF support? (blocked on Bluesky) #1113

Open dploeger opened 3 weeks ago

dploeger commented 3 weeks ago

In this reply to a Bluesky user, the GIF wasn't available on Bluesky. Only the user handle was visible.

Sending a normal picture in a reply works though.

snarfed commented 3 weeks ago

Yes! Bluesky doesn't support GIFs as normal images, it has some kind of custom thing. Maybe Tenor specific? I haven't dug into it yet. First step here would be to find docs and understand what that custom GIF support is and how to integrate with it.

(BTW @dploeger this is the repo for Bridgy Fed, not https://github.com/snarfed/bridgy . That repo is for Bridgy classic, https://brid.gy/ , a separate service. https://brid.gy/about#bridgy-fed )

dploeger commented 3 weeks ago

Oh sorry. I was confused with the two. Thanks for investigating!

qazmlp commented 3 weeks ago

The gist is that Bluesky currently doesn't support custom gifs. (Tenor is essentially a searchable meme-library that users can pick existing stuff from.)

It's possible to submit gifs to Tenor off-site, but I'm pretty sure that doesn't mesh well with retaining control or even attribution over content.

dploeger commented 3 weeks ago

I actually thought the GIF would just be an attachment. Apparently it's way more complex than that.

qazmlp commented 3 weeks ago

I assume it will be an attachment, eventually, whenever Bluesky adds actual video support. For now it only has meme-support though.

(I checked the Tenor ToS and I don't think this is compatible with Bridgy in terms of requirements and what it does with the uploads.)

Edit: It would be good to link back to the original with a note that a gif/video wasn't bridged.

dploeger commented 3 weeks ago

Ohhh okay.

snarfed commented 3 weeks ago

OK you all got me morbidly curious in this 😆. As an example, here's the app.bsky.feed.post record for this post with a GIF:

{
   "cid" : "bafyreif6pd2quzdsunypranwhwpzvjunlymkjhmyulkhez644tpdejyp4e",
   "uri" : "at://did:plc:dcbbpup73qyoy465ivi365w7/app.bsky.feed.post/3ku2e7pmo5t23",
   "value" : {
      "$type" : "app.bsky.feed.post",
      "text" : "Hard to choose between this gif and a \"more!\" gif"
      "createdAt" : "2024-06-03T20:54:50.313Z",
      "embed" : {
         "$type" : "app.bsky.embed.external",
         "external" : {
            "description" : "ALT: Totally GIF",
            "thumb" : {
               "$type" : "blob",
               "mimeType" : "image/jpeg",
               "ref" : {
                  "$link" : "bafkreifgx43jldfxwrstya56izmdmhrulybzxyasn2mofu7hn3qbehp53a"
               },
               "size" : 607873
            },
            "title" : "Totally GIF",
            "uri" : "https://media.tenor.com/ZttURy99Kn8AAAAC/good-great.gif?hh=172&ww=250"
         }
      },
      "..."
   }
}

So, GIFs are an app.bsky.embed.external embed with a thumbnail JPG blob and uri pointing to the Tenor gif. bsky.app renders the embed as the GIF itself, animated.

The natural next step would be to try making a record like this with a GIF elsewhere and see if it still works. I'm guessing no, but it's possible.

qazmlp commented 3 weeks ago

I'm also thinking "no" since that'd enable IP grabbers. (The frontend loads these embeds directly from the target server.)

Maybe you could get them to allow-list Bridgy Fed for embeds though? The main downside is you'd potentially get hit with a lot of traffic due to the lack of cache there.

snarfed commented 3 weeks ago

Heard from the Bluesky team on Discord, sounds like the answer is no.

basically our GIFs have to use a very specific tenor media URL, and also include the height and width of gif in the url search params

As for allowlisting, BF doesn't currently host media, so they couldn't easily whitelist it. I could serve redirects, but that's only minimally useful, if at all.

qazmlp commented 3 weeks ago

Hitting the fedi instances' media servers directly from a foreign frontend would be very bad, yeah. (I don't think Bridgy currently hosts media, please correct me if I'm mistaken.)

snarfed commented 3 weeks ago

Right. I wouldn't plan to proxy the connections for those media files anyway, I'd just redirect. Regardless, all purely hypothetical right now.