mirror of
https://github.com/pi-hole/pi-hole
synced 2025-07-04 14:22:33 +00:00
Allow to get API URL from local.api.ftl even if DNS port has changed (#6252)
This commit is contained in:
commit
cad0d0bf1f
@ -19,13 +19,19 @@
|
|||||||
|
|
||||||
TestAPIAvailability() {
|
TestAPIAvailability() {
|
||||||
|
|
||||||
|
local chaos_api_list authResponse authStatus authData apiAvailable DNSport
|
||||||
|
|
||||||
# as we are running locally, we can get the port value from FTL directly
|
# as we are running locally, we can get the port value from FTL directly
|
||||||
local chaos_api_list authResponse authStatus authData apiAvailable
|
readonly utilsfile="${PI_HOLE_SCRIPT_DIR}/utils.sh"
|
||||||
|
# shellcheck source=./advanced/Scripts/utils.sh
|
||||||
|
. "${utilsfile}"
|
||||||
|
|
||||||
|
DNSport=$(getFTLConfigValue dns.port)
|
||||||
|
|
||||||
# Query the API URLs from FTL using CHAOS TXT local.api.ftl
|
# Query the API URLs from FTL using CHAOS TXT local.api.ftl
|
||||||
# The result is a space-separated enumeration of full URLs
|
# The result is a space-separated enumeration of full URLs
|
||||||
# e.g., "http://localhost:80/api/" "https://localhost:443/api/"
|
# e.g., "http://localhost:80/api/" "https://localhost:443/api/"
|
||||||
chaos_api_list="$(dig +short chaos txt local.api.ftl @127.0.0.1)"
|
chaos_api_list="$(dig +short -p "${DNSport}" chaos txt local.api.ftl @127.0.0.1)"
|
||||||
|
|
||||||
# If the query was not successful, the variable is empty
|
# If the query was not successful, the variable is empty
|
||||||
if [ -z "${chaos_api_list}" ]; then
|
if [ -z "${chaos_api_list}" ]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user