Fixed single user check

master
Keith Irwin 2022-09-15 16:40:20 -06:00
parent 10ca5097ba
commit a9c2564292
Signed by: ki9
GPG Key ID: DF773B3F4A88DA86
1 changed files with 2 additions and 2 deletions

View File

@ -31,7 +31,7 @@ if ! [ -f "${TOKENS_FILE}" ]; then
fi
ip="${1}"
qs="$(<<<"${2}" tr '&' '\n' | sed 's/?//')"
un="$(<<<"${qs}" grep -oP 'un=(.*)' | sed 's/^un//' | xargs)"
un="$(<<<"${qs}" grep -oP 'un=(.*)' | sed 's/^un=//' | xargs)"
printf '%s requested peer listing...\n' "${ip}" >>"${LOGFILE}"
@ -63,7 +63,7 @@ fi
# Get domains for each peer
if peers="[$("${LIB_DIR}/wg_peer_list" json <<<"${peers}")]"; then
printf '{"token":"%s","peers":%s}' "${token}" "${peers}" | "${LIB_DIR}/http_res" 200 'application/json'
printf 'Sent usernumber peers to admin %s\n' "${ip}" >>"${LOGFILE}"
printf 'Sent peers to admin %s\n' "${ip}" >>"${LOGFILE}"
else
printf 'ERROR: Failed to lookup user: %s\n' "${ip}" >>"${LOGFILE}"
printf 'Failed to lookup rdns' | "${LIB_DIR}/http_res" 500