22b9615a2d
I was investigating why the top nav hamburger button didn't work on mobile when you were on system info, log, or streamlit page, and discovered the iframes didn't have closing tags! Also note to self: don't run random git commands you find on stackoverflow -- my birds.db was erased :((( (doing a cron backup every day now!)
60 lines
1.9 KiB
PHP
60 lines
1.9 KiB
PHP
<title>BirdNET-Pi</title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<style>
|
|
body::-webkit-scrollbar {
|
|
display:none
|
|
}
|
|
</style>
|
|
<link rel="stylesheet" href="style.css">
|
|
<body>
|
|
<div class="banner">
|
|
<div class="logo">
|
|
<?php if(isset($_GET['logo'])) {
|
|
echo "<a href=\"https://github.com/mcguirepr89/BirdNET-Pi.git\" target=\"_blank\"><img style=\"width:60;height:60;\" src=\"images/bird.png\"></a>";
|
|
} else {
|
|
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('./scripts/thisrun.txt')) {
|
|
$config = parse_ini_file('./scripts/thisrun.txt');
|
|
} elseif (file_exists('./scripts/firstrun.ini')) {
|
|
$config = parse_ini_file('./scripts/firstrun.ini');
|
|
}
|
|
$caddypwd = $config['CADDY_PWD'];
|
|
if (!isset($_SERVER['PHP_AUTH_USER'])) {
|
|
header('WWW-Authenticate: Basic realm="My Realm"');
|
|
header('HTTP/1.0 401 Unauthorized');
|
|
echo 'You cannot listen to the live audio stream';
|
|
exit;
|
|
} else {
|
|
$submittedpwd = $_SERVER['PHP_AUTH_PW'];
|
|
$submitteduser = $_SERVER['PHP_AUTH_USER'];
|
|
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 {
|
|
header('WWW-Authenticate: Basic realm="My Realm"');
|
|
header('HTTP/1.0 401 Unauthorized');
|
|
echo 'You cannot listen to the live audio stream';
|
|
exit;
|
|
}
|
|
}
|
|
} else {
|
|
echo "
|
|
<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>";
|
|
}
|
|
echo "
|
|
<iframe src=\"/views.php\"></iframe>
|
|
</div>";
|