Fix caddyfile not updating due to command execution being intercepted by auth prompt
We always want this command to execute regardless and rebuild the caddy config accordingly.
This commit is contained in:
@@ -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"])) {
|
||||
|
||||
+10
-3
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user