From 46c24d03c87660bf9120a8a1bdf871ed770dff7d Mon Sep 17 00:00:00 2001 From: gnat Date: Mon, 25 Nov 2024 01:20:14 -0800 Subject: [PATCH] add script to add 88x31s of all fedi accounts it follows that implement .well-known/button.json --- scripts/add-following-88x31s | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100755 scripts/add-following-88x31s diff --git a/scripts/add-following-88x31s b/scripts/add-following-88x31s new file mode 100755 index 0000000..e1dd9d2 --- /dev/null +++ b/scripts/add-following-88x31s @@ -0,0 +1,7 @@ +toot following 0x6e6174 | cut -d' ' -f2 | while read -r account; do + url="$(toot whois $account | grep -i site -A1 | grep -E 'https?://')/.well-known/button.json"; + [ -n "${url}" ] && response="$(curl -s -o /dev/null -w '%{http_code}' "${url}")"; + [ "$response" -eq "200" ] && body="$(curl -s "${url}" | jq -r '.default as $default | .buttons[] | select(.id == $default) | "\"\(.alt)\""' 2>/dev/null)" + [ -n "${body}" ] && echo "${body}" > ./files/88x31/$(echo $url | sed 's/https:\/\///g; s/.well-known\/button.json//; s/\//-/g; s/.$//').html + body='' +done