Switch to singular case (should only return one)

master
Keith Irwin 2022-11-07 12:18:44 -07:00
parent 46886b7d85
commit 60ab2966a2
Signed by: ki9
GPG Key ID: DF773B3F4A88DA86
1 changed files with 3 additions and 3 deletions

View File

@ -53,14 +53,14 @@ if ! wg_output="$(sudo /usr/bin/wg show "${TLD}" allowed-ips)"; then
fi
# Filter out this user's
user_peers="$(grep "${pubkey}" <<<"${wg_output}" 2>/dev/null)"
if [ "${user_peers}" == "" ]; then
user_peer="$(grep "${pubkey}" <<<"${wg_output}" 2>/dev/null)"
if [ "${user_peer}" == "" ]; then
printf "ERROR! %s accessed the dashboard but isn't on the network!\n" "${ip}" >>"${LOGFILE}"
exit 8
fi
# Get peer domains
if ! peer="$("${LIB_DIR}/ips_to_peers" tsv <<<"${user_peers}" | grep "${pubkey}")"; then
if ! peer="$("${LIB_DIR}/ips_to_peers" tsv <<<"${user_peer}" | grep "${pubkey}")"; then
printf 'ERROR! Peer %s not found!\n' "${pubkey}" >>"${LOGFILE}" &
printf 'Peer not found\n' | "${LIB_DIR}/http_res" 404
exit 6