ckolderup / postmarks

a single-user bookmarking website designed to live on the Fediverse
https://postmarks.glitch.me
MIT License
464 stars 38 forks source link

Federation Compatibility #124

Open kvibber opened 1 year ago

kvibber commented 1 year ago

I've set up a test instance of Postmarks, and tried linking it up with various other Fediverse accounts I have. I was only able to get following to work - in either direction - with Mastodon.

I tried following the Postmarks account with: GoToSocial, Takahe, Snac2, Firefish, and Akkoma. Some could find the Postmarks profile when I searched for it, but couldn't follow it.

I also tried following each of those, plus a Lemmy user, from Postmarks. Again, Mastodon was the only one that succeeded.

It's late right now, so I wanted to just get the issue written down, but I'll gather some debug info when I get a chance.

andypiper commented 1 year ago

Tracking this, thanks for reporting. FWIW the initial ActivityPub piece of this Postmarks was based on https://github.com/dariusk/express-activitypub and there may be some upstream improvements this repo could benefit from, otherwise[^1] features e.g. nodeinfo support and others have been grafted in as it has evolved.

[2023-9-21 9:9:21] POST:/admin/following/follow 200 0.006ms
Unexpected token N in JSON at position 0
[2023-9-21 9:16:46] POST:/admin/following/follow 200 0.003ms
Couldn't find inbox at supplied profile url https://metapixl.com/users/forgeandcraft

An inbound follow from PixelFed works.

[2023-9-21 9:17:56] POST:/admin/following/follow 200 0.002ms
couldn't look up canonical actor info
Invalid URL
[2023-9-21 9:43:58] POST:/admin/following/follow 200 0.004ms
couldn't look up canonical actor info
Invalid URL

I'm fairly sure that some of these are due to #77 and the usernames including a leading @ (or not).

[^1]: Irrelevant as it looks like the codebases implement the same AP features at this point

steve-bate commented 1 year ago

What do you think about creating a wiki page with a table showing the federation status for various platforms? I'd be willing to help track down issues, as time permits.

andypiper commented 1 year ago

Yep, that's probably what we need to do here! I think only @ckolderup currently has the ability to do that on the wiki here for now.

ckolderup commented 1 year ago

thanks @kvibber for opening this up, this is definitely something that would be great to improve. And I just opened a separate issue #128 to do some more meta-discussion about permissions, project organization, and governance 🙀

jeffsikes commented 11 months ago

Just adding some notes I've seen while testing. These are all inbound follows.

Other postmarks users Always seems to work.

Mastodon Always seems to work for me.

Firefish and IceShrimp A follow request never reaches the Postmarks server, it just spins as "Processing" on the servers and at least I never see it in the Postmarks logs.

Friendica Friendica is reporting a valid follow, but on Postmarks it doesn't go through. I see in the postmarks logs this message: Error: Couldn't find inbox at supplied profile url https://venera.social/profile/box464

GoToSocial I have my own GtS instance and it's running on the same docker container as Postmarks. So this is easy to test. Unfortunately I don't see this 400 exception in the Postmark logs. Maybe I'm looking in the wrong spot.

timestamp="22/10/2023 21:19:40.929" func=httpclient.(*Client).DoSigned level=INFO method=POST url=https://bookmarks.box464.com/api/inbox requestID=y2pn8pmb04001pz7hv00 pubKeyID=https://gts.scoobysnack.net/users/zoinks/main-key msg="performing request"

timestamp="22/10/2023 21:19:40.935" func=workers.(*Processor).EnqueueClientAPI.func1 level=ERROR requestID=y2pn8pmb04001pz7hv00 msg="error processing client API message: CreateFollowReq: error federating follow: Follow: error sending activity *typefollow.ActivityStreamsFollow via outbox https://gts.scoobysnack.net/users/zoinks/outbox: func1: error delivering to https://bookmarks.box464.com/api/inbox: deliver: POST request to https://bookmarks.box464.com/api/inbox failed: status=\"400 Bad Request\" body=\"Bad Request\""

Pixelfed Pixelfed shows a successful follow, but really the Postmark site isn't getting it? I don't see any logs at least.

andypiper commented 8 months ago

Related - #185 Looking into some of these issues now.

kvibber commented 7 months ago

Possibly relevant error log entry for GoToSocial:

timestamp="23/02/2024 06:02:10.222" func=dereferencing.(*Dereferencer).RefreshAccount level=ERROR requestID=ba9rxn4d04001yfkypbg msg="error enriching remote account: enrichAccount: error dereferencing https://bookmarks.kvibber.com/u/interesting: Dereference: non activity streams response: application/json; charset=utf-8"

It looks like another case where GoToSocial is more strictly enforcing the spec than most AP software. It may be expecting one of these types for the response:

application/activity+json
application/activity+json; charset=utf-8
application/ld+json; profile="https://www.w3.org/ns/activitystreams"
kvibber commented 4 months ago

Progress!

I changed the content-type and accept in signature.js to application/activity+json, and then I followed @andypiper 's suggestion in #191 and patched user.js to add

res.type('application/ld+json; profile="https://www.w3.org/ns/activitystreams"');

to the actor response, and now my GoToSocial instance is able to retrieve my Postmarks profile.

Following doesn't work yet. The log entry on the GTS side:

timestamp="07/05/2024 21:48:24.799" func=workers.(*clientAPI).CreateFollowReq level=ERROR requestID=sg08gnmf04001j7fztgg msg="error federating follow request: Follow: error sending activity *typefollow.ActivityStreamsFollow via outbox https://notes.kvibber.com/users/kelson/outbox: func1: error delivering to https://bookmarks.kvibber.com/api/inbox: deliver: POST request to https://bookmarks.kvibber.com/api/inbox failed: status=\"400 Bad Request\" body=\"Bad Request\""