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

Improve lemmy compatibility #752

Merged
merged 16 commits into from
May 16, 2024
Merged

Improve lemmy compatibility #752

merged 16 commits into from
May 16, 2024

Conversation

pfefferle
Copy link
Member

Improve the compatibility with lemmy! Thanks @Nutomic for the feedback https://socialhub.activitypub.rocks/t/discourse-wordpress-integration/4162/13?u=pfefferle

@Nutomic
Copy link

Nutomic commented May 2, 2024

That's great! You can test it with voyager.lemmy.ml which has the latest changes deployed.

@pfefferle pfefferle marked this pull request as ready for review May 3, 2024 07:12
@pfefferle
Copy link
Member Author

@Nutomic can you approve my request?

@pfefferle pfefferle requested a review from mattwiebe May 3, 2024 07:20
@Nutomic
Copy link

Nutomic commented May 3, 2024

Ive approved it.

@pfefferle
Copy link
Member Author

pfefferle commented May 3, 2024

@Nutomic I messed up my password and it seems to not send password reset mails 🫣

@Nutomic
Copy link

Nutomic commented May 3, 2024

It should be able to send emails, maybe it went to spam? Otherwise just register another account.

@pfefferle
Copy link
Member Author

made a second account

@pfefferle
Copy link
Member Author

@Nutomic OK, seems to work, at least following, but posts seems to not be federated properly?!?

Here is an example JSON: https://pfefferle.org/hello-lemmy-part2/?activitypub

@Nutomic
Copy link

Nutomic commented May 3, 2024

I was able to fetch it without any problems. Maybe Lemmy couldnt parse the activity you sent? Can you show the json for that?

@pfefferle
Copy link
Member Author

All test posts here: https://pfefferle.org/

You can add ?activitypub at the end of each post to see the JSON.

@pfefferle
Copy link
Member Author

I will try to debug the Lemmy response later today!

@pfefferle
Copy link
Member Author

FYI: The post will be federated by the User and Announced by the Group. But the Announce Object is only the Link to the Post, is that supported by Lemmy or does it need the full object as the Announce object?

@pfefferle
Copy link
Member Author

@Nutomic the request is:

{
    "@context": [
        "https:\/\/www.w3.org\/ns\/activitystreams"
    ],
    "id": "https:\/\/pfefferle.org\/lemmy-part-4\/#activity",
    "type": "Announce",
    "published": "2024-05-03T12:32:29Z",
    "updated": "2024-05-06T08:03:39Z",
    "to": [
        "https:\/\/www.w3.org\/ns\/activitystreams#Public",
        "https:\/\/pfefferle.org\/wp-json\/activitypub\/1.0\/actors\/0\/followers"
    ],
    "cc": [],
    "object": "https:\/\/pfefferle.org\/lemmy-part-4\/",
    "actor": "https:\/\/pfefferle.org\/@pfefferle.org"
}

The response is:

[body] => {"error":"unknown","message":""}
[response] => Array
   (
        [code] => 400
        [message] => Bad Request
   )

@pfefferle
Copy link
Member Author

Tried it with object instead of URI, with the same result: Error 400

