Neeeeeed token
parent
408736b75b
commit
e17047184c
|
@ -41,7 +41,7 @@ if [ "${token}" == "" ]; then
|
|||
printf 'Creating token for %s...\n' "${ip}" >>"${LOGFILE}"
|
||||
token="$(</dev/urandom tr -dc '[:alnum:]' | fold -w64 | head -n1)"
|
||||
printf '%s\t%s\n' "${ip}" "${token}" >>"${TOKENS_FILE}"
|
||||
fi &
|
||||
fi
|
||||
|
||||
# Get peer IP list
|
||||
if ! peers="$(sudo /usr/bin/wg show "${TLD}" allowed-ips)"; then
|
||||
|
@ -62,7 +62,7 @@ fi
|
|||
|
||||
# Get domains for each peer
|
||||
if peers="[$("${LIB_DIR}/ips_to_peers" json <<<"${peers}")]"; then
|
||||
printf '{"token":"%s","peers":%s}' "${token}" "${peers}" | "${LIB_DIR}/http_res" 200 'application/json'
|
||||
printf '{"token":"%s","peers":%s}' "${token!}" "${peers!}" | "${LIB_DIR}/http_res" 200 'application/json'
|
||||
printf 'Sent peers to admin %s\n' "${ip}" >>"${LOGFILE}"
|
||||
else
|
||||
printf 'ERROR: Failed to lookup user: %s\n' "${ip}" >>"${LOGFILE}"
|
||||
|
|
Loading…
Reference in New Issue