diff --git a/mastodon-outdated b/mastodon-outdated new file mode 100755 index 0000000..c566a3b --- /dev/null +++ b/mastodon-outdated @@ -0,0 +1,3 @@ +#!/bin/bash +beforeversion="$1" +curl -s 'https://instances.social/list.json?q%5Busers%5D=&strict=true' | python3 -c 'import json,sys'$'\n''d = json.loads(sys.stdin.read())'$'\n''for i in d["instances"]:'$'\n'' print("{} {} {} {}".format(i["name"], i["version"] or "None", i["users"], i["statuses"]))' | grep -v ' None ' | sort -k2,2 | awk '$2 < "'"${beforeversion}"'"' | awk '{print $1 " | data-sort-value=\"" $1 "\" | [http://" $1 "/ " $1 "] || " $2 " || " $3 " || " $4 }' | while read -r domain line; do content="$(curl -sL "http://${domain}/about")"; if grep -qF '//github.com/tootsuite/mastodon' <<<"${content}"; then mastodon="{{green|Yes}}"; elif grep -qF 'mastodon' <<<"${content}"; then mastodon="{{orange|Possibly}}"; else mastodon="{{red|No?}}"; fi; echo "${line} || ${mastodon}"; echo '|-'; done