instanceinfo.sh: Improved Misskey parsing.

This commit is contained in:
tastytea 2019-07-27 00:39:46 +02:00
parent e34a41f912
commit 42c9f843ec
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
1 changed files with 5 additions and 5 deletions

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Print some basic info about fediverse instances. # Print some basic info about fediverse instances.
# Version: 2019-07-26_2 # Version: 2019-07-27_3
if [[ -z "${1}" ]]; then if [[ -z "${1}" ]]; then
echo "usage: ${0} DOMAIN" >&2 echo "usage: ${0} DOMAIN" >&2
@ -151,22 +151,22 @@ function parse_misskey()
# shellcheck disable=SC2155 # shellcheck disable=SC2155
local version=$(jq -r ".version" <<<"${json}") local version=$(jq -r ".version" <<<"${json}")
echo "Misskey ${version} detected." [[ "${version}" != "null" ]] && echo "Misskey ${version} detected."
# shellcheck disable=SC2155 # shellcheck disable=SC2155
local email=$(jq -r ".maintainerEmail" <<<"${json}") local email=$(jq -r ".maintainerEmail" <<<"${json}")
[[ -n "${email}" ]] && echo "E-Mail: ${email}" [[ "${email}" != "null" ]] && echo "E-Mail: ${email}"
# shellcheck disable=SC2155 # shellcheck disable=SC2155
local users=$(${mycurl} -X POST "https://${instance}/api/stats" | jq -r ".usersCount") local users=$(${mycurl} -X POST "https://${instance}/api/stats" | jq -r ".usersCount")
[[ -n ${users} ]] && echo "Number of users: ${users}" [[ ${users} != "null" ]] && echo "Number of users: ${users}"
echo -n "Open registrations: " echo -n "Open registrations: "
jq -r ".features.registration" <<<"${json}" jq -r ".features.registration" <<<"${json}"
# shellcheck disable=SC2155 # shellcheck disable=SC2155
local tos=$(jq -r ".ToSUrl" <<<"${json}") local tos=$(jq -r ".ToSUrl" <<<"${json}")
[[ -n "${tos}" ]] && echo "ToS: ${tos}" [[ "${tos}" != "null" ]] && echo "ToS: ${tos}"
} }
function main() function main()