larapeeps / larapeeps.com

9 stars 13 forks source link

Draft: Add ActivityPub support #16

Open inxilpro opened 1 year ago

inxilpro commented 1 year ago

Hi there,

I started hacking on ActivityPub support for this project, but I wanted to check in before I finish it up. There are a couple of questions:

  1. Are you interested in adding ActivityPub/Mastodon support?
  2. If so, would you like to go down this path, which relies on landrok/activitypub to add true ActivityPub support, or would you rather not add another dependency and instead use a more naive approach that makes some assumptions rather than using the full webfinger/etc APIs?
  3. If we do add ActivityPub support, are you OK with me refactoring to replace x_avatar_url with a more generic function that can use the person's ActivityPub icon if they don't use Twitter/X?

Here's an example of my <x-peoplelist /> entry after the PR as it currently stands:

image
ganyicz commented 1 year ago

Hey, thanks a lot!

I'm definitely open to it if that's where people hang out. Although I'm not familiar with ActivityPub/Mastodon myself, could you refer me to some articles I might read up on to get caught up?

My questions are:

  1. Is the activityPub() method making a request every time it's called or is there a caching mechanism in the server/webfinger class?
  2. From what I understand ActivityPub is a generic protocol although we're displaying mastodon icon next to it, can we integrate any other platforms using the protocol?
inxilpro commented 1 year ago

could you refer me to some articles I might read up on to get caught up?

Here's a great list of resources from a development point of view: https://codeberg.org/fediverse/delightful-activitypub-development

Is the activityPub() method making a request every time it's called or is there a caching mechanism in the server/webfinger class?

It's cached for 3600 seconds (1 hour) by default. We could probably push that significantly longer. The cache uses the filesystem—is that what you use in production?

From what I understand ActivityPub is a generic protocol although we're displaying mastodon icon next to it, can we integrate any other platforms using the protocol?

Mastodon is by far the most recognizable. We could potentially use the ontologies feature of the landrok package to identify the type of service associated with the handle. I would leave that for later, though, since the vast majority of folks are on mastodon.

ganyicz commented 1 year ago

Hey!

Thanks so much for the links. I looked at some of the resources but to be honest it feels very overwhelming and I will need at least couple days just to get a grasp of how this whole Mastodon/ActivityPub thing works to be able to maintain it

Although I'm definitely open to at least add Mastodon links to the profiles, is there a way to do that without the full server/webfinger implementation similar to how twitter and github links work now?

Also I agree about making the avatar generic and not tied to twitter, what about we just rename the variable to avatar_url so people can add any public link?