💾 Archived View for gemini.ctrl-c.club › ~Francois › gem_en.gmi captured on 2024-08-31 at 11:50:23. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2021-12-03)
-=-=-=-=-=-=-
| | | / \ | | |--o|===|-| |---| |g| / \ |e| | | |m| | |=|i| | | |n| |_______| |i| |@| |@| | | ___________|_|_
After discovering gemini, I installed quite quickly a capsule - after all I have been using markdown for years, so it was a no-brainer.
I had content from my website, so there again, no real challenge.
Creating my own CGI was a bit more fun.
First of all, it is not very well documented.
I read all the specs I could find, but to no avail.
I looked at the source code of various pages, but there again, no big illumination.
I installed a server (https://github.com/a-h/gemini/releases) on a raspberry3 on my local network to be able to fiddle, but it didn't help.
Then I discovered a page:
and I contacted the author (Karl), asking for help.
Karl was very nice and helpful and triggered my first "aha!" moment.
I realized (and so did he) that the reason my setup wasn't working was probably very simply because my server did not support CGIs.
I read the documentation he wrote on his setup (https://www.karl.berlin/gemini-blog.html) and decided to use the same server: gmnisrv (https://git.sr.ht/~sircmpwn/gmnisrv/).
Compiling was straightforward - I just needed to install libssl-dev which wasn't on the raspberry.
My research also led me to another page, also very useful:
https://noulin.net/blog/gemini/2021/02/14/about-gemini-markup-and-gmnisrv.html
Thanks to Karl's page and the one quoted above, install was quite simple.
I just had to modify the starting scripts of the raspberry to point to the new server, tested with amfora - good to go.
my config file:
# Space-separated list of hosts listen=0.0.0.0:1965 [::]:1965 [:tls] # Path to store certificates on disk store=/usr/local/gem/certs # Optional details for new certificates organization=gmnisrv user [localhost] root=/usr/local/gem/files [localhost:/cgi] root=/usr/local/gem/files cgi=on [raspi31] root=/usr/local/gem/files [raspi31:/cgi] root=/usr/local/gem/files cgi=on
It is of course this last section with "cgi" which is the key.
CGI script must be in /usr/local/gem/files/cgi.
From the pages and doc read (and Karl's python script used for wikdict, available in his git repository), I knew I would have 4 system variables, of which the most used was $QUERY_STRING.
The 4 variables are:
# Page Test du script => cgi/test.sh Test here
if [ $QUERY_STRING"X" = "X" ] ; then echo "10 Enter something \r" else echo "20 text/gemini\r" echo " " echo "l'argument passé est $QUERY_STRING" echo "PATH_INFO = " $PATH_INFO echo "QUERY_STRING = " $QUERY_STRING echo "SERVER_NAME = " $SERVER_NAME echo "REMOTE_USER = " $REMOTE_USER echo " " echo " " echo " " echo " " echo "=> ../test.gmi Back" echo " " echo " " echo " " echo " " fi
And yes, there is no first line calling the bash shell. For some reason when I put it, it doesn't work, whereas Karl's scripts in python do call it. Go figure.
We can see that $QUERY_STRING contains what was entered in the dialog box.
$SERVER_NAME contains the name of the server.
However the two other variables remain empty, so either I misunderstood the specs, or this server doesn't do it properly.
It is not very important, since with that result, we can already write whatever script we want.
(tbc)