instanceinfo.sh: Use Mastodon API additionally for Mastodon.

The nodeinfo on Mastodon instances is rather sparse at the moment.
This commit is contained in:
tastytea 2019-09-30 01:53:53 +02:00
parent 82f531dc40
commit 9a7b53fc23
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
1 changed files with 12 additions and 5 deletions

View File

@ -1,7 +1,7 @@
#!/bin/bash
# Print some basic info about fediverse instances.
# Version: 2019-07-27_3
# Version: 2019-09-30_1
if [[ -z "${1}" ]]; then
echo "usage: ${0} DOMAIN" >&2
@ -30,10 +30,12 @@ function parse_nodeinfo()
{
local instance="${1}"
local nodeinfo="${2}"
json=$(${mycurl} "${nodeinfo}")
# shellcheck disable=SC2155
local json=$(${mycurl} "${nodeinfo}")
# shellcheck disable=SC2155
local implementation=$(jq -r ".software.name" <<<"${json}")
# shellcheck disable=SC2155
local version=$(jq -r ".software.version" <<<"${json}")
echo "${implementation} ${version} detected."
@ -86,7 +88,10 @@ function parse_nodeinfo()
echo -n " / "
jq -r ".metadata.library.tracks.total" <<<"${json}"
elif [[ "${implementation}" == "mastodon" ]]; then
echo "Further info, maybe: https://${instance}/about/more"
if [[ "${implementation}" == "mastodon" ]]; then
echo -e "\nUsing Mastodon API additionally."
parse_mastodon instance "https://${instance}/api/v1/instance"
fi
elif [[ "${implementation}" == "pixelfed" ]]; then
echo "Further info, maybe: https://${instance}/site/terms"
elif [[ "${implementation}" == "peertube" ]]; then
@ -98,7 +103,8 @@ function parse_mastodon()
{
local instance="${1}"
local mastoinfo="${2}"
json=$(${mycurl} "${mastoinfo}")
# shellcheck disable=SC2155
local json=$(${mycurl} "${mastoinfo}")
local implementation=""
if grep -Eq '"is_(pro|verified)"' <<<"${json}"; then
@ -147,7 +153,8 @@ function parse_misskey()
{
local instance="${1}"
local misskeyinfo="${2}"
json=$(${mycurl} -X POST "${misskeyinfo}")
# shellcheck disable=SC2155
local json=$(${mycurl} -X POST "${misskeyinfo}")
# shellcheck disable=SC2155
local version=$(jq -r ".version" <<<"${json}")