working better -- added URL configuration

This commit is contained in:
Patrick McGuire
2021-10-29 17:58:37 -04:00
parent f8dbd3b246
commit 1017bbbf22
4 changed files with 68 additions and 6 deletions
+3 -3
View File
@@ -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
@@ -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=
+55 -3
View File
@@ -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
+3
View File
@@ -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}