💾 Archived View for gmi.bacardi55.io › gemlog › 2021 › 08 › 08 › gemini-to-wallabag captured on 2021-12-03 at 14:04:38. Gemini links have been rewritten to link to archived content
-=-=-=-=-=-=-
Posted on 2021-08-08
I've written in a previous gemlog entry that I use wallabag a lot to save articles to read later on my e-ink tablet.
gemini://gmi.bacardi55.io/gemlog/2021/05/09/changing-my-web-content-consumption/
In this post, I wrote that the missing piece was saving gemini pages to wallabag.
So far, I managed without by either launching ariane[1] on my tablet or phone and opening my feed reader[3]. This works but is more painful when I just want to access saved article and not browse the gemini space. I thought about managing bookmarks shared between devices but that seems just too dirty and annoying.
I even thought about building some kind of gemini version of wallabag, but then I would need 2 app (wallabag and the gemini specific one), and that would have defeated the purpose of it because to be fair, I wanted everything in the same tool.
I tried scripting something around what I could find in Lagrange browser files (my main gemini browser now) but I couldn't find a way to get the right info.
Entered the awesome @Skyjake[3], and a few days after I created an issue to get the current opened tab via a cli argument, it was implemented and shipped with the 1.6.2 version :) Thanks again @Skyjake!
I hadn't had time to install it before today, but once installed, it took only a couple lines of bash script to create what I wanted.
For this to work, you need wallabag-cli installed on your system:
Wallbag-cli repository (https link)
If I recall correctly (I installed it last year), I had to patch it somehow… Ping me if you need help with it!
Once wallbag-cli is installed, it is child play to retrieve the url from lagrange with the new --tab-url argument and send it to wallabag. The only trick is about adding the url to a http to gemini proxy so that wallabag will retrieve the article content via http (as gemini url doesn't work in wallabag). In my case, I use proxy.vulpes.one but any proxy could be used.
My bash script is extremely simple:
#!/bin/bash proxy="https://proxy.vulpes.one/gemini/" URL=${proxy}$(lagrange --tab-url | sed 's/gemini:\/\///') wallabag add "${URL}"
3 lines of bash, one being the "configuration" for the url of the proxy, neat isn't it? I can now launch it via a keybind or dmenu :).
Well, again, it couldn't have been possible without Skyjake adding the right feature to Lagrange, so thanks to him again :)
Thanks to the dev of wallabag-cli, without them, I would be coding a way more complex software to use wallabag APIs myself.
And voilà :)