this post was submitted on 29 Dec 2024
76 points (95.2% liked)

Fediverse

29582 readers
738 users here now

A community to talk about the Fediverse and all it's related services using ActivityPub (Mastodon, Lemmy, KBin, etc).

If you wanted to get help with moderating your own community then head over to [email protected]!

Rules

Learn more at these websites: Join The Fediverse Wiki, Fediverse.info, Wikipedia Page, The Federation Info (Stats), FediDB (Stats), Sub Rehab (Reddit Migration), Search Lemmy

founded 2 years ago
MODERATORS
 

Let's say we have lemmy instances A, B, C.

alice from A makes a post "Hello, world" to B. What happens? How is it processed on servers A, B, C and how do users from A, B, C receive her post?

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 54 points 1 month ago* (last edited 1 month ago) (19 children)

alice from A makes a post “Hello, world” to B

Alice can't make a post to B, but I assume you mean a community on B, let's call it foo. When Alice makes a post it first goes through A's local API and creates the local (and canonical) version of Alice's post. Once A has finished processing Alice's post, it will create an ActivityPub representation of Alice's post to send to B.

ActivityPub is basically a bunch of assumptions laid on top of JSON. An ActivityPub 'file' can be divided into broadly 3 types, Object, Activity and actors.[^note1] These types then have subtypes; for example, both Alice and foo are actors but Alice is a Person while foo is a Group.

A second important assumption of ActivityPub is the concept of inboxs and outboxs, but, for Lemmy, only inboxs matter. An inbox is just a URL where Lemmy can send activities and it's something all actors have.

So when instance A is finished processing Alice's post, it will turn it into a Page object, wrap that in a Create activity and send it foo's inbox.

Round about what the JSON would look like

{
  "@context": [
    "https://join-lemmy.org/context.json",
    "https://www.w3.org/ns/activitystreams"
  ],
  "actor": "https://a/u/alice",
  "type": "Create",
  "to": ["https://www.w3.org/ns/activitystreams#Public"],
  "cc": ["https://b/c/foo"],
  "id": "https://a/activities/create/19199919009100",
  "object": {
    "type": "Page",
    "id": "https://a/post/1",
    "attributedTo": "https://a/u/alice",
    "to": [
      "https://b/c/foo",
      "https://www.w3.org/ns/activitystreams#Public"
    ],
    "audience": "https://b/c/main",
    "name": "Hello world",
    "attachment": [],
    "sensitive": false,
    "language": {
      "identifier": "en",
      "name": "English"
    },
    "published": "2024-12-29T15:10:51.557399Z"
  }
}


.

Now instance B will then receive this and do the same kind of processing A did when Alice created the post via the API. Once it has finished, it will turn the post back into a Page but this time wrap it in an Announce activity. B will then look at all the actors that follow the foo (i.e. are subscribed to it) and send this Announce to all of their inboxs. Assuming a user on instance C follows foo, it will receive this Announce and process it like A and B before it, creating the local version of Alice's post.

Edit: I made a small mistake, I said that foo wrapped the Page in an Announce, when it actually wraps the Create in an Announce.

[^note1]: Technically, Activity and actors are themselves objects, but they're treated differently. There's also Collection's which are their own type, but Lemmy doesn't really utilise them.

[–] [email protected] 1 points 1 month ago (2 children)

Why does a mastodon user get completely different profiles and history when viewed from different lemmy instances? They look like 2 completely different users when compared except for having the same @address. In fact this makes them immune from moderation if they comment from a different instance than the mod is on.

[–] [email protected] 4 points 1 month ago (1 children)

Mastodon doesn't have Group support (fep-1b12), so when they reply to a post, they don't send it to the community's inbox (only to the inbox of the Person they're replying to), thus breaking Lemmy's model of federation.

[–] [email protected] 2 points 1 month ago
load more comments (16 replies)