Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Federated following #19981

Closed
wants to merge 150 commits into from
Closed

WIP: Federated following #19981

wants to merge 150 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Jun 15, 2022

This pull request implements ActivityPub-federated following so users on a Gitea instance can follow users on any other ActivityPub server (Gitea, Mastodon, PeerTube, Pleroma, etc) and vice versa.

Since #19133 hasn't been merged yet, this PR is currently meant for discussing high-level changes like remote users instead of reviewing the code. (If you want to view the code changes, I made a PR on my personal Gitea repository with that)

Why federated following?

Federated following seems like an odd choice for the first federated behavior for Gitea, but it is actually a good place to start:

  1. Following uses only plain AP (ActivityPub) and doesn't require ForgeFed (which is unsupported by go-ap).
  2. Federated following only requires implementing remote federated users. I say "only" because things like federated pull requests and issues also require handling remote repos which is a whole other tricky issue to resolve.
  3. Federated following requires most of the core ActivityPub components like inboxes and outboxes to work, so this PR already does much of the most difficult work and supporting other activity types should be a lot easier.

Inboxes and outboxes

The first commit implements basic inbox and outbox handling. Since we are not implementing C2S ActivityPub for Gitea, the inbox is not persisted to the database and the outbox reuses the Action table for database storage.

Currently, go-ap does not yet support any of the ForgeFed activity types. As a result, this PR does not implement any type-specific processing (so it currently just returns an empty outbox).

In the future, we will add more ActionTypes for the various AP activity types that we wish to support.

Additional information: #5

Remote users

This PR currently stores remote users in the database using the new LoginType Federated, and stores the full username@instance.com as the username and the ActivityPub IRI as the user's website (which is very hacky and needs to be changed). When viewing a remote user's profile in the web UI, you are redirected to their instance.

Additional information: #2

UI

Currently, this PR only adds the backend code for federated following, so there is no UI (yet) for federated following. From the end user's perspective, that means they will at the moment only be able to follow Gitea accounts using non-Gitea AP software like Mastodon, since there is no UI to follow an AP account remotely from a Gitea instance.

TODO

Loïc Dachary and others added 30 commits March 18, 2022 17:33
go get github.com/go-fed/activity/streams@master
go get github.com/go-fed/activity/pub@master
go get github.com/go-fed/httpsig@master
Return informations regarding a Person (as defined in ActivityStreams
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-person).

Refs: #14186

Signed-off-by: Loïc Dachary <loic@dachary.org>
Refs: #14186

Signed-off-by: Loïc Dachary <loic@dachary.org>
Signed-off-by: Loïc Dachary <loic@dachary.org>
Signed-off-by: Loïc Dachary <loic@dachary.org>
Signed-off-by: Loïc Dachary <loic@dachary.org>
Signed-off-by: Loïc Dachary <loic@dachary.org>
Signed-off-by: Anthony Wang <ta180m@pm.me>
Signed-off-by: Anthony Wang <ta180m@pm.me>
Signed-off-by: Anthony Wang <ta180m@pm.me>
Signed-off-by: Anthony Wang <ta180m@pm.me>
Signed-off-by: Anthony Wang <ta180m@pm.me>
Signed-off-by: Anthony Wang <ta180m@pm.me>
Signed-off-by: Anthony Wang <ta180m@pm.me>
Signed-off-by: Anthony Wang <ta180m@pm.me>
Signed-off-by: Anthony Wang <ta180m@pm.me>
@6543 6543 added this to the 1.18.0 milestone Jun 17, 2022
@6543 6543 added status/blocked This PR cannot be merged yet, i.e. because it depends on another unmerged PR pr/wip This PR is not ready for review topic/federation labels Jun 17, 2022
@Gusted
Copy link
Contributor

Gusted commented Jun 18, 2022

Current code review is happening at: https://gitea.com/Ta180m/gitea/pulls/6

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jun 18, 2022
@ghost
Copy link
Author

ghost commented Jun 19, 2022

I'm closing this pull request since I need to rebase the changes onto the Gitea main branch. I'll submit a new PR tomorrow.

@ghost ghost closed this Jun 19, 2022
@genofire
Copy link

(And that is not possible here, with an git push --force-with-lease )

@lunny lunny removed this from the 1.18.0 milestone Dec 20, 2022
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. pr/wip This PR is not ready for review status/blocked This PR cannot be merged yet, i.e. because it depends on another unmerged PR topic/federation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants