5 ms·
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 ye
by Timja 4y 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 4y agoIt'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
- Timja 4y agoWhat 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 4y agoThe 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.
- Timja 4y agoI 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 https://fosstodon.org/api/v1/instance/peers
- half-kh-hacker 4y agoHTTP 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.
- 4y ago
- vedranm 4y agoIf 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/ https://docs.gotosocial.org/ - Pleroma: https://pleroma.social/ https://pleroma.social/
- Timja 4y agoGoToSocial: 6849 files plus dependencies Pleroma: 2289 files plus dependencies I might miss my target of 2 files. But I will surely not get the filecount go up to these extremes :)
- vedranm 4y agoHow about https://github.com/landrok/activitypub https://github.com/landrok/activitypub ? It's not two files, but it's PHP at least.
- Timja 4y agoNice! 283 files Still crazy many, but I will look a into it in case https://microblog.pub https://microblog.pub turns out to be not what I am looking for.
- danielheath 4y agoIf you want something lightweight, consider https://humungus.tedunangst.com/r/honk https://humungus.tedunangst.com/r/honk - despite the “whimsical” UI, it’s very easy to run.
- Timja 4y agoThe download goes to tgz files. No GitHub or GitLab repo?
- danielheath 4y agoNo, although the author also maintains his own SCM host ( https://humungus.tedunangst.com/ https://humungus.tedunangst.com/ ) where you can clone the repo.