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

support Pixelfed #39

Open
snarfed opened this issue Oct 20, 2018 · 27 comments
Open

support Pixelfed #39

snarfed opened this issue Oct 20, 2018 · 27 comments

Comments

@snarfed
Copy link
Owner

snarfed commented Oct 20, 2018

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. 😄

@swentel
Copy link
Contributor

swentel commented Oct 20, 2018

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 ;-)

@swentel
Copy link
Contributor

swentel commented Oct 20, 2018

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)

@dansup
Copy link

dansup commented Oct 21, 2018

@snarfed AP support isn't quite ready yet. I am interested in implementing more indieweb stuff like microformats and maybe webmentions!

@swentel
Copy link
Contributor

swentel commented Dec 25, 2018

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.

@swentel
Copy link
Contributor

swentel commented Dec 25, 2018

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 @realize.be@fed.brid.gy - 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 ?

@snarfed
Copy link
Owner Author

snarfed commented Dec 28, 2018

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.

snarfed added a commit that referenced this issue Jan 4, 2019
@snarfed
Copy link
Owner Author

snarfed commented Jan 4, 2019

ok @swentel, bridgy fed actors now have summary, outbox, and publicKey.id. example: https://fed.brid.gy/realize.be .

@snarfed
Copy link
Owner Author

snarfed commented Jan 4, 2019

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.

@swentel
Copy link
Contributor

swentel commented Jan 4, 2019

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

snarfed added a commit that referenced this issue Jan 4, 2019
for pixelfed, #39. specifically, if the client asks for application/activity+json or application/ld+json (which pixelfed does), fetch and convert to AS2 instead of returning a 302 redirect.
@snarfed
Copy link
Owner Author

snarfed commented Jan 4, 2019

@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

@swentel
Copy link
Contributor

swentel commented Jan 4, 2019

Awesome, will test and let you know to see if my local instance accepts it! fingers crossed

@swentel
Copy link
Contributor

swentel commented Jan 5, 2019

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.

@swentel
Copy link
Contributor

swentel commented Oct 7, 2020

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.

@swentel
Copy link
Contributor

swentel commented Oct 7, 2020

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
)

@jk-na
Copy link

jk-na commented Mar 10, 2021

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:jk.nipponalba.scot@jk.nipponalba.scot"
Whereas on a randomly selected successful job it is in the format: keyId="https://pipou.academy/users/AuroreAcelya#main-key"

@snarfed
Copy link
Owner Author

snarfed commented Jan 17, 2023

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. 🤷

@snarfed
Copy link
Owner Author

snarfed commented Jan 17, 2023

I liked the same post from @snarfed@indieweb.social (Mastodon), and that like now shows up on the post, so interop here still isn't quite working yet.

@snarfed
Copy link
Owner Author

snarfed commented Apr 1, 2023

Another thing to look at: when I search for @snarfed.org@snarfed.org on a PixelFed instance, it finds me, but it shows my handle as @snarfed.org@fed.brid.gy. 😐

@snarfed snarfed changed the title support pixelfed support Pixelfed Apr 22, 2023
@snarfed
Copy link
Owner Author

snarfed commented Oct 12, 2023

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.

@snarfed
Copy link
Owner Author

snarfed commented Oct 24, 2023

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 @snarfed.org@fed.brid.gy, 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>"
  }
}

@snarfed
Copy link
Owner Author

snarfed commented May 14, 2024

Follows still aren't getting accepted ^. Eg for @TomCasavant in #1053, we sent the Follow below from actor https://bsky.brid.gy/bsky.brid.gy to https://pixelfed.social/users/mrpresidenttom/inbox at 2024-05-08T10:45:02.854174+00:00, and it returned HTTP 202, but never sent back an Accept, and the follow never registered on pixelfed.social's end.

{
  "id": "https://bsky.brid.gy/r/https://bsky.brid.gy/#follow-back-https://pixelfed.social/users/mrpresidenttom-2024-05-08T10:45:02.854174+00:00",
  "actor": "https://bsky.brid.gy/bsky.brid.gy",
  "@context": "https://www.w3.org/ns/activitystreams",
  "type": "Follow",
  "object": "https://pixelfed.social/users/mrpresidenttom",
  "to": [
    "https://www.w3.org/ns/activitystreams#Public"
  ]
}

@snarfed snarfed added the now label Sep 18, 2024
@snarfed
Copy link
Owner Author

snarfed commented Sep 18, 2024

Pinged dansup on Matrix just now 🤞

@ThisIsMissEm
Copy link

ThisIsMissEm commented Sep 18, 2024

@snarfed that object ID doesn't look like a valid URI? Maybe that's the source of the issue?

@snarfed
Copy link
Owner Author

snarfed commented Sep 18, 2024

@ThisIsMissEm thanks for looking! And hmm. https://bsky.brid.gy/r/https://bsky.brid.gy/#follow-back-https://pixelfed.social/users/mrpresidenttom-2024-05-08T10:45:02.854174+00:00 isn't a valid URI? Because of the non-encoded + or :s? Lots of other fediverse software is accepting that id format fine, so I'm guessing it's not the issue here, but I'd be curious to hear more if it actually is invalid somehow.

@qazmlp
Copy link

qazmlp commented Sep 18, 2024

@ThisIsMissEm thanks for looking! And hmm. https://bsky.brid.gy/r/https://bsky.brid.gy/#follow-back-https://pixelfed.social/users/mrpresidenttom-2024-05-08T10:45:02.854174+00:00 isn't a valid URI? Because of the non-encoded + or :s? Lots of other fediverse software is accepting that id format fine, so I'm guessing it's not the issue here, but I'd be curious to hear more if it actually is invalid somehow.

The URI is syntactically fine afaict, but maybe it's trying to actually fetch it?

@snarfed
Copy link
Owner Author

snarfed commented Sep 18, 2024

Hmm, maybe? ids with fragment are relatively common in the fediverse, and how to fetch them is largely undefined. 🤷 w3c/activitypub#367

@snarfed
Copy link
Owner Author

snarfed commented Sep 21, 2024

Pinged dansup on Matrix just now 🤞

No answer, as always 😕

@snarfed snarfed removed the now label Sep 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants