A live bird collage card for your Home Assistant dashboard.
Fix caddyfile not updating due to command execution being intercepted by auth prompt
jaredb76af59a290816
diff --git a/scripts/advanced.php b/scripts/advanced.phpindex 85cdbe5d..751ccb8a 100644--- a/scripts/advanced.php+++ b/scripts/advanced.php@@ -25,7 +25,9 @@ if (!isset($_SERVER['PHP_AUTH_USER'])) {if(isset($_GET['submit'])) {if(isset($_GET["caddy_pwd"])) {$caddy_pwd = $_GET["caddy_pwd"];- saveSetting('CADDY_PWD', "\"$caddy_pwd\"",'update_caddyfile');+ saveSetting('CADDY_PWD', "\"$caddy_pwd\"");+ //Make sure the caddy file is set directly+ update_caddyfile();}if(isset($_GET["ice_pwd"])) {@@ -37,7 +39,8 @@ if(isset($_GET['submit'])) {$birdnetpi_url = $_GET["birdnetpi_url"];// remove trailing slash to prevent conf from becoming broken$birdnetpi_url = rtrim($birdnetpi_url, '/');- saveSetting('BIRDNETPI_URL', $birdnetpi_url,'update_caddyfile');+ saveSetting('BIRDNETPI_URL', $birdnetpi_url);+ update_caddyfile();}if(isset($_GET["rtsp_stream"])) {diff --git a/scripts/common.php b/scripts/common.phpindex d239edb1..96c533db 100644--- a/scripts/common.php+++ b/scripts/common.php@@ -1338,9 +1338,6 @@ function executeSysCommand($command_type, $extra_data_to_pass = null)$command = "sudo -u $user " . getFilePath('python3') . ' ' . getFilePath('species.py') . " --threshold " . escapeshellcmd($extra_data_to_pass) . " 2>&1";$result = shell_exec($command);//- } else if ($command_type == "update_caddyfile") {- $result = exec("sudo /usr/local/bin/update_caddyfile.sh > /dev/null 2>&1 &");- //} else if ($command_type == "update_birdnet") {$result = shell_exec("update_birdnet.sh");//@@ -1358,6 +1355,16 @@ function executeSysCommand($command_type, $extra_data_to_pass = null)return $result;}+/**+ * Updates the caddy configuration, only ever called when BirdNET-Pi Password or Site URL is set+ *+ * @return void+ */+function update_caddyfile()+{+ exec("sudo /usr/local/bin/update_caddyfile.sh > /dev/null 2>&1 &");+}+/*** Performs tasks such as stop, restart, disable and enable on the supplied service* input command must contain the service name and must contain a keyword that describes the action