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
    10 Views
    #datocurioso ¿Creías que el #fediverso se limitaba solo al microblogging de #Mastodon? ¡Piénsatelo de nuevo!El fediverso es un cosmos interconectado regido por el protocolo #ActivityPub, y alberga un sinfín de mundos más allá de las publicaciones cortas. Puedes encontrar alternativas descentralizadas para casi cualquier servicio centralizado que conozcas: ¿Buscas compartir imágenes al estilo Instagram? Existe #Pixelfed.¿Anhelas un espacio para vídeos como YouTube? Tienes a tu disposición #PeerTube, que usa tecnología P2P para aligerar la carga.¿ quieres compartir videos cortos al estilo tik Tok? Prueba #loops!¿Prefieres los agregadores de enlaces al estilo Reddit? #Lemmy es tu destino. ¿ buscas compartir tu #podcast? #funkwhale es a donde debes ir.¿ te gusta escribir o quieres hacer un blog? Intenta con #WriteAs¡Y eso solo es la punta del iceberg!El fediverso no es un solo lugar, sino una constelación de plataformas que interactúan entre sí, una red de redes libres, abiertas y federadas, permitiendo a un usuario de Mastodon o de algún otro servicio federado seguir e interactuar con alguien en PeerTube o Pixelfed, etc. ¡La verdadera magia radica en la interoperabilidad y la libertad de elección! #SoftwareLibre #Tecnologia #Privacidad ✨‍♂️🎙️
  • 1 Votes
    6 Posts
    14 Views
    test refederation
  • 0 Votes
    1 Posts
    12 Views
    BadgeFed Unconference Participant – FediForum June 2025 The verified Badge was issued to @Anca Mosoiu This badge recognizes active participation in the BadgeFed Unconference session held during FediForum's June 2025 event. BadgeFed is an initiative dedicated to exploring and advancing decentralized digital credentials within the Fediverse. This session brought together innovators, educators, enthusiasts, curious raccoons, and technologists to collaboratively shape the future of open badges and verifiable credentials in decentralized networks. Earning Criteria: To earn this badge, participants must have: * Attended the BadgeFed Unconference session at FediForum June 2025. * Actively engaging by asking questions, commenting, leading discussions, or engaging meaningfully in collaborative activities. * Demonstrated a commitment to advancing decentralized credentialing systems within the open social web.. Issued on: 06/07/2025 15:44:41 Accepted On: 06/07/2025 20:12:41 Verify the Badge here. #badgefed #openbadges #fediforum #fediverse #activitypub #IssuedByBadgeFed #_BadgeDrop
  • 0 Votes
    5 Posts
    19 Views
    @smallcircles @evanwolf it's very powerful.