Home
fediverse-scripts: Check for Pleroma gopher frontends on port 70 and 9999 - gopher-lawn - The gopher lawn gopher directory project. HTML git clone git://bitreich.org/gopher-lawn/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/gopher-lawn/ DIR Log DIR Files DIR Refs DIR Tags --- DIR commit f0b1b8d0b43fe141ec73bdf335b2a5977818b426 DIR parent 4aad4e8ef0a80cfc302bcdae6ebe837c6b442e65 HTML Author: Julian Schweinsberg <pazz0@0xfa.de> Date: Mon, 8 Jul 2024 19:17:55 +0200 fediverse-scripts: Check for Pleroma gopher frontends on port 70 and 9999 9999 is the default Pleroma gopher port. That was the only port checked before. There are at least two Pleroma instances using port 70 instead of port 9999. So it makes sense to check it, too. The check for "Public Timeline" was added because in some cases there are other gopherds listening on port 70. Signed-off-by: Christoph Lohmann <20h@r-36.net> Diffstat: M fediverse/check-for-gopher-serviceā¦ | 24 ++++++++++++++++++------ M fediverse/mk-db-entries.sh | 7 ++++--- 2 files changed, 22 insertions(+), 9 deletions(-) --- DIR diff --git a/fediverse/check-for-gopher-service.sh b/fediverse/check-for-gopher-service.sh @@ -1,11 +1,23 @@ #!/bin/sh -if [ $# -lt 1 ]; +if [ "x$WORKER" = x1 ]; then - printf "usage: %s pleroma-servers.txt\n" "$(basename "$0")" >&2 - exit 1 -fi + for port in 70 9999; + do + # grep using $port because there are cases (at least one) where: + # 1. the frontend is accessible on port 70 but is primarily running on port 9999 (the menu is pointing to port 9999) + # 2. the frontend is accessible on port 70, the menus are pointing at port 9999, but on port 9999 nothing answers... + printf "\r\n" | nc -w 5 "$1" "${port}" 2>/dev/null | \ + grep "${port}" | grep -q 'Public Timeline' \ + && printf '%s:%s serves gopher\n' "$1" "${port}" && exit + done +else + if [ $# -lt 1 ]; + then + printf "usage: %s pleroma-servers.txt\n" "$(basename "$0")" >&2 + exit 1 + fi -shuf "$1" \ - | xargs -I '{}' -P 16 sh -c 'server={}; printf "\r\n" | nc -w 5 ${server} 9999 2>/dev/null | grep -q 9999 && printf "%s serves gopher\n" "${server}";' + shuf "$1" | xargs -I '{}' -P 16 sh -c "WORKER=1 '$0' '{}'" +fi DIR diff --git a/fediverse/mk-db-entries.sh b/fediverse/mk-db-entries.sh @@ -1,19 +1,20 @@ #!/bin/sh -lawndb="/br/gopher/lawn/db" +lawndb="../db" cd "${lawndb}" while read -r line; do [ -z "${line}" ] && continue - server="$(printf "%s\n" "${line}" | cut -d' ' -f 1)" + server="$(printf "%s\n" "${line}" | cut -d' ' -f 1 | cut -d':' -f 1)" + port="$(printf "%s\n" "${line}" | cut -d' ' -f 1 | cut -d':' -f 2)" linkfile="fediverse-${server}.link" { printf "Type: link\n" printf "Selector: \n" printf "Host: %s\n" "${server}" - printf "Port: 9999\n" + printf "Port: %s\n" "${port}" printf "LinkName: Pleroma at %s\n" "${server}" printf "Description: Pleroma interface running at %s\n" "${server}" printf "Keywords: fediverse\n"