Skip to content

A live bird collage card for your Home Assistant dashboard.

working better -- added URL configuration

Patrick McGuire1017bbbf22d5
diff --git a/Birders_Guide_Installer.sh b/Birders_Guide_Installer.sh
index 5435bcf1..9aeb68ff 100755
--- a/Birders_Guide_Installer.sh
+++ b/Birders_Guide_Installer.sh
@@ -149,9 +149,9 @@ DO_RECORDING=y
## will be web-hosted. If you do not own a domain, or would just prefer to keep
## the BirdNET-Pi on your local network, keep this EMPTY.
-BIRDNETPI_URL=
-EXTRACTIONLOG_URL=
-BIRDNETLOG_URL=
+BIRDNETPI_URL=${BIRDNETPI_URL}
+EXTRACTIONLOG_URL=${EXTRACTIONLOG_URL}
+BIRDNETLOG_URL=${BIRDNETLOG_URL}
## CADDY_PWD is the plaintext password (that will be hashed) and used to access
## the "Processed" directory and live audio stream. This MUST be set if you
diff --git a/Birders_Guide_Installer_Configuration.txt b/Birders_Guide_Installer_Configuration.txt
index b2e0eedb..78445fc6 100644
--- a/Birders_Guide_Installer_Configuration.txt
+++ b/Birders_Guide_Installer_Configuration.txt
@@ -45,3 +45,10 @@ DB_ROOT_PWD=
# detections.
PUSHED_APP_SECRET=
PUSHED_APP_KEY=
+
+# If you own your own domain, you can input that here to have caddy register
+# TLS certificates for the web interface
+
+BIRDNETPI_URL=
+BIRDNETLOG_URL=
+EXTRACTIONLOG_URL=
diff --git a/scripts/birdnet-pi-config b/scripts/birdnet-pi-config
index db68e3a7..96f03899 100755
--- a/scripts/birdnet-pi-config
+++ b/scripts/birdnet-pi-config
@@ -473,6 +473,39 @@ do_wifi_ssid_passphrase() {
return $RET
}
+do_get_birdnetlog_url() {
+ birdnetlog_url=$(whiptail --inputbox "Put your domain here. Example: \"https://birdnetlog.pmcgui.xyz\"." \
+ 19 70 -- "https://" 3>&1 1>&2 2>&3) ${birdnetpi_dir}/scripts/write_config.sh
+ if [ $? -eq 0 ];then
+ return 0
+ ASK_TO_REBOOT=2
+ else
+ return 1
+ fi
+}
+
+do_get_extractionlog_url() {
+ extractionlog_url=$(whiptail --inputbox "Put your domain here. Example: \"https://extractionlog.pmcgui.xyz\"." \
+ 19 70 -- "https://" 3>&1 1>&2 2>&3) ${birdnetpi_dir}/scripts/write_config.sh
+ if [ $? -eq 0 ];then
+ return 0
+ ASK_TO_REBOOT=2
+ else
+ return 1
+ fi
+}
+
+do_get_birdnetpi_url() {
+ birdnetpi_url=$(whiptail --inputbox "Put your domain here. Example: \"https://birdnetpi.pmcgui.xyz\"." \
+ 19 70 -- "https://" 3>&1 1>&2 2>&3) ${birdnetpi_dir}/scripts/write_config.sh
+ if [ $? -eq 0 ];then
+ return 0
+ ASK_TO_REBOOT=2
+ else
+ return 1
+ fi
+}
+
do_get_db_root_pwd() {
db_root_pwd=$(whiptail --inputbox "Please set the password the 'root' user will use to access the database." \
19 70 3>&1 1>&2 2>&3) ${birdnetpi_dir}/scripts/write_config.sh
@@ -585,6 +618,25 @@ if [ $(id -u) -ne 0 ]; then
exit 1
fi
+do_get_urls_menu() {
+ FUN=$(whiptail --title "BirdNET-Pi Software Configuration Tool (birdnet-pi-config)" --menu "Interfacing Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \
+ "BirdNET-Pi URL" "Set the main web interface URL" \
+ "BirdNET Analysis Log URL" "Set the URL that will be used to view the BirdNET log" \
+ "Audio Extraction Log URL" "Set the URL that will be used to view the Audio Extraction log" \
+ 3>&1 1>&2 2>&3)
+ RET=$?
+ if [ $RET -eq 1 ]; then
+ return 0
+ elif [ $RET -eq 0 ]; then
+ case "$FUN" in
+ *Pi*) do_get_birdnetpi_url;;
+ *Analysis*) do_get_extractionlog_url;;
+ Audio*) do_get_birdnetlog_url;;
+ *) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;;
+ esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1
+ fi
+}
+
do_system_menu() {
if is_pi ; then
FUN=$(whiptail --title "BirdNET-Pi Software Configuration Tool (birdnet-pi-config)" --menu "System Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \
@@ -620,7 +672,7 @@ do_system_menu() {
fi
}
-do_advanced_config() {
+do_advanced_config_menu() {
if is_pi ; then
FUN=$(whiptail --title "BirdNET-Pi Software Configuration Tool (birdnet-pi-config)" --menu "BirdNET-Pi Configuration Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \
"Sensitivity" "Set the sigmoid sensitivity" \
@@ -639,7 +691,7 @@ do_advanced_config() {
Sens*) do_get_sensitivity;;
Confi*) do_get_confidence;;
Overlap*) do_get_overlap;;
- Bird*) do_get_birdnetpi_urls;;
+ Bird*) do_get_birdnetpi_url; do_get_birdnetlog_url; do_get_extractionlog_url;;
*) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;;
esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1
fi
@@ -689,7 +741,7 @@ do_config_birdnet_menu() {
Cad*) do_get_caddy_pwd;;
Ice*) do_get_ice_pwd;;
Data*) do_get_db_pwds;;
- Advanced*) do_advanced_config;;
+ Advanced*) do_advanced_config_menu;;
*) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;;
esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1
fi
diff --git a/scripts/write_config.sh b/scripts/write_config.sh
index d8155ec6..424a7537 100755
--- a/scripts/write_config.sh
+++ b/scripts/write_config.sh
@@ -8,3 +8,6 @@ sed -i s/'^CADDY_PWD=$'/"CADDY_PWD=${caddy_pwd}"/g ${birders_conf}
sed -i s/'^ICE_PWD=$'/"ICE_PWD=${ice_pwd}"/g ${birders_conf}
sed -i s/'^DB_PWD=$'/"DB_PWD=${db_pwd}"/g ${birders_conf}
sed -i s/'^DB_ROOT_PWD=$'/"DB_ROOT_PWD=${db_root_pwd}"/g ${birders_conf}
+sed -i s/'^BIRDNETPI_URL=$'/"BIRDNETPI_URL=${birdnetpi_url/\/\//\\\/\\\/}"/g ${birders_conf}
+sed -i s/'^EXTRACTIONLOG_URL=$'/"EXTRACTIONLOG_URL=${extractionlog_url/\/\//\\\/\\\/}"/g ${birders_conf}
+sed -i s/'^BIRDNETLOG_URL=$'/"BIRDNETLOG_URL=${birdnetlog_url/\/\//\\\/\\\/}"/g ${birders_conf}