Skip to content

Commit

Permalink
Fixed issues that occur if Web Interface unavailable
Browse files Browse the repository at this point in the history
- Show the version as N/A (Not Available) instead of v-1
- Don't show out-of-date message in status message
  • Loading branch information
subnut committed Feb 26, 2022
1 parent dbb8dbc commit 8558356
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions padd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -511,20 +511,27 @@ GetVersionInformation() {
fi

# Gather web version information...
read -r -a web_versions <<< "$(pihole -v -a)"
web_version=$(echo "${web_versions[3]}" | tr -d '\r\n[:alpha:]')
web_version_latest=${web_versions[5]//)}
if [[ "${web_version_latest}" == "ERROR" ]]; then
web_version_heatmap=${yellow_text}
else
web_version_latest=$(echo "${web_version_latest}" | tr -d '\r\n[:alpha:]')
# is web up-to-date?
if [[ "${web_version}" != "${web_version_latest}" ]]; then
out_of_date_flag="true"
web_version_heatmap=${red_text}
if [[ "$(source /etc/pihole/setupVars.conf; echo "$INSTALL_WEB_INTERFACE")" = true ]]; then
read -r -a web_versions <<< "$(pihole -v -a)"
web_version=$(echo "${web_versions[3]}" | tr -d '\r\n[:alpha:]')
web_version_latest=${web_versions[5]//)}
if [[ "${web_version_latest}" == "ERROR" ]]; then
web_version_heatmap=${yellow_text}
else
web_version_heatmap=${green_text}
web_version_latest=$(echo "${web_version_latest}" | tr -d '\r\n[:alpha:]')
# is web up-to-date?
if [[ "${web_version}" != "${web_version_latest}" ]]; then
out_of_date_flag="true"
web_version_heatmap=${red_text}
else
web_version_heatmap=${green_text}
fi
fi
else
# Web interface not installed
web_version_heatmap=${red_text}
web_version="$(printf '\x08')" # Hex 0x08 is for backspace, to delete the leading 'v'
web_version="${web_version}N/A" # N/A = Not Available
fi

# Gather FTL version information...
Expand Down

0 comments on commit 8558356

Please sign in to comment.