mirror of
https://github.com/pi-hole/PADD.git
synced 2026-04-02 08:24:34 +01:00
Merge branch 'development' into server-full-path
This commit is contained in:
42
padd.sh
42
padd.sh
@@ -168,33 +168,33 @@ TestAPIAvailability() {
|
||||
authData=$(printf %s "${authResponse%???}")
|
||||
|
||||
# Test if http status code was 200 (OK) or 401 (authentication required)
|
||||
if [ ! "${authStatus}" = 200 ] && [ ! "${authStatus}" = 401 ]; then
|
||||
# API is not available at this port/protocol combination
|
||||
apiAvailable=false
|
||||
else
|
||||
# API is available at this URL combination
|
||||
|
||||
if [ "${authStatus}" = 200 ]; then
|
||||
# API is available without authentication
|
||||
needAuth=false
|
||||
fi
|
||||
if [ "${authStatus}" = 200 ]; then
|
||||
# API is available without authentication
|
||||
apiAvailable=true
|
||||
needAuth=false
|
||||
break
|
||||
|
||||
elif [ "${authStatus}" = 401 ]; then
|
||||
# API is available with authentication
|
||||
apiAvailable=true
|
||||
needAuth=true
|
||||
# Check if 2FA is required
|
||||
needTOTP=$(echo "${authData}"| jq --raw-output .session.totp 2>/dev/null)
|
||||
|
||||
apiAvailable=true
|
||||
break
|
||||
fi
|
||||
else
|
||||
# API is not available at this port/protocol combination
|
||||
apiAvailable=false
|
||||
|
||||
# Remove the first URL from the list
|
||||
local last_api_list
|
||||
last_api_list="${chaos_api_list}"
|
||||
chaos_api_list="${chaos_api_list#* }"
|
||||
# Remove the first URL from the list
|
||||
local last_api_list
|
||||
last_api_list="${chaos_api_list}"
|
||||
chaos_api_list="${chaos_api_list#* }"
|
||||
|
||||
# If the list did not change, we are at the last element
|
||||
if [ "${last_api_list}" = "${chaos_api_list}" ]; then
|
||||
# Remove the last element
|
||||
chaos_api_list=""
|
||||
# If the list did not change, we are at the last element
|
||||
if [ "${last_api_list}" = "${chaos_api_list}" ]; then
|
||||
# Remove the last element
|
||||
chaos_api_list=""
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
Reference in New Issue
Block a user