Updates for fediverse scripts. - gopher-lawn - The gopher lawn gopher directory project.
 (HTM) git clone git://bitreich.org/gopher-lawn/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/gopher-lawn/
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) Tags
       ---
 (DIR) commit af8e61f070664bd1ea1743d4ce06223550390e22
 (DIR) parent e3cc5279072ddbee7f2d58152732c759a9ede582
 (HTM) Author: Julian Schweinsberg <pazz0@0xfa.de>
       Date:   Mon, 25 Dec 2023 15:52:33 +0100
       
       Updates for fediverse scripts.
       
       1. get-pleroma-instances.sh: Use the new "fancy" GraphQL-thingie of
          fediverse.observer. The old API doesn't seem to exist anymore. Uses
          json2tsv's jaq. May be overengineered.
       2. check-for-gopher-service.sh: Reduce false positives by checking for
          the port 9999 in the nc output.
       
       Signed-off-by: Christoph Lohmann <20h@r-36.net>
       
       Diffstat:
         M fediverse/check-for-gopher-serviceā€¦ |       2 +-
         M fediverse/get-pleroma-instances.sh  |      17 +++++++++++------
       
       2 files changed, 12 insertions(+), 7 deletions(-)
       ---
 (DIR) diff --git a/fediverse/check-for-gopher-service.sh b/fediverse/check-for-gopher-service.sh
       @@ -7,5 +7,5 @@ then
        fi
        
        shuf "$1" \
       -        | xargs -I '{}' -P 16 sh -c 'server={}; printf "\r\n" | nc -w 5 ${server} 9999 >/dev/null 2>&1 && printf "%s serves gopher\n" "${server}";'
       +        | xargs -I '{}' -P 16 sh -c 'server={}; printf "\r\n" | nc -w 5 ${server} 9999 2>&1 | grep -q 9999 && printf "%s serves gopher\n" "${server}";'
        
 (DIR) diff --git a/fediverse/get-pleroma-instances.sh b/fediverse/get-pleroma-instances.sh
       @@ -1,7 +1,12 @@
        #!/bin/sh
       -
       -curl -s https://pleroma.fediverse.observer/app/views/tabledata.php?software=pleroma \
       -        | sed -e 's,app/views/podstat-user-counts.php?,\n,g' \
       -        | grep "^domain=" \
       -        | sed 's,^domain=\([^" ]*\).*,\1,'
       -
       +sed 's,",\\",g; s,$,\\n,' <<-EOF \
       +        | tr -d '\n' \
       +        | sed 's,^\(.*\)$,{"query":"\1"},' \
       +        | curl -s -H'Content-Type: application/json' --data-binary @- https://api.fediverse.observer/ \
       +        | jaq '$1 == ".data.nodes[].domain" { print $3 }'
       +{
       +        nodes(softwarename: "pleroma", status: "UP") {
       +                domain
       +        }
       +}
       +EOF