Recently I was invited to join the Agora Road webring hosted by agora road user voicedrew. This awesome webring was built with the onionring framework, which while super neat is entirely written with javascript. Due to this, if I were to embed the webring widget on my page, I would be forced to introduce disgusting javascript to my pure and unspoiled website. I was not going to let this happen.
In truth, I actually have nothing against javascript on websites. I think it provides a lot of helpful tools to web developers and it can be used safely on websites both large and small. That said, because I receive a somewhat large percentage of traffic via tor & terminal based web browsers such as lynx, I personally wish to avoid using javascript on my page wherever possible.
I had toyed around with a few different back-end tools from jhidra to node, but none of them really worked as well as I had hoped. I wanted something that I could tinker with easily and wouldn't use much resources on my server. Eventually I decided on just using PHP, which thankfully integrated perfectly into my nginx server. With a bit of help to learn the basics of php (shouts to judydev), I had a functional prototype for a php-based webring widget. All I had to do was create a page for each logic-defined button and I linked them on my front-facing widget.
Originally I considered integrating the php directly into the embed, however I later decided that it would be easier to manage across my site if I just created a php file for each link instead. That being said, I don't see there being an issue if someone were to try integrating the php directly into the widget itself.
As for the code itself, I really phoned it in. The actual php command is just a bunch of unix commands piped into eachother. While I'm sure that there isn't anything practically wrong with doing it this way, it does feel a bit cheap. Maybe in the future I'll come back to it and use php commands to do all of this, but in the meantime I think this solution does the job. Feel free to check out the code here.
<?php
// curls the list of users in the webring, removes the current
// page, and then redirects to a random one of those listed users.
exec("curl 'https://voicedrew.xyz/wr/onionring-variables.js' \
| sed -n \"/^'/s/^'//;s/',$//p\" | grep -v 'https://i330.dev' \
a| shuf | head -n 1", $out);
header("Location: ". $out[0]);
?>
<?php
// curls the list of users, and then redirects to the user after
// the user mentioned in the grep command. (this may not work if
// you are the last user in the list btw)
exec("curl 'https://voicedrew.xyz/wr/onionring-variables.js' | sed -n \"/^'/s/^'//;s/',$//p\" | grep -i 'https://i330.dev' -A 1 | tail -n 1", $out);
header("Location: ". $out[0]);
?>
This was a fun project to work on and I'm very happy that I was invited
to the agora webring. I hope that this can help anyone else who is using
onionring but doesn't want to bother with javascript (niche market ik).
If you have any questions about how I configured my server or about
literally anything else whatsoever, feel free to email me! My email is
[email protected]
Have a great day!