Settings

Theme

Ask HN: ActivityPub or Mastodon?

36 points by Timja 3 years ago · 62 comments · 1 min read


I am thinking about joining the Fediverse.

I don't really understand the difference between ActivityPub and Mastodon yet.

If I write my own ActivityPub software (server code with web frontend), can I interact with Mastodon users just as if I also were a Mastodon user? Or would I have to implement some Mastodon specific protocols?

watchdogtimer 3 years ago

Before you go to the trouble of writing your own software, consider using one that's already been written. There are many[0] out there already besides Mastodon.

[0]- https://delightful.club/delightful-fediverse-apps/

  • TimjaOP 3 years ago

    Thanks, will look through these. But all of the ones I have looked at so far seem pretty complex with hundreds of files.

    I don't know the fediverse protocol yet, but I would hope I can get away with just two files like this:

    receive.php

        <?php
        if (!isset(servers_i_talk_to[$_SERVER['REMOTE_ADDR']]) die();
        $data = $_POST['msg']
        $file = 'log/' + time().'-'.mt_rand();
        file_put_contents($file, $data);
    
    send.php

        <?php
        $data=$_POST['data'];
        for ($servers_i_talk_to as $server) {
            $url = "https://$server/receive.php";
            $msg = ['msg'=>$data];
            $opts = [
                'http' => [
                    'header'  => "Content-type: application/x-www-form-urlencoded\r\n",
                    'method'  => 'POST',
                    'content' => http_build_query($msg)
                 ]
            ];
            $context  = stream_context_create($opts);
            file_get_contents($url, false, $context);
        }
    
    Where receive.php is openly accessible and send.php is protected by a password.

    The endpoints are surely called differently than receive.php and send.php. But this is how I would hope ActivityPub works in principle.

    Of course, this would be very bare. To read, I would have to read the raw log of ActivityPub messages and to post, I would have to manualy put together an ActivityPub message.

    But I would be in the Fediverse and could add more convenience functionality later.

    • half-kh-hacker 3 years ago

      It's not so simple.

      In order to federate an object you must:

      - send requests with proper 'HTTP Signatures' (many AP nodes have strict enforcement here)

      - which requires you to have an actor with an attached signing pubkey

      - so you have to host the LD-JSON actor descriptor on another endpoint

      - actors MUST have an attached inbox & outbox, your receive endpoint will need to sit at your actor's inbox (on POST). both of these are OrderedCollections of Activities

      - and in order to be properly interoperable you will probably need to maintain follow relations & write an endpoint which can ACK/NAK follows, etc etc

      • TimjaOP 3 years ago

        What do those "HTTP Signatures" do?

        If admin of serverA decides to add serverB to the servers_i_talk_to array, they also ask serverB to give them a public key and from then on serverA only accepts messages from serverB if they are signed with the corresponding private key?

        Is that so that serverB can change its IP without interrupting the communication with serverA?

        • ryukafalz 3 years ago

          The fediverse is (generally) an open federation, not a closed one like you're describing. There is no manually-curated list of instances that you federate with.

          • TimjaOP 3 years ago

            I would expect "Open Federation" does not mean you need to talk to every instance out there directly. But that it works like a web where messages are routed around. I could be wrong. But I would expect the "servers_i_talk_to" array is what the instances output at the "peers" endpoint:

            https://fosstodon.org/api/v1/instance/peers

            • easrng 3 years ago

              There's not really any routing, but you don't need to send posts to every instance, just every instance that has users following your instance's users.

        • half-kh-hacker 3 years ago

          HTTP signatures ensure that you can't send a message and spoof the user/instance that it's coming from. Think of it like DKIM for AP.

          They commonly include the specific actor who is interacting with the network (via the instance), so we can also achieve correct-side enforcement of blocks.

          • TimjaOP 3 years ago

            With "actor" you mean "user"?

            Every user has their own private key?

            • easrng 3 years ago

              Sure an actor is basically a user, there's usually an "instance actor" though too that does some other things but I don't think having one is required. Every actor has a private key but it's kept on the server, it's basically an implementation detail.

              • TimjaOP 3 years ago

                Strange that users have private keys. Is that kinda forward-looking, so that at some point those keys could be moved to the users themselves? So they can keep their identity, even if the owner of their instance becomes malicious?

    • danielheath 3 years ago

      If you want something lightweight, consider https://humungus.tedunangst.com/r/honk - despite the “whimsical” UI, it’s very easy to run.

    • vedranm 3 years ago

      If you want a more lightweight server-side software that can access Fediverse, I found two good candidates (I am looking for other suggestions):

      - GoToSocial: https://docs.gotosocial.org/

      - Pleroma: https://pleroma.social/

anthropodie 3 years ago

While everyone is talking about Mastodon because of Twitter, I want people to know that there is https://pixelfed.social which is alternative to Instagram.

Theoretically you should be able to follow anyone from pixelfed on Mastodon and vice versa because both support ActivityPub. I haven't tried doing that myself.

  • jerrygoyal 3 years ago

    the homepage (Pixelfed) url is just a login screen with no explore page or even a landing page. not sure if that's a sign of a good product.

    • anthropodie 3 years ago

      Here you go https://pixelfed.social/discover. No idea why they would not put that on homepage.

      • TimjaOP 3 years ago

        The trending images have only a handful of likes.

        Are likes not federated through the Fediverse? If someone on mastodon.social likes a post on pixelfed.social, will that increase the like count on pixelfed.social?

      • Kye 3 years ago

        The dev is working on a major update to the Pixelfed equivalent of joinmastodon.org.

    • littlestymaar 3 years ago

      > the homepage (Pixelfed) url is just a login screen with no explore page or even a landing page.

      That's a pretty faithful clone of instagram then…

    • knowledge-clay 3 years ago

      It’s not a product. It’s a utility and a service

  • lettergram 3 years ago

    I’ve been wondering why people are just now talking about mastodon.

    Musk per his own statements wants to increase free speech… why is that bad?

    Regardless, Gab and Truth.social both use mastodon. So it’ll improve their platforms the more people switch (and improve mastsdon). Technically the nodes can interconnect; though I believe that’s not happening today

    • xena 3 years ago

      Gab has been throughly banned throughout most of the fediverse because of the constant spew of abuse. I don't believe that truth.social federates but I see it a lot in blocklists. Some people will automatically block people using the Gab fork of Mastodon as a last ditch attempt to curb hate and spam.

      This is kind of the nature of the beast. If the problem is that the remote instance allows things that you find intolerable, then you have to ban the remote instance from federating with you. Speech may be free, but actions have consequences.

    • kzrdude 3 years ago

      More than just thinking about what people say, compare with what they do. Musk "per his own actions" is seemingly taking the chainsaw to the existing company's organization, it's going to be a bumpy ride that way no matter what changes he wants to do.

    • leephillips 3 years ago

      Often when I talk to people about their belief in “free speech” I soon discover that they really only mean speech that they like.

      • billdietrich1 3 years ago

        I "like" plenty of speech I disagree with, if the speech is fact-based and informative and rational and interesting. I enjoy a good debate, I learn stuff, it's good.

        I don't "like" speech that lies, hates, tries to manipulate, tries to shock, or is just incoherent.

        So, do I have a belief in "free speech" ?

        BTW, the USA's First Amendment just prevents the govt from stopping religion or the press etc. It's doesn't mean anyone has to listen to anyone. It doesn't mean some platform such as Facebook or a newspaper is required to propagate your speech.

        • lettergram 3 years ago

          > BTW, the USA's First Amendment just prevents the govt from stopping religion or the press etc. It's doesn't mean anyone has to listen to anyone. It doesn't mean some platform such as Facebook or a newspaper is required to propagate your speech.

          I always love this argument… you do know building owners in New York are required to allow protests outside? It’s not just the government Some (such as malls) even have a requirement to allow them inside. Company towns (think Disney, Hershey, etc) couldn’t shut down free speech either.

          The public square, regardless of ownership, is protected by the first amendment. Print is similarly protected by the first amendment, though you may have to own your own news org, no one can stop your distribution. Basically, you can’t impede others blocking roads), but you can stand and preach and distribute. This has been upheld MANY times by the Supreme Court.

          They will likely not do too much to social media quite yet, as there are 5-6 alternatives to distribution AND congress has passed specific laws governing internet speech. However, I’m sure as these court cases work up to SCOTUS we will eventually see it upheld again (might just take 2-3 more years).

  • edent 3 years ago

    You can! I'm following @ username @pixelfed.social in my Mastodon client.

  • jeffalyanak 3 years ago

    Yeah, that works.

