So I managed to add #ActivityPub to a static website I just put together. I will be modifying it so I use the same code on my personal blog too.
Basically it supports followers, and when a new page is added (like a news entry, or a new project) then if your following the website it will show as a status in your feed.
Even cooler, if you comment or like the status from here you will see that comment and status on the website. Yes I can block people if they abuse this, as well as servers.
Check it out by following @flear which represents https://flear.org
Its a very early beta, so the look of the site will still be heavily modified and I will add some more #AP support soon. But this covers all the basics needs.
Static sites actually have come a long way, to the point that the term is still super confusing.
Yes the code itself is static html. and the code itself doesnt change between deploys. To answer your question it uses javascript (originally written as typescript). Some of it even runs remotely on the server, though its called "serverless functions" since the lambdas run without any OS or system info.
So the javascript basically can modify the code on the fly (the local js) and act as endpoints for things like follows using serverless functions but still running "in the cloud" (you see those int he api folder).
Next you might be wondering where the data is stored... It uses a firebase DB, so basically the DB is also in the cloud and is accessed with javascript as well... So the dynamic parts are rendered dynamically using static code written in javascript :)
@freemo thanks, that's neat.
With respect I think using the term serverless when there is a server because Google (I think) coined the term is misleading IMO though I know many go along with it.
My interest is in p2p, so building static sites where code runs in the client & data mutated without a server, and stored across the p2p network. There are though people who insist that p2p nodes be called servers! 🤷♂️
I think a useful distinction is whether site specific code runs outside the client.
@happyborg "serverless function" is the correct and adopted technical term. As far as I know it wasnt coined by google, but if it was, i dont see that really making a difference. It is the established standard term for such a thing.
You can run it in a server configuration if you want, go for it. Some of us dont want that level of complexity, especially not for a static site that has no need for it.
> I think a useful distinction is whether site specific code runs outside the client.
For ActivityPub it must, it is designed to. There are solutions if you want it totally in the client though, go for that if you want it.. I intend to add Nostr support on top of AP so my site does both and so people can follow it using the standard of their choice.
> For ActivityPub it must, it is designed to. There are solutions if you want it totally in the client though, go for that if you want it
That seems contradictory or do you mean non-AP solutions?
Regardless, I'm curious if AP can be implemented using libp2p services. I'm not impressed with Nostr in several respects. I'm a big fan of Safe Network though and hope to see it link to synergistic projects.
I built a PoC for SN to integrate with Solid and another, a GitHub in the browser.
I mean that AP requires a server with a static address and available port, and must run 24/7 to be effective (otherwise I cant follow people will get errors).
Since the vast majority of personal computers are behind a nat with a dynamic IP you can not host AP based instances off your local machine unless you pay for commercial features (static public ip)
thats typical.
The port is only half the battle, you still need a static public ip address if you wanted to have a reliable server. But yea if you really want to hack it there are ways.
The vpn server's public ip address is always the same, they give the ability to choose exactly one you want every time.
But i'm not sure if https will work with whatever port except 443