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

Move resolving of activitypub objects to separate api endpoint #1666

Merged
merged 2 commits into from
Aug 23, 2021

Conversation

Nutomic
Copy link
Member

@Nutomic Nutomic commented Jul 20, 2021

Test with:

curl -G -X GET -d "q=!main@lemmy-gamma:8561" http://localhost:8540/api/v3/resolve_object | jq
curl -G -X GET -d "q=http://lemmy-beta:8541/post/1" http://localhost:8540/api/v3/resolve_object | jq
etc

We can use this opportunity to move the functionality to a separate place in lemmy-ui, which should make it easier to discover and explain. Not sure exactly where that should be though.

This is a breaking change (maybe we should just create a label for that).

.href
.to_owned()
.ok_or_else(|| anyhow!("No href found.").into())
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now I'm just moving things to the library whenever that makes sense. Later I need to figure out how to remove the dependencies on lemmy crates (eg passing local domain to the library somehow, instead of depending on Settings).

@Nutomic
Copy link
Member Author

Nutomic commented Jul 20, 2021

Federation tests are broken, I believe lemmy-js-client needs to be updated first to add the new API method.

@dessalines
Copy link
Member

I'm not getting anything back from the requests:

curl -G -X GET -d "q=!main@lemmy-beta:8540" http://localhost:8541/api/v3/resolve_object
error sending request for url (http://lemmy-beta:8540/.well-known/webfinger?resource=group:main@lemmy-beta:8540): error trying to connect: tcp connect error: Connection refused (os error 111)

...

curl -G -X GET -d "q=!main@lemmy-gamma:8540" http://localhost:8541/api/v3/resolve_object
error sending request for url (http://lemmy-gamma:8540/.well-known/webfinger?resource=group:main@lemmy-gamma:8540): error trying to connect
: tcp connect error: Connection refused (os error 111)

Also this is the very first enum response, so I'm trying to debug what it looks like and if its possible to key on it.

@Nutomic
Copy link
Member Author

Nutomic commented Jul 22, 2021

You need to put the correct, corresponding port, eg lemmy-beta:8551 or lemmy-gamma:8561, which is where that backend is running. And the last digit of the port needs to be 1 so it connects to the backend, not the frontend.

@dessalines
Copy link
Member

Ah, looks like it needs rebased again.

@dessalines
Copy link
Member

Might be a bit before I add this to lemmy-UI. The webfinger requests require https, and working federation, which makes this a bit difficult to test.

lemmy_1 | [2021-08-20T03:05:23Z DEBUG lemmy_apub_lib::webfinger] Fetching webfinger url: https://my_domain/.well-known/webfinger?resour ce=group:main@my_domain

@Nutomic
Copy link
Member Author

Nutomic commented Aug 21, 2021

It works fine using docker/federation, no https needed. Only thing to keep in mind is if you want to fetch an actor from lemmy-gamma, you need to open the instance in your browser first so it gets initialized. Also rebased.

Copy link
Member

@dessalines dessalines left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests passed, feel free to merge anytime.

@Nutomic Nutomic merged commit e413350 into main Aug 23, 2021
@Nutomic
Copy link
Member Author

Nutomic commented Aug 23, 2021

Didnt even notice that your PR was against my branch again, so confusing 😂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants