single URL installation -- 1 custom URL

This commit is contained in:
mcguirepr89
2022-03-14 09:58:19 -04:00
parent 98d7ee2b08
commit 3f5c667fa1
7 changed files with 173 additions and 133 deletions
+6 -21
View File
@@ -9,6 +9,7 @@ echo "<a href=\"https://github.com/mcguirepr89/BirdNET-Pi.git\" target=\"_blank\
echo "<a href=\"https://github.com/mcguirepr89/BirdNET-Pi.git\" target=\"_blank\"><img src=\"images/bird.png\"></a>";
}?>
</div>
<div class="stream">
<?php
if(isset($_GET['stream'])){
if (file_exists('/home/pi/BirdNET-Pi/thisrun.txt')) {
@@ -28,6 +29,7 @@ if(isset($_GET['stream'])){
if($submittedpwd == $caddypwd && $submitteduser == 'birdnet'){
echo "
<audio controls autoplay><source src=\"/stream\"></audio>
</div>
<h1><a href=\"\">BirdNET-Pi</a><img src=\"images/version.svg\"></h1>
</div>";
} else {
@@ -42,34 +44,17 @@ if(isset($_GET['stream'])){
<form action=\"\" method=\"GET\">
<button type=\"submit\" name=\"stream\" value=\"play\">Live Audio</button>
</form>
</div>
<h1><a href=\"\">BirdNET-Pi</a><img src=\"images/version.svg\"></h1>
</div>";
}
if(isset($_GET['log'])) {
if (file_exists('/home/pi/BirdNET-Pi/thisrun.txt')) {
$config = parse_ini_file('/home/pi/BirdNET-Pi/thisrun.txt');
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');
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?logo=smaller");
header("Location: /log");}
} elseif(isset($_GET['spectrogram'])){
header("Location: /spectrogram.php?logo=smaller");
header("Location: /spectrogram.php");
} else {
echo "
echo "
<iframe src=\"/views.php\">
</div>";
}
+1 -8
View File
@@ -153,14 +153,7 @@ if(isset($_POST['view'])){
$submitteduser = $_SERVER['PHP_AUTH_USER'];
if($submittedpwd == $caddypwd && $submitteduser == 'birdnet'){
#ACCESS THE WEB TERMINAL
if(empty($config['BIRDNETLOG_URL']) == false) {
$webterm = $config['WEBTERMINAL_URL'];
} elseif(empty($config['BIRDNETPI_URL'] == false)) {
$webterm = $config['BIRDNETPI_URL'].":8888";
} else {
$webterm = "http://birdnetpi.local:8888";
}
header("Location: $webterm");
header("Location: /terminal");
} else {
header('WWW-Authenticate: Basic realm="My Realm"');
header('HTTP/1.0 401 Unauthorized');