piva00 3 years ago

AFAIK: ActivityPub is the protocol used by Mastodon and other platforms (like PeerTube) and so you'd be able to interact with other users using the protocol.

If I'm wrong I believe someone will correct me pretty fast but that's my current understanding.

emaro 3 years ago

The difference between ActivityPub and Mastodon was already explained by others.

If the popular solutions are too complex, maybe you want to take a look at https://microblog.pub, a relatively small and simple AP implementation designed for single-user instances.

  • TimjaOP 3 years ago

    Thanks. 153 files. An order of magnitude leaner than the ones I have seen so far.

JackC 3 years ago

For anyone looking to mess around with making a single file ActivityPub server, this looks like a good intro to the spec: https://socialhub.activitypub.rocks/t/guide-for-new-activity...

That page also links to https://blog.joinmastodon.org/2018/06/how-to-implement-a-bas..., which is a demo of hardcoding one part of the spec from scratch.

chx 3 years ago

Mastodon won't survive this, the Fediverse will. Much as Twitter when it was a Rails app buckled under the load already we see things like https://github.com/mastodon/mastodon/issues/19505 and users of other instances also complain. It's an old crusty complex codebase.

So yes you can certainly interact with Mastodon users and you will need to.

https://www.r-bloggers.com/2022/10/getting-acquainted-with-m... the largest Mastodon instance has less than a million users. Twitter has, what, 450 million?

