💾 Archived View for gamma.lyk.so › systems › gemini captured on 2021-11-30 at 20:18:30. Gemini links have been rewritten to link to archived content
-=-=-=-=-=-=-
Updated 2021-11-14
For my Gemini client, I use a build of Lagrange compiled with my own preferred fonts. For my Gemini server, I'm back to using Solene's vger on an OpenBSD VM hosted by openbsd.amsterdam. I used Omar Polo's gmid for a while before that in order to play with writing client-authenticated services, but I've satisfied that curiousity for now.
I use rsync to upload my files.
For adding entries to my tinylog and mirroring them to station.martinrue.com, I use something like this script (my own values supplied instead of the example values used here):
#!/usr/bin/env sh set -e # Example values. Supply your own. log="~/documents/gemsite/tiny.gmi" scpflags="-i ~/.ssh/xxxx.key -P 22" scptarget="xxxx@10.0.0.1:/var/gemini/" ## IF YOU DON'T CARE ABOUT MIRRORING TO STATION, YOU CAN DELETE EVERYTHING FROM HERE... stationpost="gemini://station.martinrue.com/xxxx/xxxx/post" cert="~/.config/lagrange/idents/xxxx.crt" key="~/.config/lagrange/idents/xxxx.key" # Mirror to station.martinrue.com if the post is not a tinylog reply if (! echo "$@" | head -n1 | grep -iq "^re: "); then urlencoded="$(echo -n "$@" | perl -MURI::Escape -ne 'print uri_escape($_)')" stationurl="$stationpost?$urlencoded" # Don't exceed the maximum post length on Station. urllen="$(printf "%s" "$stationurl" | wc -c)" if [ "$urllen" -gt "1024" ]; then >&2 echo "ERROR: The post URL exceeds 1024 bytes. The URL was $urllen bytes long. Trim down your post and try again." exit 1 fi gemget --cert $cert --key $key $stationurl -o - > /dev/null fi ## ...TO HERE. ed $log <<EOF /## i ## $(date -u +'%F %H:%M UTC') $@ . w q EOF SSH_AUTH_SOCK='' scp $scpflags $log $scptarget
This script first checks to see if the post appears to be a tinylog reply. If it isn't, it uses Perl to URL-encode the entry and checks the length of the resulting URL for posting to Station. If it's not longer than the Gemini protocol limit of 1024 bytes, it uses gemget to post the entry to station.martinrue.com. Then it opens my tinylog in ed, finds the first occurrence of "##", enters insert mode on the line above it, enters the date in the format suggested by bacardi55's RFC, the arguments to the script, and a blank line, leaves insert mode, writes, and quits. Finally it uses scp to upload the updated tinylog to my gemsite over ssh.
For consuming tinylogs, I use bacardi55's gtl client and autosubscribe to tinylogs in that project's Known-tinylogs.md file using the following script:
#!/usr/bin/env sh set -e cd ~/.config/gtl temp="$(mktemp -d)" trap 'rm -fr "$temp"' EXIT INT HUP # Ensure subs file is sorted cat subs | sort > "$temp/sorted" mv "$temp/sorted" subs # Ensure a "blocked" file exists touch blocked curl -s https://codeberg.org/bacardi55/gemini-tinylog-rfc/raw/branch/main/Known-tinylogs.md \ | grep "* gemini://" \ | sed "s/^\* //g" \ | sort \ > "$temp/known" comm -13 blocked "$temp/known" > "$temp/new-subs-file" comm -13 subs "$temp/new-subs-file" > "$temp/new-logs" if [ "$(cat "$temp/new-logs")" != "" ]; then echo "Subscribing to:" cat "$temp/new-logs" else echo "No new tinylogs." fi mv "$temp/new-subs-file" subs
update-tinylog-subscriptions.sh
It adds to my ~/.config/gtl/subs file any new URL and alias pairs in Known-tinylogs.md that don't match any lines in my ~/.config/gtl/blocked file.