Giter VIP home page Giter VIP logo

Comments (26)

snarfed avatar snarfed commented on July 23, 2024

heh. the difficulty here is definitely where to deliver to, since bridgy fed is only a proxy. it doesn't actually know where a user's followers are.

the current design is that followers' instances subscribe to user's atom feeds, OStatus style, with optional WebSub notifications. this obviously had problems, #18 etc.

AP inbox delivery would be great, but i still don't quite see how yet. hard coding mastodon.social doesn't seem right. manually including all followers in every post doesn't either.

from bridgy-fed.

swentel avatar swentel commented on July 23, 2024

Yeah, this is indeed a tricky one. So possibly a very stupid question: my atom feed (https://realize.be/fediverse.xml) uses https://bridgy-fed.superfeedr.com/ as the hub - I'm good at following setups heh. When I post something new, do I have to send a call to that hub to notify it exists ? I admit, I'm not entirely familiar with this hub and websub thing :/

If I understand it better, I can experiment more and have a better clue what to search for in mastodon's code :)

from bridgy-fed.

snarfed avatar snarfed commented on July 23, 2024

@swentel heh, you're discovering all the embarrassing rough parts of bridgy fed.

i don't think https://bridgy-fed.superfeedr.com/ actually does anything right now 😆. when i first tested with mastodon - before activitypub - its ostatus required a websub hub in the atom feed, so i registered with superfeedr and pointed people there. i don't actually know much about websub, or whether or how the hub matters to mastodon. sorry!

from bridgy-fed.

swentel avatar swentel commented on July 23, 2024

Ah no problem at all :)

Mastodon stores the hub, so I'll dig in and see if I can come up with something!

from bridgy-fed.

snarfed avatar snarfed commented on July 23, 2024

@aaronpk recently open sourced his site's AP code! https://github.com/aaronpk/Nautilus . he does what we've discussed doing: store every user's followers and send new posts to their instances over AP. i was hoping to avoid that, since mastodon supposedly supports atom + websub, but in practice they've been difficult enough that maybe we should just plan to store followers and go full AP ourselves too.

from bridgy-fed.

swentel avatar swentel commented on July 23, 2024

I'm looking into the atom + websub stuff now. Hopefully I can report back positive :)

from bridgy-fed.

swentel avatar swentel commented on July 23, 2024

This is the minimal object I've send to post a 'toot'. It showed up in the home timeline of my swentel mastodon user, even though I didn't cc that user, or followers or so, but not sure if that's something we can rely on. Posted to the shared inbox of mastodon.social. However bottom line, it's like a reply, but without inReplyTo ... that is the easy part :)

stdClass Object
(
    [type] => Create
    [@context] => https://www.w3.org/ns/activitystreams
    [actor] => https://fed.brid.gy/r/http://realize.be
    [object] => Array
        (
            [type] => Note
            [to] => Array
                (
                    [0] => https://www.w3.org/ns/activitystreams#Public
                )

            [id] => https://fed.brid.gy/r/http://realize.be/notes/1582
            [content] => I will be giving a session at @drupalcampbe about #indieweb ! A gentle 101 intro about the mission, specs and what the #drupal module already supports. Spoiler: a lot!
            [published] => 2018-10-22T14:14:39Z
        )

)

from bridgy-fed.

swentel avatar swentel commented on July 23, 2024

Dit another one with https://mastodon.technology/@snarfed in the to array. The post is The #indieweb module for #drupal is now in beta! Some smaller things can still go in, but what's left for a 1.0 release is a decent security review, anyone up for that ? :) Posted to the shared inbox of mastodon.social - crossing fingers it shows up there :)

from bridgy-fed.

snarfed avatar snarfed commented on July 23, 2024

@swentel agreed! you've probably already looked at them, but just in case, you may be interested in https://www.w3.org/TR/activitypub/#shared-inbox-delivery and other parts of the spec.

from bridgy-fed.

snarfed avatar snarfed commented on July 23, 2024

woo, this is working for original posts! example: https://mastodon.technology/web/statuses/101104510742043648 . (original post: https://snarfed.org/2018-11-10_30370 )

lots of polish remaining, of course. still, feel free to try if you want, @swentel!

from bridgy-fed.

swentel avatar swentel commented on July 23, 2024

WOW! I WILL :)

(I have an article ready on my blog to promote this too, I'll publish that even if one post works !)

from bridgy-fed.

swentel avatar swentel commented on July 23, 2024

I've send a webmention for https://realize.be/notes/1638 - but not seeing anything in the logs of bridgy fed. Don't see an error on my end either, it even stores it as a 'send item' (Drupal specific implementation). Markup seems ok too. So not sure what goes wrong :)

from bridgy-fed.

snarfed avatar snarfed commented on July 23, 2024

oops, thanks for the report! fixed, i think. i retried, but looks like you've deleted https://realize.be/notes/1638 .

from bridgy-fed.

swentel avatar swentel commented on July 23, 2024

