mirror of
https://github.com/pi-hole/pi-hole.git
synced 2025-04-19 05:40:13 +00:00
Improve pihole -f
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
parent
25f384a923
commit
5dfcd02c40
2 changed files with 64 additions and 23 deletions
|
@ -21,7 +21,7 @@
|
|||
TestAPIAvailability() {
|
||||
|
||||
# as we are running locally, we can get the port value from FTL directly
|
||||
local chaos_api_list availabilityResonse
|
||||
local chaos_api_list availabilityResponse
|
||||
|
||||
# Query the API URLs from FTL using CHAOS TXT local.api.ftl
|
||||
# The result is a space-separated enumeration of full URLs
|
||||
|
@ -43,16 +43,16 @@ TestAPIAvailability() {
|
|||
API_URL="${API_URL#\"}"
|
||||
|
||||
# Test if the API is available at this URL
|
||||
availabilityResonse=$(curl -skS -o /dev/null -w "%{http_code}" "${API_URL}auth")
|
||||
availabilityResponse=$(curl -skS -o /dev/null -w "%{http_code}" "${API_URL}auth")
|
||||
|
||||
# Test if http status code was 200 (OK) or 401 (authentication required)
|
||||
if [ ! "${availabilityResonse}" = 200 ] && [ ! "${availabilityResonse}" = 401 ]; then
|
||||
if [ ! "${availabilityResponse}" = 200 ] && [ ! "${availabilityResponse}" = 401 ]; then
|
||||
# API is not available at this port/protocol combination
|
||||
API_PORT=""
|
||||
else
|
||||
# API is available at this URL combination
|
||||
|
||||
if [ "${availabilityResonse}" = 200 ]; then
|
||||
if [ "${availabilityResponse}" = 200 ]; then
|
||||
# API is available without authentication
|
||||
needAuth=false
|
||||
fi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue