instanceinfo.sh: Added CloudFlare-check.
This commit is contained in:
parent
18e8c3b52d
commit
f5a0761421
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
# Print some basic info about fediverse instances.
|
||||
|
||||
# Version: 2019-07-08_1
|
||||
# Version: 2019-07-12_1
|
||||
|
||||
if [[ -z "${1}" ]]; then
|
||||
echo "usage: ${0} DOMAIN" >&2
|
||||
|
@ -23,11 +23,11 @@ function main()
|
|||
{
|
||||
local instance="${1}"
|
||||
# shellcheck disable=SC2155
|
||||
local nodeinfo=$(curl -s "https://${instance}/.well-known/nodeinfo" | jq -r '.links[-1].href' 2> /dev/null)
|
||||
local nodeinfo=$(curl -sL "https://${instance}/.well-known/nodeinfo" | jq -r '.links[-1].href' 2> /dev/null)
|
||||
local mastoinfo="https://${instance}/api/v1/instance"
|
||||
local misskeyinfo="https://${instance}/api/meta"
|
||||
|
||||
if curl -sIf -X POST "${misskeyinfo}" | grep -iq 'Content-Type: application/json'; then
|
||||
if curl -sILf -X POST "${misskeyinfo}" | grep -iq 'Content-Type: application/json'; then
|
||||
echo "Misskey API found."
|
||||
json=$(curl -s -X POST "${misskeyinfo}")
|
||||
|
||||
|
@ -52,7 +52,7 @@ function main()
|
|||
# shellcheck disable=SC2155
|
||||
local tos=$(jq -r ".ToSUrl" <<<"${json}")
|
||||
[[ -n "${tos}" ]] && echo "ToS: ${tos}"
|
||||
elif curl -sIf "${nodeinfo}" | grep -iq 'Content-Type: application/json'; then
|
||||
elif curl -sILf "${nodeinfo}" | grep -iq 'Content-Type: application/json'; then
|
||||
echo "Nodeinfo found."
|
||||
json=$(curl -s "${nodeinfo}")
|
||||
|
||||
|
@ -96,7 +96,7 @@ function main()
|
|||
elif [[ "${implementation}" == "mastodon" ]]; then
|
||||
echo "Further info, maybe: https://${instance}/about/more"
|
||||
fi
|
||||
elif curl -sIf "${mastoinfo}" | grep -iq 'Content-Type: application/json'; then
|
||||
elif curl -sILf "${mastoinfo}" | grep -iq 'Content-Type: application/json'; then
|
||||
echo "Mastodon API found."
|
||||
json=$(curl -s "${mastoinfo}")
|
||||
local implementation=""
|
||||
|
@ -143,6 +143,10 @@ function main()
|
|||
curl -I "https://${instance}/"
|
||||
fi
|
||||
|
||||
if curl -sILf "${instance}" | grep -q 'Server: cloudflare'; then
|
||||
echo "Uses CloudFlare."
|
||||
fi
|
||||
|
||||
echo "See also: https://fediverse.network/${instance}"
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user