IT WORKS! https://mastodon.social/web/statuses/101104925308165944 - https://realize.be/notes/1638
(didn't delete it, just did a resend, weird, but oh well :)!)

from bridgy-fed.

snarfed avatar snarfed commented on July 23, 2024

yay! congrats! and oh wow, funny, that mastodon.social link literally redirects to your original post. federation indeed. 😎

from bridgy-fed.

swentel avatar swentel commented on July 23, 2024

Yes, that link only works in the UI of Mastodon, but that's totally fine.

Did a test with https://realize.be/image/falling-leaves - which has an image, but that hasn't come through yet. This might call for a local debugging session :)

One other question (might be off topic and rather a follow-up). Does fed bridgy handle p-summary or something like 'p-bridgy-twitter-content'. According to @EdwardHinkle It seems 'p-summary' becomes a content warning in Mastodon. Ignore, see underneath

from bridgy-fed.

swentel avatar swentel commented on July 23, 2024

Ok regarding images. There might be two things:

screenshot from 2018-11-20 20-05-43

Note - can also be a follow up, I can do some local testing and see what the format needs to be, I like figuring out those things :)

from bridgy-fed.

swentel avatar swentel commented on July 23, 2024

As for p-summary - that works great - see https://mastodon.social/web/statuses/101105193204982078
It shows exactly which was in my summary, although the article is WAY longer. There's still a 'show more' button .. but I make sure the URL is in the summary too. One rule that could potentially be implemented is that content is send empty if there's a summary. However, some instances of mastodon allow larger posts, and who knows for other platforms out there, so this is fine! :)

from bridgy-fed.

snarfed avatar snarfed commented on July 23, 2024

woo, thanks for all your investigating @swentel, as usual!

i'm curious about your post with an image. the image shows up in the mastodon post? i can't easily see for myself, https://mastodon.social/web/statuses/101105050959981429 redirects to https://realize.be/image/netscape

my original example post https://mastodon.technology/web/statuses/101104510742043648 from https://snarfed.org/2018-11-10_30370 had a u-photo, which made it into the AP request, but didn't end up in the mastodon post. 🤷‍♂️

i haven't actually checked that it's in the right place in AP though. bridgy fed log: https://fed.brid.gy/log?start_time=1542732402&key=https%3A%2F%2Fsnarfed.org%2F2018-11-10_30370+https%3A%2F%2Fmastodon.technology%2Finbox

from bridgy-fed.

swentel avatar swentel commented on July 23, 2024

i'm curious about your post with an image. the image shows up in the mastodon post?

No, the image doesn't show up. Only the url to the post itself. And about five minutes later, some sort of embed card appeared too, but it just links to the same original url. Looking at the logs, the image is found, so I think discovery is fine. It's mastodon that just doesn't like it right now. Maybe we should check with aaron if he does something specific with u-photo or not.

from bridgy-fed.

swentel avatar swentel commented on July 23, 2024

Skimming through mastodons code, looks like images should be inside an 'attachments' property.
Not sure if that is specifically Mastodon or AP though.

from bridgy-fed.

snarfed avatar snarfed commented on July 23, 2024

yeah searching https://www.w3.org/TR/activitypub/ for image, attachment, and photo doesn't turn up anything useful. AP may defer it to AS2 and individual implementations. maybe we just do what works for Mastodon (and maybe soon PixelFed) for now.

from bridgy-fed.

swentel avatar swentel commented on July 23, 2024

I was able to create a post with an image. Attachment is an array of arrays. The url is mandatory, name and focalPoint are optional. See https://mastodon.social/web/statuses/101114062630255773

I also tested with sending no content property and an attachment and that works fine too, so content isn't mandatory in case there are valid attachments.

stdClass Object
(
    [@context] => https://www.w3.org/ns/activitystreams
    [type] => Create
    [actor] => https://fed.brid.gy/r/http://realize.be
    [to] => Array
        (
            [0] => https://www.w3.org/ns/activitystreams#Public
            [1] => https://mastodon.social/users/swentel
        )

    [object] => stdClass Object
        (
            [id] => https://fed.brid.gy/r/http://realize.be/image/flying
            [type] => Note
            [published] => 2018-11-22T09:15:51Z
            [content] => Flying
            [attachment] => Array
                (
                    [0] => Array
                        (
                            [url] => https://realize.be/sites/default/files/styles/bigger/public/1533491412541.jpg?itok=rPTwkt2X
                        )

                )

            [to] => Array
                (
                    [0] => https://www.w3.org/ns/activitystreams#Public
                    [1] => https://mastodon.social/users/swentel
                )

        )
)

screenshot from 2018-11-22 10-19-29

For reference, the code from mastodon (app/lib/activitypub/activity/create.rb)

    as_array(@object['attachment']).each do |attachment|
      next if attachment['url'].blank?

      href             = Addressable::URI.parse(attachment['url']).normalize.to_s
      media_attachment = MediaAttachment.create(account: @account, remote_url: href, description: attachment['name'].presence, focus: attachment['focalPoint'])
      media_attachments << media_attachment

      next if unsupported_media_type?(attachment['mediaType']) || skip_download?

      media_attachment.file_remote_url = href
      media_attachment.save
    end

from bridgy-fed.

snarfed avatar snarfed commented on July 23, 2024

woo, that's great! thanks again. i'll incorporate that.

from bridgy-fed.

snarfed avatar snarfed commented on July 23, 2024

done! example: https://mastodon.technology/web/statuses/101124703242866136

image

i think all that's left to do here is update the docs.

from bridgy-fed.

swentel avatar swentel commented on July 23, 2024

Yes, works great!

from bridgy-fed.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.