From 9fd1bb773ed0cac7b0849a012442fe36fa59fa82 Mon Sep 17 00:00:00 2001 From: tastytea Date: Tue, 25 Jun 2019 02:27:07 +0200 Subject: [PATCH] Print version of server software. --- instanceinfo.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/instanceinfo.sh b/instanceinfo.sh index 17d7912..b745596 100755 --- a/instanceinfo.sh +++ b/instanceinfo.sh @@ -31,6 +31,10 @@ function main() echo "Misskey API found." json=$(curl -s -X POST "${misskeyinfo}") + # shellcheck disable=SC2155 + local version=$(jq -r ".version" <<<"${json}") + echo "Misskey ${version} detected." + # shellcheck disable=SC2155 local email=$(jq -r ".maintainerEmail" <<<"${json}") [[ -n "${email}" ]] && echo "E-Mail: ${email}" @@ -51,10 +55,12 @@ function main() elif curl -sIf "${nodeinfo}" | grep -iq 'Content-Type: application/json'; then echo "Nodeinfo found." json=$(curl -s "${nodeinfo}") + # shellcheck disable=SC2155 local implementation=$(jq -r ".software.name" <<<"${json}") - - [[ -n "${implementation}" ]] && echo "${implementation} detected." + # shellcheck disable=SC2155 + local version=$(jq -r ".software.version" <<<"${json}") + echo "${implementation} ${version} detected." # shellcheck disable=SC2155 local description=$(jq -r ".metadata.nodeDescription" <<<"${json}") @@ -97,7 +103,11 @@ function main() elif grep -Eq '"version":"[0-9]+\.[0-9]+\.[0-9]+"' <<<"${json}"; then implementation="Mastodon" fi - [[ -n "${implementation}" ]] && echo "${implementation} detected." + if [[ -n "${implementation}" ]]; then + # shellcheck disable=SC2155 + local version=$(jq -r ".version" <<<"${json}") + echo "${implementation} ${version} detected." + fi echo -n "Description: " # shellcheck disable=SC2046