A live bird collage card for your Home Assistant dashboard.
checks for empty urls
mcguirepr896990d421b8b2
diff --git a/homepage/index.php b/homepage/index.phpindex ccfb05b2..00e03ba2 100644--- a/homepage/index.php+++ b/homepage/index.php@@ -30,16 +30,28 @@ if (!isset($_SERVER['PHP_AUTH_USER'])) {echo "<h1>BirdNET-Pi</h1><form action=\"\" method=\"GET\"><button type=\"submit\" name=\"stream\" value=\"play\">Live Audio</button></form>";}echo "</div>";-if(isset($_GET['log'])){+if(isset($_GET['log'])) {if (file_exists('/home/pi/BirdNET-Pi/thisrun.txt')) {$config = parse_ini_file('/home/pi/BirdNET-Pi/thisrun.txt');- $logs = $config['BIRDNETLOG_URL'];+ if(empty($config['BIRDNETLOG_URL']) !== true) {+ $logs = $config['BIRDNETLOG_URL'];+ } elseif(empty($config['BIRDNETPI_URL'] !== true)) {+ $logs = $config['BIRDNETPI_URL'].":8080";+ } else {+ $logs = "http://birdnetpi.local:8080";+ }} elseif (file_exists('/home/pi/BirdNET-Pi/firstrun.ini')) {$config = parse_ini_file('/home/pi/BirdNET-Pi/firstrun.ini');- $logs = $config['BIRDNETLOG_URL'];+ if(empty($config['BIRDNETLOG_URL']) !== true){+ $logs = $config['BIRDNETLOG_URL'];+ } elseif(empty($config['BIRDNETPI_URL'] !== true)) {+ $logs = $config['BIRDNETPI_URL'].":8080";+ } else {+ $logs = "http://birdnetpi.local:8080";+ }}header("Location: $logs");-}elseif(isset($_GET['spectrogram'])){+} elseif(isset($_GET['spectrogram'])){header("Location: /spectrogram.php");} else {echo "<iframe src=\"/views.php\" width=\"100%\" height=\"85%\">";diff --git a/homepage/views.php b/homepage/views.phpindex 7d171730..f7b1e0c5 100644--- a/homepage/views.php+++ b/homepage/views.php@@ -11,7 +11,7 @@<button type="submit" name="view" value="Recordings" id="views">Recordings</button></form><form action="index.php" method="GET" id="log">- <button type="submit" name="log" value="log" id="log">View Log</button>+ <button type="submit" name="log" value="log" id="Log">View Log</button></form><form action="index.php" method="GET" id="spectrogram"><button style="float:none;"type="submit" name="spectrogram" value="view" id="spectrogram">Spectrogram</button>@@ -61,10 +61,6 @@ if(isset($_POST['view'])){if($_POST['view'] == "Recordings"){include('play.php');}if($_POST['view'] == "Settings"){include('scripts/config.php');}if($_POST['view'] == "Advanced"){include('scripts/advanced.php');}- if($_POST['view'] == "Log"){- $url = 'http://birdnetpi.local:8080';- header("location: $url;");- }if($_POST['view'] == "Included"){if(isset($_POST['species']) && isset($_POST['add'])){$file = '/home/pi/BirdNET-Pi/include_species_list.txt';diff --git a/scripts/index.html b/scripts/index.htmldeleted file mode 100644index 681b6ce3..00000000--- a/scripts/index.html+++ /dev/null@@ -1,94 +0,0 @@-<meta name="viewport" content="width=device-width, initial-scale=1">-<style>-* {- font-family: 'Arial', 'Gill Sans', 'Gill Sans MT',- ' Calibri', 'Trebuchet MS', 'sans-serif';- box-sizing: border-box;-- box-sizing: border-box;-}--/* Create two unequal columns that floats next to each other */-.column {- float: left;- padding: 10px;-}--.first {- width: calc(50% - 70px);-}--.second {- width: calc(50% - 30px);-}--/* Clear floats after the columns */-.row:after {- content: "";- display: table;- clear: both;-}-body {- background-color: rgb(119, 196, 135);-}--a {- text-decoration: none;- color: white;-}--.block {- display: block;- font-weight: bold;- width:100%;- border: none;- background-color: #04AA6D;- padding: 20px 20px;- color: white;- font-size: medium;- cursor: pointer;- text-align: center;-}- @media screen and (max-width: 1000px) {- .column {- float: none;- width: 100%;- }- }-</style>-<body style="background-color: rgb(119, 196, 135);">- <div class="row">- <div class="column first">- <form action="/scripts/filemanager/filemanager.php" target="_top">- <button type="submit" class="block">File Manager</button>- </form>- <form action="/scripts/adminer.php?sqlite=&username=&db=birds.db" target="_top">- <button type="submit" class="block">Database Maintenance</button>- </form>- <form action="/scripts/config.php">- <button type="submit" class="block">Settings</button>- </form>- <form action="/scripts/system_controls.php">- <button type="submit" class="block">System Controls</button>- </form>- </div>- <div class="column second">-<<<<<<< Updated upstream- <form action="https://birdnetlog.pmcgui.xyz" target="top">-=======- <form action="http://192.168.0.100:8888" target="top">->>>>>>> Stashed changes- <button type="submit" class="block">Web Terminal</button>- </form>- <form action="/scripts/service_controls.php">- <button type="submit" class="block">Manage Services</button>- </form>- <form action="/scripts/include_list.php">- <button type="submit" class="block">Included Species List</button>- </form>- <form action="/scripts/exclude_list.php">- <button type="submit" class="block">Excluded Species List</button>- </form>- </div>- </div>-</body>