Skip to content

Piero Bosio Social Web Site Personale Logo Fediverso

Social Forum federato con il resto del mondo. Non contano le istanze, contano le persone

Updates to ActivityPub in a single PHP file

General Discussion
3 3 0
  • Updates to ActivityPub in a single PHP file

    https://shkspr.mobi/blog/2024/03/updates-to-activitypub-in-a-single-php-file/

    A few weeks ago, I built an ActivityPub Server in a Single PHP File. It's a proof of concept showing how easy it is to turn a website into a full-featured Fediverse participant.

    After a bunch of feedback and testing, I've added a some features to make it slightly more useful.

    • A single PHP file - 45KB of no-library goodness. Just add your details, upload, and done.
    • No databases. Everything stored as JSON files on disk.
    • Be followed. External users can discover and follow you.
    • Send messages. You can send messages to all your followers.
    • 🆕 Follow users. You can follow other Fediverse actors.
    • 🆕 Read messages. You can read the messages sent to your Inbox. If media is attached, those will be displayed.
    • 🆕 Verify signatures. ActivityPub messages can by cryptographically signed. This now verifies those signatures.

    You can grab the code here - pull requests welcome. If you want to see what it looks like in action, visit https://example.viii.fi/ or follow @example@example.viii.fi.

    Again, to re-emphasise what it says in the README - this is not suitable for production use. This is primarily a way to explain all the different functions of an ActivityPub server. It is adequately commented and I hope a moderately competent programmer could follow what's going on. It is almost certainly insecure and is considered harmful to aquatic life.

    I would be delighted if you took the code and did something interesting with it. Perhaps create a single-file server in your favourite language?

    ToDo

    A few random things which I might add - or which you might consider making and sending a Pull Request:

    • Better UI. It is deliberately bare-bones, see the /read interface. But perhaps there's a simpler way to make it look nice?
    • No threading in the UI - and no ability to reply to messages.
    • Support for reading hashtagged posts on the site.
    • Reply highlighting - at the moment you can't see if a message was sent to you.
    • Some Fediverse posts contain polls, content warnings, and other extended features. That could be fun to support - both for reading and writing.
    • Support for reading custom emoji.
    • Deletes, Updates, and Undos are received - but it currently doesn't remove the previously saved file.
    • There's no way to unfollow a user - except for manually deleting data from the file-system.
    • Only supports one image upload. Could support more? Or even other media?
    • I don't think CC works properly.
    • Message visibility could be useful.
    • Boring stuff like better error handling.

    If you have opinions, please let me know!

  • Updates to ActivityPub in a single PHP file

    https://shkspr.mobi/blog/2024/03/updates-to-activitypub-in-a-single-php-file/

    A few weeks ago, I built an ActivityPub Server in a Single PHP File. It's a proof of concept showing how easy it is to turn a website into a full-featured Fediverse participant.

    After a bunch of feedback and testing, I've added a some features to make it slightly more useful.

    • A single PHP file - 45KB of no-library goodness. Just add your details, upload, and done.
    • No databases. Everything stored as JSON files on disk.
    • Be followed. External users can discover and follow you.
    • Send messages. You can send messages to all your followers.
    • 🆕 Follow users. You can follow other Fediverse actors.
    • 🆕 Read messages. You can read the messages sent to your Inbox. If media is attached, those will be displayed.
    • 🆕 Verify signatures. ActivityPub messages can by cryptographically signed. This now verifies those signatures.

    You can grab the code here - pull requests welcome. If you want to see what it looks like in action, visit https://example.viii.fi/ or follow @example@example.viii.fi.

    Again, to re-emphasise what it says in the README - this is not suitable for production use. This is primarily a way to explain all the different functions of an ActivityPub server. It is adequately commented and I hope a moderately competent programmer could follow what's going on. It is almost certainly insecure and is considered harmful to aquatic life.

    I would be delighted if you took the code and did something interesting with it. Perhaps create a single-file server in your favourite language?

    ToDo

    A few random things which I might add - or which you might consider making and sending a Pull Request:

    • Better UI. It is deliberately bare-bones, see the /read interface. But perhaps there's a simpler way to make it look nice?
    • No threading in the UI - and no ability to reply to messages.
    • Support for reading hashtagged posts on the site.
    • Reply highlighting - at the moment you can't see if a message was sent to you.
    • Some Fediverse posts contain polls, content warnings, and other extended features. That could be fun to support - both for reading and writing.
    • Support for reading custom emoji.
    • Deletes, Updates, and Undos are received - but it currently doesn't remove the previously saved file.
    • There's no way to unfollow a user - except for manually deleting data from the file-system.
    • Only supports one image upload. Could support more? Or even other media?
    • I don't think CC works properly.
    • Message visibility could be useful.
    • Boring stuff like better error handling.

    If you have opinions, please let me know!

    @blog @example

    Love this project!

    Was skimming the project README and that last requirements line got me 😄

  • @blog Thanks! Much respect for just getting this out there. Love the comments! 😂


Gli ultimi otto messaggi ricevuti dalla Federazione
Post suggeriti
  • 0 Votes
    1 Posts
    1 Views
    Je cherche un tutorial pour commencer un projet #activitypub pour débutant
  • 0 Votes
    1 Posts
    8 Views
    Week in Fediverse 2025-11-07Servers- Gush! v0.0.26- Manyfold v0.128.0- Wafrn v2025.10.02- Hubzilla v10.6- Ktistec v3.1.3- Mastodon v4.5- gancio v1.28.1- Castopod v1.13.6- tootik v0.19.8- Loops v1.0.0-beta.4- Lemmy Development Update October 2025Clients- IceCubesApp v2.0.9- Mangane v1.18.5- Tangerine UI for Mastodon v2.5- Mastodon Bird UI v3.0.0- PeerTube Mobile v1.2.0- Voyager v2.40.2- bleromo: A Windows 98-style Pleroma/Mastodon clientTools and Plugins- Poduptime v5.6.0For developers- APx v0.20.0- Fedialgo v1.2.32- FIRES Server v0.4.0- NGI0 Progress report #1 (GoActivityPub)Protocol- FEP-d8c8: BitTorrent Torrent Objects- FEP-19b3: Specifying Properties of a ServiceArticles- Self-hosting your Mastodon media with SeaweedFS- Fediverse Report – #141-----#WeekInFediverse #Fediverse #ActivityPubPrevious edition: https://mitra.social/objects/019a3c12-2a12-7683-592d-a0dec77f582e
  • 0 Votes
    1 Posts
    12 Views
    Today's deep dive into #activitypub#selfhosting a #pixelfed instance, I send a Follow request to a selfhosted #wordpress blog with AP plugin. The returned Accept Follow payload gets processed by InboxWorker where it just fizzles.I then send a Follow request to this account hosted on mastodon.social. That payload gets processed by InboxValidator instead, then on to ActivityHandler and down the FollowPipeline as expected.Only message difference is #mastodon adds a 'username' field.Bug?
  • 0 Votes
    1 Posts
    9 Views
    It's been a while!All https://fedihost.co/ #PeerTube instances have been upgraded to v7.3.0Find out what's new in 7.3.0https://github.com/Chocobozzz/PeerTube/releasesps: #Mastodon v4.5.0 to follow shortly!#hosting #SelfHosting #ActivityPub #Fediverse #Canada