Alright folks, I really need some .

I'm trying to get an extremely basic AP setup going where people can follow a single account on a server and get automatically-generated updates when actions are performed. Specifically, I want to process followers and send a post to followers when someone adds a book to or removes one from Little Library. It's pretty much 100% server to server with very little client input beyond prompting the server to post.

So far, I have an outbox and a way to view posts. I'm trying to get that set up so I can start researching what I receive from a Mastodon follow request in order to learn what data to save and send Create activities to. But when I search for a specific post from Mastodon, it errors out with a 503 error from the Masto server...

Here is the folder of the repo with my implementation so far:

And here is my (temporary) live AP actor endpoint with a piece of live data:

Thanks in advance!

Β· Web Β· 5 Β· 19 Β· 3

@Alamantus I'll try to take a look if I can find time for it :)

@zatnosk I'd be very grateful if you can! No worries if you can't, though. :)

@Alamantus I’m not an expert, but a few of my thoughts:

I believe that in ActivityPub sending Create activities to followers doesn’t refer back to the original Follow request at all. The Create/Note is just sent to an actor whether it’s a follower or not. So a list of actor (webfinger) ids is all you would need to store to handle followers. However, ActivityPub servers will expect the server they send a Follow/Actor activity to, to send them an Accept/Follow (or Reject/Follow) eventually in a separate connection; this includes the original Follow. Some systems will do this by just storing the whole received thing (and all sent things), others by faking the original, presumably by at least remembering the activity id. But I’m totally not an expert!

I think you can leave out the Create activity if it just wraps an object like a Note; maybe I misunderstood from the spec.

Having the activity id and the object id the same doesn’t seem right. Take into account that the object of an activity can itself be an activity (e.g. the Accept/Follow).

@Alamantus I notice your actor doesn't have a `url` attribute, that might be it?

This actor is searchable, not all of those fields are required

@dansup So I updated the actor to be structured the same way as the fedidb actor you share in your last message, and Mastodon is still not finding it... The only thing I excluded was "following".

Any other guesses? The branch of the repo that I linked before has been updated with the current setup.

@Alamantus Hmm, strange. I noticed your webfinger doesn't have an aliases attribute, maybe that could be it?

I tested your actor with Pixelfed and its working as expected.

@dansup Hmm, that's worth a shot, I suppose. Lol I'll just try to get it to look as much like your fedidb account as possible!

That's very encouraging to see it working on Pixelfed, though! Except it should have 1 post in the outbox... hmm, one step at a time, I guess.

Thanks so much for helping!

@Alamantus I tried importing the post but its missing a context, thats likely why you can't search for the post.

@dansup Oh geez, you're right! I'll try adding that next. Thanks again for helping and being so patient with me!

@Alamantus I noticed you have both Create + Note objects, usually Create is only used for delivery to inboxes and it references the Note or whatever verb.

Here is an example object if it helps. And no problem, if you have any more questions let me know!

@dansup Ahh, ok, cool! That was one thing I wasn't sure about and couldn't really find a clear answer for when I looked. That gives me a lot to work with now

I'm sure I'll have more questions soon! Lol

@dansup So I'm pretty sure that I've got everything looking like the output for Mastodon, FediDB, and PixelFed, but searches still don't reveal my post(s). Mastodon's outboxes do contain the Create action with the Note object, so I kept that how I had it. The only thing I'm not doing is paginating my outbox because I really don't want to paginate it and according to the spec it should be fine...

PixelFed does find the actor, but not the new images I attached to it or the posts in the outbox... The HTTP headers don't seem to matter when comparing Mastodon to FediDB, so at this point I'm just a little lost about why it's not working...

Any other ideas?

@Alamantus hmm, im not sure, maybe @Gargron could help you figure this out.

I successfully followed your test actor from a Zap test account (and immediately removed it). So you're not too far off. I note that 'manuallyApprovesFollowers' is a Mastodon extension and needs to be declared in the context if you want LD signatures to verify, but I'm guessing you aren't even close to supporting LD signatures.  

Getting posts from Mastodon is a different problem. I assume you're setting the Accept header to only fetch AP content (? this is important), and recently many projects have begun to require HTTP signatures on fetches. I don't know for sure what Mastodon's signature policy is these days, but we typically assume that HTTP sigs are required so they can figure out if you came from a blocked site.  If you were to provide a URI for the thing you're trying to fetch I can possibly check it for you (with and without signatures). In  any case, make sure it's a world readable public post without any of Mastodon's privacy settings because those would almost certainly require a signed request.

@mike Ah, I didn't realize that was a Mastodon-specific thing. I'm still working on getting HTTP signatures working. I thought I had it set up correctly to send Accept activities to follow requests, but Mastodon said verification failed when I tried following. Probably needs both kinds of signature is my guess?

Little Library won't be getting any posts, only sending them to followers, so I'm not too worried about that at the moment. Still have plenty to figure out, though...

@mike FYI, it can't be tested at the moment because the power in my neighborhood went out and the server is in my home office...

You can actually get away without LD signatures. Pleroma doesn't support them (writing a bug-free LD serialiser is *bloody hard*. We appropriated one from elsewhere, and even that had issues). I'm pretty sure you'll end up needing HTTP signatures, but they aren't too difficult.

There's a node package for this at which I know nothing about but _might_ save some effort.

One step at a time... for such early code this doesn't look too bad.
Sign in to participate in the conversation

cybrespace: the social hub of the information superhighway jack in to the mastodon fediverse today and surf the dataflow through our cybrepunk, slightly glitchy web portal support us on patreon or liberapay!