Three months after discovering the Gemini protocol, I'm still super excited about the possibilities it offers, especially the ability to escape the user-hostile web. For many years I've been thinking about how I can scrape data off the web (things like traffic alerts, weather report, news, etc.) and make it accessible in a simple way on an LCD display or e-paper display, perhaps even on a smart watch. Gemtext offers a great format in which to scrape the data (it's simple enough to parse with a micro-controller), with the bonus that the content can also be published to other devices and users via the Gemini protocol. I've already setup bridges/scrapers to Gemini for my daily feeds, and have been reading them on my smartphone.
As part of my war on doomscrolling I recently removed all social media and news content from my smartphone, and instead read books on my Kindle. This got me thinking about building a simple device to read Gemini content on e-paper, since Gemini is mostly just text and very simple to parse. I'm pretty sure this could be done with a 4.2" e-paper display paired with an ESP32 micro-controller. It turns out, such a device already exists in a great form factor: the m5paper. Wouldn't this make a great pocket Gemini-reader?
Before going down this path however, I thought about the e-paper device I already have: an old Kindle 3. It has an experimental web browser, but I'd never really used it because it's SSL stack is outdated and so doesn't work with most modern websites, and even when it does, the experience is frustrating. I thought of two options to read content on this Kindle: scrape the content into text files and copy it over USB for reading; or use a proxy server for the experimental web browser. I manually tried the first option by copy-and-pasting a few articles from web sites onto the Kindle, and this does indeed work very well. However, since there isn't a Gemtext reader for Kindle, I looked into the second option.
The easiest thing to try was to use the Mozz.us Gemini-to-HTML proxy server over at portal.mozz.us. It seems this site still allows old SSL versions, so it actually works on the Kindle:
There are some issues, however. You can't adjust the font size, font type, line spacing, or contrast. You can zoom, but it resets when you navigate to another page. There is extra cruft at the top of all pages. You're reliant on a server which may go down or tighten up it's SSL support. To solve these issues, I looked into running a local Gemini-to-HTML proxy on a Raspberry Pi. I found two candidates: Gneto and Kineto. After trying both, I settled on Kineto, because Gneto doesn't work on URLs that have query parameters. Both allow you to specify a CSS stylesheet, which gives you almost total control over the rendering of the pages.
To compile Kineto on the Raspberry Pi, I had to first download and install the latest version of Go lang from the website, since the version of Go in the OS repository is too old. I then spend a lot of time tweaking the stylesheet to work on the Kindle according to my preferences. The Kineto template makes use of modern HTML tags such as article, details, summary, etc. The Kindle browser does not understand these, and so just dumps out their content without applying any styles to them. This created problems with the display, and so I had to modify the Kineto source to comment them out. Finally, with all the changes in place, I can run Kineto as:
nohup ./kineto -b 0.0.0.0:9065 -s kindle.css gemini://tobykurien.com &
The end result is a clean, book-like display of the content:
If you'd like to run this verion of Kineto yourself, the code and even the compiled binary are available in this repo.
I think the most satisfying type of programming is when you create something simple that makes your life a little easier or more pleasant, like home automation. It's even better when one little side project leverages another little side project. Reading web content scraped into Gemini on my Kindle ranks right up there with satisfying side projects!