snarfed / bridgy-fed

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

support Lemmy #372

Open snarfed opened 1 year ago

snarfed commented 1 year ago

Background:

I tried federating this like to this post on lemmy.ml (running BE 0.16.7) just now, and the AP inbox delivery to https://lemmy.ml/u/OptimusPrime/inbox returned 400 with invalid type: map, expected a string representing an URL at line 1 column 218. Bridgy Fed log here. Full AS2 object below.

Lemmy's design looks like Reddit, with up/downvotes instead of likes, so I don't know that it actually supports likes, but the error message sounds unrelated to that, more like maybe it can only handle string URLs for actors instead of compound objects.

{
  "published": "2023-01-17T13:03:52-08:00",
  "content": "likes <a class=\"u-like u-like-of\" href=\"https://lemmy.ml/post/713841\">[lemmy.ml](http://lemmy.ml/)</a>",
  "url": "https://fed.brid.gy/r/https://snarfed.org/2023-01-17_lemmy-ml",
  "actor": {
    "url": "https://fed.brid.gy/r/https://snarfed.org/",
    "image": {
      "url": "https://secure.gravatar.com/avatar/947b5f3f323da0ef785b6f02d9c265d6?s=96&d=blank&r=g",
      "type": "Image"
    },
    "type": "Person",
    "name": "Ryan Barrett",
    "icon": {
      "url": "https://secure.gravatar.com/avatar/947b5f3f323da0ef785b6f02d9c265d6?s=96&d=blank&r=g",
      "type": "Image"
    },
    "id": "https://fed.brid.gy/snarfed.org",
    "preferredUsername": "[snarfed.org](http://snarfed.org/)"
  },
  "@context": "https://www.w3.org/ns/activitystreams",
  "type": "Like",
  "object": "https://lemmy.ml/post/713841",
  "id": "https://fed.brid.gy/r/https://snarfed.org/2023-01-17_lemmy-ml",
  "cc": [
    "https://lemmy.ml/u/OptimusPrime",
    "https://lemmy.ml/c/privacy",
    "https://www.w3.org/ns/activitystreams#Public"
  ],
  "to": [
    "https://www.w3.org/ns/activitystreams#Public"
  ]
}
snarfed commented 1 year ago

From https://socialhub.activitypub.rocks/t/help-improving-federation-between-lemmy-and-other-projects/2308/22 :

You are right this isnt complicated, in fact we are already doing the same thing in some other places. Unfortunately I dont have time to work on this, but if you want to make a contribution I would gladly guide you through the code.

snarfed commented 1 year ago

Progress is a new error message. After #442, we're now getting HTTP 400 data did not match any variant of untagged enum PersonOrGroup on this Like:

{
  "published": "2023-10-11T21:12:28-07:00",
  "content": "Likes <a class=\"u-like-of\" href=\"https://lemmy.world/post/6663494\">https://lemmy.world/post/6663494</a>;..\n<div class=\"e-content\">\nA meme for math people – Lemmy.world\n</div>",
  "url": "https://fed.brid.gy/r/https://snarfed.org/2023-10-11_a-meme-for-math-people-lemmy-world",
  "actor": "https://fed.brid.gy/snarfed.org",
  "id": "https://fed.brid.gy/r/https://snarfed.org/2023-10-11_a-meme-for-math-people-lemmy-world",
  "@context": "https://www.w3.org/ns/activitystreams",
  "type": "Like",
  "object": "https://lemmy.world/post/6663494",
  "cc": [
    "https://lemmy.ml/c/memes",
    "https://lemmy.world/u/hypertown",
    "https://www.w3.org/ns/activitystreams#Public"
  ],
  "to": [
    "https://www.w3.org/ns/activitystreams#Public"
  ]
}
snarfed commented 1 year ago

And for this reply, 400 Client Error: Bad Request for url: https://lemmy.world/u/hypertown/inbox ; deserializing body: ...

{
  "id": "https://fed.brid.gy/r/https://snarfed.org/2023-10-11_a-meme-for-math-people-lemmy-world-3#bridgy-fed-create",
  "actor": "https://fed.brid.gy/snarfed.org",
  "published": "2023-10-12T04:17:52.463875+00:00",
  "@context": "https://www.w3.org/ns/activitystreams",
  "type": "Create",
  "object": {
    "published": "2023-10-11T21:17:47-07:00",
    "content": "<a class=\"u-in-reply-to\" href=\"https://lemmy.world/post/6663494\"></a>\n<div class=\"e-content\">\nnice\n</div>",
    "url": "https://fed.brid.gy/r/https://snarfed.org/2023-10-11_a-meme-for-math-people-lemmy-world-3",
    "id": "https://fed.brid.gy/r/https://snarfed.org/2023-10-11_a-meme-for-math-people-lemmy-world-3",
    "type": "Note",
    "attributedTo": "https://fed.brid.gy/snarfed.org",
    "inReplyTo": "https://lemmy.world/post/6663494",
    "cc": [
      "https://lemmy.ml/c/memes",
      "https://lemmy.world/u/hypertown",
      "https://www.w3.org/ns/activitystreams#Public"
    ],
    "tag": [
      {
        "type": "Mention",
        "href": "https://lemmy.world/u/hypertown"
      }
    ],
    "to": [
      "https://www.w3.org/ns/activitystreams#Public"
    ]
  },
  "to": [
    "https://www.w3.org/ns/activitystreams#Public"
  ]
}
snarfed commented 1 year ago

Progress is a new error message. After #442, we're now getting HTTP 400 data did not match any variant of untagged enum PersonOrGroup on this Like:

This also happens on follows.

snarfed commented 1 year ago

More on this error:

gaviscapes commented 9 months ago

Is there any progress on this at all? The recent lemmy update made some heavy changes and improved the API significantly.

snarfed commented 9 months ago

Exciting! Last I checked, we were blocked on Lemmy errors, details above. Feel free to test again and see if anything has changed!

Nutomic commented 8 months ago

Lemmy maintainer here, just came across this. I threw this activity into Lemmy tests, and it fails because the Create activity is missing cc field. You need to copy that from the inner Note.

By the way, Lemmy users view Bridgy Fed generally positively, as they consider all posts to be public anyway. So theres no need for complicated opt-in solutions in case of Lemmy. Here you can see the discussion. And another one.