💾 Archived View for kvothe.one › gemlog › 2020-09-18.gmi captured on 2020-09-24 at 00:47:34. Gemini links have been rewritten to link to archived content
-=-=-=-=-=-=-
Yesterday, I posted a quick write-up of some modifications I did to the molly-brown Gemini server to add OpenBSD security features:
adding openbsd security to molly-brown.
Today, I figured I'd share with you a Perl script to show how to handle CGI requests from molly-brown. The script:
It's pretty straightforward and does two things. First, it requests user input:
╔════════════ Input ═════════════╗ ║ ║ ║ What would you like to say to ║ ║ repeatbot 3000? ║ ║ ║ ║ hello, my friend! 💚█ ║ ║ ║ ║ Send Cancel ║ ║ ║ ╚════════════════════════════════╝
And second, handles that input and echos it back as plain Gemini text output:
# repeatbot 3000. What you said: 'hello, my friend! 💚' What you said, but uppercase: 'HELLO, MY FRIEND! 💚'
Since I'm on a kick, I went ahead and added some minimal OpenBSD boilerplate code in that Perl script, but you can just remove the OpenBSD modules and pledge/unveil system calls if you're not running OpenBSD or don't care for those features. Just cut the lines between the "OpenBSD specific code" markings.
That's pretty much it! Hopefully someone finds this useful.
Until next time, be well!
kvothe.