lazily check if onion or i2p sites exist in instances.json before running jq.

This commit is contained in:
Sahal Ansari 2024-07-25 20:26:15 -05:00
parent f19da6ca8d
commit dfba0f285b

View File

@ -728,8 +728,12 @@ main ()
# (a mapfile would not ideal here since a pipe is required, inducing a
# subshell, meaning nothing will actually get added to
# imported_nonwww)
if grep -q ".onion" "${import_nonwww_from_file}" || grep -q ".i2p" "${import_nonwww_from_file}" ; then
IFS=$'\n' imported_nonwww=($(jq -Mcer '.instances[] | select(.onion or .i2p)' "${import_nonwww_from_file}"))
rc=$?
else
rc=0
fi
if [[ ${rc} -ne 0 ]]
then