Help improving federation between Lemmy and other projects

it should be trivial to just extract the id from the inlined actor if you really must fetch it…

ideally, regardless of whether you used json or json-ld, you would be using a partial hydration strategy to expand the object (or graph) as needed. meaning, you would store nodes by their id and inject them into the json object (or the json-ld graph) as needed from your cache or via a network request.

example: you try to access actor.name but fail because that node has not been hydrated yet:

{
  "actor": "https://fed.brid.gy/snarfed.org",
  "object": "http://ds9.lemmy.ml/comment/1",
  "audience": "https://enterprise.lemmy.ml/c/tenforward",
  "type": "Like",
  "id": "https://fed.brid.gy/activities/like/fd61d070-7382-46a9-b2b7-6bb253732877"
}

so you try to expand the actor property:

{
  "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"
  },
  "object": "http://ds9.lemmy.ml/comment/1",
  "audience": "https://enterprise.lemmy.ml/c/tenforward",
  "type": "Like",
  "id": "https://fed.brid.gy/activities/like/fd61d070-7382-46a9-b2b7-6bb253732877"
}

now you can access actor.name successfully.

this way, if you are given an inline representation that you trust, you can just use it as-is. if you don’t trust it or it is not there, you can replace that node with a trusted version.

1 Like

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.

1 Like

Integration with Hubzilla would be nice. Hubzilla already has discussion groups (which it calls public forums) so it already understands what a forum is. That would make federation between Lemmy and Hubzilla easier.

Right now Hubzilla’s interface more closely resembles a discussion group than a forum, but I am actually working on changing that by creating new views and themes that give it a more traditional forum interface.

The best way to federate would be to use Hubzilla’s native Zot6 protocol, but considering that most platforms use ActivityPub, you might get “more bang for the buck” by using that protocol instead. (It should be noted that ActivityPub is an addon in Hubzilla, so the site admin must activate it.)

An alternative would be to use OpenWebAuth, which would allow people to remotely authenticate with their existing social identity. If you integrate that technology, people from Lemmy and Hubzilla could remotely authenticate on each other’s website, and participate in each other’s forums with one social identity.

1 Like

Activitypub is definitely the way to go, because other approaches would require major new features in Lemmy.

In order to get federation working, I need examples of the json data which Hubzilla sends, such as actors, objects and activities. These files will be integrated with our test suite to make sure they can be parsed successfully. See this folder for examples from other projects. If you could send me this data it should be easy to make both projects compatible.

2 Likes

I’ll see what I can find. I am not a developer on the Hubzilla project, but I’ll try to figure it out. Maybe @macgirvin and @Mario can shed better light on how all this works on the back end.

One thing that frustrates me is that Hubzilla had to format its ActivityPub messages in a way that is compatible with Mastodon. And since Mastodon does not currently understand what a forum or group is, a lot of creative hacks had to be made to get forums to work with Mastodon. (As someone developing themes for Hubzilla, this affects me since it changes how the data is stored in the database.)

For example, since Mastodon will reject messages from people you don’t follow, the first post in a forum thread must be owned by the forum, and not the actual author. If it is not done this way, Mastodon users who follow the forum will not see new posts.

This may be changing as Mastodon is considering adding groups. This would mean that forums on Lemmy and Hubzilla don’t have to pretend to be a regular social media account to work with Mastodon.

1 Like

I still think OpenWebAuth is an important option to consider. It allows people to use their social identity as a log in. You could use one Lemmy account to log into any other Lemmy or Hubzilla or Streams or OpenWebAuth-compatible website. It allows people to participate directly on other websites, not just through their notifications on their own instance.

Ah I misunderstood. In that case it should be enough if you send me some links to different types of data on Hubzilla, specifically user and group profiles as well as different types of posts.

I commented here about Mastodon compatibility.

1 Like

Basically, there are four types of accounts: personal, public, community forum, and custom. Community forums behave slightly differently than the others.

I am not sure which forums have ActivityPub enabled, so I think the best thing to do would be to use a test forum. That way we can try all sorts of experiments without messing with a live channel.

If you want a local account, I can give you one. Eventually I will be opening up this website to anyone who wants to create an account, but the website is actually still at the pre-launch stage, so I limit who can sign up for now.

Here is an example of an ActivityPub-enabled public account (my account):

1 Like

On Lemmy (and Friendica and also gup.pe), group accounts are announcing the posts of their members. This works perfectly fine with a wide variety of implementations.

2 Likes

Recently someone asked, why he can’t subscribe to a Friendica group from Lemmy. I made a short test and saw that Lemmy seems to try to fetch the system actor from the root directory. Is this all or is there some more that Lemmy does to be able to subscribe to a group on another server?

1 Like

That should work in general, for example I am able to subscribe to https://forum.friendi.ca/profile/helpers from lemmy.ml without any problems. The system actor you mention is completely optional, its no problem if that returns an error. So if there is a problem I need more details.

I added some tests for Hubzilla data to Lemmy and they are passing without any code changes. So I suggest you try federating with an actual Lemmy instance like ds9.lemmy.ml and see if it works. One problem I noticed is that Hubzilla groups create posts directly instead of using announce, which means that content in Hubzilla groups cant be browsed from Lemmy. The other way might still work.

1 Like

Ah okay. Possibly there is a problem with the server that I tested with: lemmy.schuerz.at and I tried to subscribe to my development server: test1@pirati.ca

Which server do you recommend for having a test account to test all this stuff?