💾 Archived View for alpha.lyk.so › gemlog › 005-tinylog-autosubscription.gmi captured on 2023-05-24 at 17:48:15. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2022-01-08)

-=-=-=-=-=-=-

tinylog autosubscription

tangential preface

Before I get into the meat of this post: in the past I've been pretty hesitant to add entries to my gemlog. Most of what I want to write about seems to be about modifying the systems I use. Rather than write a discrete entry in my gemlog, I've just been quietly updating my "systems" pages. I wanted to make it easy to learn about the latest "refinement" of any particular system, as well as any major versions that came before, by visiting a single page.

Writing something in my gemlog for every tiny change made to those pages seemed redundant, so I haven't been doing this, but I'm going to start trying now. This should make it easier to dig into the evolution of each version of my systems while also aiding discoverability on platforms like Antenna that favor content presented chronologically.

the "meat" of this post

I maintain a tinylog:

/tiny.gmi

I use gtl to subscribe to the tinylogs of others:

https://git.bacardi55.io/bacardi55/gtl

bacardi55 keeps a public record of known tinylogs:

https://codeberg.org/bacardi55/gemini-tinylog-rfc/raw/branch/main/Known-tinylogs.md

I want to automatically subscribe to new tinylogs when they're added to that document. To that end, I wrote the following script which I run periodically:

#!/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

In short, it adds to your ~/.config/gtl/subs file any new URL and alias pairs in Known-tinylogs.md that don't match any lines in your ~/.config/gtl/blocked file.