💾 Archived View for gemini.abiscuola.com › gemlog › 2023 › 07 › 27 › who-need-a-cms-anyway.gmi captured on 2024-02-05 at 09:26:37. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-09-08)
-=-=-=-=-=-=-
E-mail to the rescue! I believe others already did something similar.
The gemini protocol is fine and dandy. However, it doesn't, directly, support the upload of resources, making it non-trivial to create new content in an easy and portable fashion.
I was thinking for a while how to solve this problem for myself, given that, until today, I used to just store my gemini articles in a fossil repository, with a touch of "make" to build the capsule and it's web counterpart. This approach has some disadvantages:
Looking at the gemini landscape in particular, the only solution seems to be to implement the titan protocol.
However, I really, really did not want to write yet-another-daemon, or change gmnxd to handle this specific case. Not convinced, I started from the base, writing down the following requirements:
After some heavy thinking, I understood that, what I needed, was something similar to a mailing list manager, but for my gemini capsule. Leveraging SMTP would let me to use any device where I have an e-mail account for my domain setted-up. In the end, e-mail clients are everywhere. Mapping my desiderata to an e-mail was quite easy then:
My idea was to leverage, potentially, whatever e-mail client du-jour to publish an article whenever I wanted. In essence, whatever tool I would have written, needed to be able to take an e-mail, extract it's subject and destination and parse the MIME part in it's body. And that's exactly what I did, by writing a small custom MDA (Mail Delivery Agent).
An MDA is nothing more than a program that receives a full e-mail message in it's standard input. The MDA I wrote is composed by two parts, a shell script driving the majority of the automation and a TCL script leveraging the mime package to extract all the mime parts from the e-mail body.
The steps are:
In the end, I implemented the following commands so far:
And everything is done for both the gemini and WWW versions of the site.
To avoid potential issue with site hijackers, two things were modified in the opensmtpd configuration: a specific rule for the new MDA was put into place permitting only to a specific e-mail address to write to the gemini addresses. And that same rule action adds the authentication informations to the "Received" headers. This way I can, in the MDA, check if the e-mail was sent from a specific, authenticated account, discarding anything non-authenticated.
Well, better than expected. Leveraging the whole E-mail ecosystem (from the clients, to the SMTP protocol) on top of my automation, makes everything smooth. Combined with the fact that I have an IMAP server, it means that I can have my articles saved as "drafts", or, by putting myself in CC, manage the "revisions" by leveraging the threading capabilities of any e-mail client. I'm still exploring how to leverage this whole e-mail thing more, but it's already good enough to have a simple client to write, attach pictures and what not and with a push of a button, have your article published.
P.S.: No, I will not publish the code. It's tailored to my needs and hacked together. I'm not proud of it's quality.
In the end, Bananas!
If you want to know more, feel free to contact me in private, or on IRC, or the fediverse.
Enjoy!