bridgy-fed
bridgy-fed copied to clipboard
support Pixelfed
it does AP, so it might already work! first thing to do is try testing it.
https://pixelfed.org , https://github.com/pixelfed/pixelfed , cc @swentel @dansup.
alternatively we could just lobby for microformats and webmentions. 😄
Yes. I saw it has atom feeds, so that's great for following - would be cooler if it had microformats indeed.
I'm going to open an account and see if I can interact with it already ;-)
Tried it, bummer ;-) I have a post here: https://pixelfed.social/p/swentel/16606 Tried a reply but got stuck on the inbox post request.
Might be because federation hasn't been fully deployed yet when checking their account (https://mastodon.social/@pixelfed/100925207518316311)
@snarfed AP support isn't quite ready yet. I am interested in implementing more indieweb stuff like microformats and maybe webmentions!
Tried another reply as https://mastodon.social/@pixelfed/101301109645686324 says it should work, but didn't get through yet. I'll see if I can trigger it from command line.
So got a bit further already setting up a pixelfed instance on my local machine. When trying to validate the actor, I was sending 'https://fed.brid.gy/r/http://realize.be' but that didn't resolve, using https://fed.brid.gy/realize.be was fine (I didn't have any problems with that testing with mastodon, and bridgy fed sends a full actor object afaics, so that might actually be a problem too).
However, after that, we need some more properties in the actor activity json as pixelfed wants to store following properties on the actor object
- summary
- outbox
- publicKey.Id
Once I faked that, the profile was saved. The username becomes @[email protected] - I guess that isn't that much of a problem (I think)
The reply doesn't get through, because when the url is verified, it tries to get the application/ld+json representation of it, unless I'm reading the code wrong (going from handleNoteReply() to statusFirstOrFetch()). It's weird though that it wants to bail out here as it has the activity object already, so I'm a bit in the dark here why it does that. Any pointers @dansup ?
awesome progress, thank you @swentel! i can definitely add those three properties, and look into why conneg for application/ld+json
for the wrapped reply URL isn't working.
ok @swentel, bridgy fed actors now have summary
, outbox
, and publicKey.id
. example: https://fed.brid.gy/realize.be .
and re:
The reply doesn't get through, because when the url is verified, it tries to get the application/ld+json representation of it
you mean that pixelfed tries to fetch a bridgy fed wrapped post URL, eg https://fed.brid.gy/r/https://snarfed.org/2018-11-10_30370 , with something like Accept: application/ld+json
, which we need to handle and return AS2 instead of the current 302 redirect, right? just checking before i start coding.
Yes, the code for the internal http client uses following headers:
public static function zttpUserAgent()
{
return [
'Accept' => 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"',
'User-Agent' => 'PixelFedBot - https://pixelfed.org',
];
}
I'm still a bit in the dark why it does that validation again, but I assume that it wouldn't hurt to have this representation anyway. Mastodon does it as well, e.g.
wget --header="Accept: application/ld+json" https://mastodon.technology/@snarfed/100119606571241751
@swentel done! /r/...
URLs now convert to AS2 when asked for it instead of redirecting. example:
curl -v -H 'Accept: application/ld+json; profile="https://www.w3.org/ns/activitystreams"' \
https://fed.brid.gy/r/https://snarfed.org/2018-11-10_30370
Awesome, will test and let you know to see if my local instance accepts it! fingers crossed
So pixelfed assumes attributedTo is a string and not an object. It also makes assumptions on the object received from the AS2 response, and that can never work like we are sending them. So I think replies can never work from other federated platforms, maybe currently only from pixelfed instances.
This is on hold until that's figured out - and fixed in pixelfed imo.
Ok, I got a reply working for pixelfed. You can see the reply on https://pixelfed.social/p/swentel/16606.
This is the object I send.
Array
(
[type] => Create
[id] => https://realize.be/activitypub/104
[actor] => https://realize.be/user/1/activitypub/swentel
[to] => Array
(
[0] => https://www.w3.org/ns/activitystreams#Public
[1] => https://pixelfed.social/users/swentel
)
[object] => Array
(
[type] => Note
[id] => https://realize.be/reply/content/1696
[attributedTo] => https://realize.be/user/1/activitypub/swentel
[published] => 2018-12-25T12:09:23Z
[content] => <p>Wow, what a view!</p>
[inReplyTo] => https://pixelfed.social/p/swentel/16606
[to] => Array
(
[0] => https://www.w3.org/ns/activitystreams#Public
[1] => https://pixelfed.social/users/swentel
)
)
[@context] => https://www.w3.org/ns/activitystreams
)
Pixelfed validates again by fetching the activitystreams representation of the id in the object (https://realize.be/reply/content/1696 - note: with Accept: application/activity+json). The part which took me long to figure out is that the response of this is not the activity, but only the object
{"type":"Note","id":"https:\/\/realize.be\/reply\/content\/1696","attributedTo":"https:\/\/realize.be\/user\/1\/activitypub\/swentel","published":"2018-12-25T13:09:23Z","content":"\u003Cp\u003EWow, what a view!\u003C\/p\u003E","inReplyTo":"https:\/\/pixelfed.social\/p\/swentel\/16606","to":["https:\/\/www.w3.org\/ns\/activitystreams#Public","https:\/\/pixelfed.social\/users\/swentel"],"@context":"https:\/\/www.w3.org\/ns\/activitystreams"}
I'll come back to confirm that a note with attachment works.
Posting individual notes (photos) works as well. Notes without attachment won't work (unless it's a reply). The important part here is that the attachment needs a 'Type' and 'mediaType' (mime) property. If these are not there, the validation won't work, and the post will not show up. Default valid media types (for type=image) are image/jpeg, image/png and image/gif
Payload example - visible at https://pixelfed.social/i/web/post/_/218345390364299264/219416742496178176 (but you need to be authenticated to view - not exactly sure why that is, that's for another day to figure out)
Array
(
[type] => Create
[id] => https://realize.be/activitypub/192
[actor] => https://realize.be/user/1/activitypub/swentel
[to] => Array
(
[0] => https://www.w3.org/ns/activitystreams#Public
[1] => https://pixelfed.social/users/swentel
)
[object] => Array
(
[type] => Note
[id] => https://realize.be/image/dartmoor
[attributedTo] => https://realize.be/user/1/activitypub/swentel
[published] => 2020-03-12T08:27:03Z
[content] => <p>A magical sunrise with Vixen Tor in the background. Just haven't seen the pixies yet in the forest :)</p>
[attachment] => Array
(
[0] => stdClass Object
(
[type] => Image
[mediaType] => image/jpeg
[url] => https://realize.be/sites/default/files/DJI_0034.JPG
)
)
[to] => Array
(
[0] => https://www.w3.org/ns/activitystreams#Public
[1] => https://pixelfed.social/users/swentel
)
)
[@context] => https://www.w3.org/ns/activitystreams
)
I tried to reply to a post on my pixelfed instance using bridgy fed and it looks like the job is failing due to the keyId being the incorrect format.
The error at the pixelfed end is: ErrorException: Undefined index: keyId in /usr/share/nginx/html/pixelfed/app/Jobs/InboxPipeline/InboxValidator.php:159
The format of the keyId in the post is: keyId="acct:[email protected]"
Whereas on a randomly selected successful job it is in the format: keyId="https://pipou.academy/users/AuroreAcelya#main-key"
I tried to federate a like of this post on piconic.co, running Pixelfed v0.11.4. It succeeded, BF log here, but I don't see the like on the post yet. 🤷
I liked the same post from @[email protected] (Mastodon), and that like now shows up on the post, so interop here still isn't quite working yet.
Another thing to look at: when I search for @[email protected] on a PixelFed instance, it finds me, but it shows my handle as @[email protected]. 😐
After #442, I tried liking and replying to the same piconic.co post above again, https://piconic.co/i/web/post/507466431055899254 , both 200ed but neither showed up.
Tried this follow just now, also 200ed and didn't show up.
If BF users' server shows up in PixelFed as fed.brid.gy, not their domain, ie we're eg @[email protected]
, I wonder if that's related. Maybe a signature keyId
thing? Should look more.
{
"published": "2023-10-24T13:01:58-07:00",
"content": "Follows <a class=\"u-follow-of\" href=\"https://piconic.co/i/web/profile/145384761425268736\">https://piconic.co/i/web/profile/145384761425268736</a>.\n<div class=\"e-content\">\npiconic\n</div>",
"url": "https://fed.brid.gy/r/https://snarfed.org/2023-10-24_piconic-2",
"actor": "https://fed.brid.gy/snarfed.org",
"id": "https://fed.brid.gy/r/https://snarfed.org/2023-10-24_piconic-2",
"@context": "https://www.w3.org/ns/activitystreams",
"type": "Follow",
"object": "https://piconic.co/users/snarfed",
"to": [
"https://www.w3.org/ns/activitystreams#Public"
],
"contentMap": {
"en": "Follows <a class=\"u-follow-of\" href=\"https://piconic.co/i/web/profile/145384761425268736\">https://piconic.co/i/web/profile/145384761425268736</a>.\n<div class=\"e-content\">\npiconic\n</div>"
}
}