logo

utils

~/.local/bin tools and git-hooks git clone https://hacktivis.me/git/utils.git

nodeinfo-fetch.sh (423B)


  1. #!/bin/sh
  2. url="$1"
  3. accept_header='Accept: application/json'
  4. nodeinfo_url=''
  5. die() {
  6. echo $@
  7. exit 1
  8. }
  9. if [[ -z "${url}" ]]
  10. then
  11. die "Usage: ${0} [instance_url]"
  12. fi
  13. nodeinfo_url=$(curl -sSL -H "${accept_header}" "${url}/.well-known/nodeinfo" | jq '.links[].href' -r | sort | tail -1)
  14. if [[ -z "${nodeinfo_url}" ]]
  15. then
  16. die "Failed getting Nodeinfo endpoint"
  17. fi
  18. curl -sSL -H "${accept_header}" ${nodeinfo_url} | jq .