💾 Archived View for gemini.patatas.ca › posts › bookmarks-solution-gemini.gmi captured on 2024-08-18 at 17:02:10. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2024-07-08)
-=-=-=-=-=-=-
2024-06-21
For me, one of the nagging little issues in gemini is syncing bookmarks between devices. For a while I've resorted to occasionally updating a static .gmi file via ssh, and then using Lagrange's "import all links on page" functionality. But ssh is a pain on mobile, so wouldn't it be great to have a more convenient way to keep everything synced? Bonus points if I can learn a bunch of stuff while doing it the hard way ;)
Well, thanks to a few posts and videos from SkyJake, Gritty, and Tomasino, and a crash course in basic Python, I now have a bookmarks page on my capsule that's generated on-the-fly by a script!
The script reads several .csv files, one for each category, prints the links to the screen, and at the bottom of each category, places a link to a separate script, one that lets me add a new bookmark.
When I click one of these, I'm prompted to input a URL, then prompted for a description, then asks me if the info is correct, and if I click 'yes', the script appends these to the associated csv file. So, each line of the csv has a URL, a link description, and the date the bookmark was added - eventually I'd like to have the option to sort alphabetically, or chronologically.
(Also - the links for adding new bookmarks won't work for anyone else; the scripts check the client certificate, and only authorized cert is mine, for obvious security reasons)
It's still kinda buggy - but that's not a huge surprise, because it's my first CGI script *and* first Python project. Oh and also because debugging was, uh, somewhat tricky, not only because of those two things, but also because the only information I was getting was if the script runs or not; if it was the latter, I'd just get a generic error message from Lagrange. It didn't help matters much that the logic required was, for me at least, not exactly intuitive.
I'll probably update the scripts as I learn a little more Python, and who knows, maybe even post the code at some point? In the meantime, if anyone's interested, and promises not to dunk too hard on my noob code - or better yet, wants to help debug it lol - I'm happy to share :))
Overall a fun little project. Might try and write a tinylog script next, which should hopefully be straightforward enough, even for a novice like me. Famous last words!