ibnstanceinfo.sh: Improved nodeinfo support.
This commit is contained in:
parent
3ea99489b1
commit
4f718646c6
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
# Print some basic info about fediverse instances.
|
||||
|
||||
# Version: 2019-06-24_6
|
||||
# Version: 2019-06-24_7
|
||||
|
||||
if [[ -z "${1}" ]]; then
|
||||
echo "usage: ${0} DOMAIN" >&2
|
||||
|
@ -51,26 +51,30 @@ function main()
|
|||
elif curl -sIf "${nodeinfo}" | grep -iq 'Content-Type: application/json'; then
|
||||
echo "Nodeinfo found."
|
||||
json=$(curl -s "${nodeinfo}")
|
||||
local implementation=""
|
||||
# shellcheck disable=SC2155
|
||||
local implementation=$(jq -r ".software.name" <<<"${json}")
|
||||
|
||||
if [[ $(jq -r ".software.name" <<<"${json}") == "pleroma" ]]; then
|
||||
implementation="Pleroma"
|
||||
fi
|
||||
[[ -n "${implementation}" ]] && echo "${implementation} detected."
|
||||
|
||||
echo -n "Description: "
|
||||
jq -r ".metadata.nodeDescription" <<<"${json}"
|
||||
# shellcheck disable=SC2155
|
||||
local description=$(jq -r ".metadata.nodeDescription" <<<"${json}")
|
||||
if [[ "${description}" == "null" ]]; then
|
||||
description=$(jq -r ".metadata.nodeName" <<<"${json}")
|
||||
fi
|
||||
[[ "${description}" != "null" ]] && echo "Description: ${description}"
|
||||
|
||||
echo "Admins: "
|
||||
jq -r ".metadata.staffAccounts" <<<"${json}"
|
||||
# shellcheck disable=SC2155
|
||||
local admins=$(jq -r ".metadata.staffAccounts" <<<"${json}")
|
||||
[[ "${admins}" != "null" ]] && echo "Admins: ${admins}"
|
||||
|
||||
echo -n "Number of users: "
|
||||
jq -r ".usage.users.total" <<<"${json}"
|
||||
|
||||
echo "Federation restrictions: "
|
||||
jq -r ".metadata.federation.mrf_simple" <<<"${json}"
|
||||
# shellcheck disable=SC2155
|
||||
local restrictions=$(jq -r ".metadata.federation.mrf_simple" <<<"${json}")
|
||||
[[ "${restrictions}" != "null" ]] && echo "Federation restrictions: ${restrictions}"
|
||||
|
||||
if [[ "${implementation}" == "Pleroma" ]]; then
|
||||
if [[ "${implementation}" == "pleroma" ]]; then
|
||||
echo "Further info, maybe: https://${instance}/about"
|
||||
fi
|
||||
elif curl -sIf "${mastoinfo}" | grep -iq 'Content-Type: application/json'; then
|
||||
|
|
Loading…
Reference in New Issue
Block a user