{
    "@context": [
        "https:\/\/www.w3.org\/ns\/activitystreams"
    ],
    "id": "https:\/\/pfefferle.org\/lemmy-part-4\/#activity#activity",
    "type": "Announce",
    "audience": "https:\/\/pfefferle.org\/@pfefferle.org",
    "published": "2024-05-03T12:32:29Z",
    "updated": "2024-05-06T08:20:33Z",
    "to": [
        "https:\/\/www.w3.org\/ns\/activitystreams#Public",
        "https:\/\/pfefferle.org\/wp-json\/activitypub\/1.0\/actors\/1\/followers"
    ],
    "cc": [],
    "object": {
        "id": "https:\/\/pfefferle.org\/lemmy-part-4\/#activity",
        "type": "Update",
        "audience": "https:\/\/pfefferle.org\/@pfefferle.org",
        "published": "2024-05-03T12:32:29Z",
        "updated": "2024-05-06T08:20:33Z",
        "to": [
            "https:\/\/www.w3.org\/ns\/activitystreams#Public",
            "https:\/\/pfefferle.org\/wp-json\/activitypub\/1.0\/actors\/1\/followers"
        ],
        "cc": [],
        "object": {
            "id": "https:\/\/pfefferle.org\/lemmy-part-4\/",
            "type": "Article",
            "attachment": [],
            "attributedTo": "https:\/\/pfefferle.org\/author\/pfefferle\/",
            "audience": "https:\/\/pfefferle.org\/@pfefferle.org",
            "content": "\u003Cp\u003EIdentifies one or more entities that represent the total population of entities for which the object can considered to be relevant. Identifies one or more entities that represent the total population of entities for which the object can considered to be relevant.Identifies one or more entities that represent the total population of entities for which the object can considered to be relevant.Identifies one or more entities that represent the total population of entities for which the object can considered to be relevant.Identifies one or more entities that represent the total population of entities for which the object can considered to be relevant.Identifies one or more entities that represent the total population of entities for which the object can considered to be relevant.Identifies one or more entities that represent the total population of entities for which the object can considered to be relevant.          \u003C\/p\u003E",
            "contentMap": {
                "en": "\u003Cp\u003EIdentifies one or more entities that represent the total population of entities for which the object can considered to be relevant. Identifies one or more entities that represent the total population of entities for which the object can considered to be relevant.Identifies one or more entities that represent the total population of entities for which the object can considered to be relevant.Identifies one or more entities that represent the total population of entities for which the object can considered to be relevant.Identifies one or more entities that represent the total population of entities for which the object can considered to be relevant.Identifies one or more entities that represent the total population of entities for which the object can considered to be relevant.Identifies one or more entities that represent the total population of entities for which the object can considered to be relevant.          \u003C\/p\u003E"
            },
            "name": "Lemmy (Part 4)",
            "published": "2024-05-03T12:32:29Z",
            "summary": "Identifies one or more entities that represent the total population of entities for which the object can considered to be relevant. Identifies one or more entities that represent the total population of entities for which the object can considered to be relevant.Identifies one or more entities that represent the total population of entities for which the object can considered to be relevant.Identifies one or more entities that represent the total population of entities for which the object [...]",
            "tag": [],
            "updated": "2024-05-06T08:20:33Z",
            "url": "https:\/\/pfefferle.org\/lemmy-part-4\/",
            "to": [
                "https:\/\/www.w3.org\/ns\/activitystreams#Public",
                "https:\/\/pfefferle.org\/wp-json\/activitypub\/1.0\/actors\/1\/followers"
            ],
            "cc": []
        },
        "actor": "https:\/\/pfefferle.org\/author\/pfefferle\/"
    },
    "actor": "https:\/\/pfefferle.org\/@pfefferle.org"
}

@Nutomic
Copy link

Nutomic commented May 6, 2024

Right Lemmy only supports Announce with embedded object for now, no link. Ive thrown the last activity you sent into our tests and it passes just fine (after replacing \/ with /).

Looking at voyager.lemmy.ml, it appears that you sent an activity with the same id https://pfefferle.org/lemmy-part-4/#activity three days ago already. That means Lemmy will reject it as duplicate. You need to generate a new activity id if you want to send something new.

@pfefferle
Copy link
Member Author

OK, I have a working version now! 🎉

Screenshot 2024-05-07 at 12 30 21

@Nutomic any chance that Lemmy will support URI objects soon? I am not sure if it is a good idea to change the current implementation, because I fear to break something else... 🫣

@Nutomic
Copy link

Nutomic commented May 14, 2024

any chance that Lemmy will support URI objects soon? I am not sure if it is a good idea to change the current implementation, because I fear to break something else... 🫣

Unfortunately I wont be able to implement that anytime soon.

@pfefferle
Copy link
Member Author

@Nutomic ok, then I will see how other platforms handle Announce objects, to get this merged.

@pfefferle pfefferle merged commit 3fde5bb into master May 16, 2024
21 checks passed
@pfefferle pfefferle deleted the fix/lemmy-support branch May 16, 2024 15:30
@pfefferle
Copy link
Member Author

pfefferle commented Jun 6, 2024

@Nutomic It seems that I receive a 400 error on the Accept I sent to lemmy (@pfefferle.org@pfefferle.org)

Can you maybe help with debugging?

Here is an example of an Accept

{
    "@context": [
        "https:\/\/www.w3.org\/ns\/activitystreams"
    ],
    "id": "https:\/\/pfefferle.org\/@pfefferle.org#follow-lemmy.ml\/u\/pfefferle-1717694756",
    "type": "Accept",
    "to": "https:\/\/lemmy.ml\/u\/pfefferle",
    "object": {
        "id": "https:\/\/lemmy.ml\/activities\/follow\/2fdfb3f2-9f7e-44bf-bf26-c0d2cb371ebc",
        "type": "Follow",
        "object": "https:\/\/pfefferle.org\/@pfefferle.org",
        "actor": "https:\/\/lemmy.ml\/u\/pfefferle"
    },
    "actor": "https:\/\/pfefferle.org\/@pfefferle.org"
}

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

Successfully merging this pull request may close these issues.

None yet

2 participants