2Gkashmiri 3 years ago

no. activitypub is the protocol which all apps in the fediverse use and can talk to each other. you can create a pixelfed instance account and follow someone on mastodon.social and vice versa. same for interaction between them

xena 3 years ago

ActivityPub : Mastodon :: SMTP : postfix

  • k__ 3 years ago

    Does this mean, I can use any AP implementation to federate with Mastodon servers?

    • Kye 3 years ago

      As long as it implements the same activities. They often do.

    • ryukafalz 3 years ago

      Roughly yes, though you'll want one that supports the same activity types (Mastodon mostly uses "Note") or it won't make much sense :)

      • k__ 3 years ago

        How many types are there and how prevalent are they?

        I read some websites about "host your own server" and some were talking explicitly about Mastodon and some were like "let's do selfhostes microblogging with this AP server"

        And I asked myself, if I could use AP servers to follow people and let them follow me when they're on a public Mastodon instance.

    • Matl 3 years ago

      Yes, abet Mastodon has some non-standard extensions. But basically yes.

andrewstuart 3 years ago

Meanwhile………. Twitter is just a text field (basically).

smcn 3 years ago

Yes, it'll federate with Mastodon, with no extra effort or code.

ydf 3 years ago

Best not to waste your time on any of this microblogging rubbish. It only leads to misery.

  • cpach 3 years ago

    To each their own but I personally believe that’s sound advice.

    (And therefore I’m a little bit ashamed that I have hard time avoiding Mastodon and Twitter. Soooo much new stuff, all the time – not super high quality, though…)

    • kzrdude 3 years ago

      Well, avoiding twitter is easy. Sadly it's relatively often one comes across great things to follow, let's just take @pcwalton as a recent example. :)

      • cpach 3 years ago

        There are loads of smart and interesting people on Twitter. I don’t deny that. I have just grown tired of microblogging in general, and Twitter in particular. The overall signal:noise ratio is just too low, IMHO.

        • kzrdude 3 years ago

          I was trying to cut out "stuff I do on the internet habitually", i.e just scrolling. Twitter is the least missed item on the list. But I seem to slip back onto internet habits time and again.. What has once been won must be won again.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection