I like this so far

This commit is contained in:
mcguirepr89
2022-02-27 10:06:33 -05:00
parent 579d3b1e26
commit a8b833cd2e
11 changed files with 129 additions and 48 deletions
+24 -2
View File
@@ -3,9 +3,31 @@
<?php
echo "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">";
if(isset($_GET['stream'])){
echo "<h1>BirdNET-Pi</h1><br><audio controls autoplay><source src=\"/stream\"></audio>";
if (file_exists('/home/pi/BirdNET-Pi/thisrun.txt')) {
$config = parse_ini_file('/home/pi/BirdNET-Pi/thisrun.txt');
} elseif (file_exists('/home/pi/BirdNET-Pi/firstrun.ini')) {
$config = parse_ini_file('/home/pi/BirdNET-Pi/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 {
echo "<h1>BirdNET-Pi</h1><br><form action=\"\" method=\"GET\"><button type=\"submit\" name=\"stream\" value=\"play\">Live Audio</button></form>";
$submittedpwd = $_SERVER['PHP_AUTH_PW'];
$submitteduser = $_SERVER['PHP_AUTH_USER'];
if($submittedpwd == $caddypwd && $submitteduser == 'birdnet'){
echo "<h1>BirdNET-Pi</h1><audio controls autoplay><source src=\"/stream\"></audio>";
} 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 "<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'])){
+56 -16
View File
@@ -19,31 +19,31 @@
margin-right: auto;
}
/* Add a black background color to the top navigation */
.topnav {
overflow: hidden;
background-color: rgb(119, 196, 135);
width:100%;
.topbar {
display: block;
width: auto;
margin-left: 10%;
margin-right: 10%;
}
.topnav {
background-color: rgb(119, 196, 135);
display: block;
margin-left: auto;
margin-right: auto;
}
/* Style the links inside the navigation bar */
.topnav button {
float: left;
background-color: transparent;
display: block;
text-align: center;
padding: 14px 16px;
float:left;
}
/* Change the color of links on hover */
.topnav button:hover {
background-color: #ddd;
color: black;
}
/* Add an active class to highlight the current page */
.topnav button.active {
background-color: #04AA6D;
color: white;
@@ -54,8 +54,8 @@
display: none;
}
.topnav form {
float:left;
h3 {
text-align: center;
}
iframe {
@@ -91,10 +91,21 @@ th {
text-align: center;
}
audio {
audio, video{
width: 100%;
}
.spectrogram {
width:33%
}
.centered {
display: block;
width: auto;
margin-left: auto;
margin-right: auto;
}
button {
font-size: large;
background-color: transparent;
@@ -103,17 +114,20 @@ button {
cursor: pointer;
}
.spectrogrambutton, .logbutton, .navbuttons {
.logbutton, .navbuttons {
float: left;
}
.spectrogrambutton {
float:top;
}
body::-webkit-scrollbar {
display:none
}
@media screen and (max-width: 1000px) {
.topnav button {display: none;}
.topnav form {float: none;}
/*.topnav button:not(:first-child) {display: none;}*/
.topnav button.icon {
display: block;
@@ -131,3 +145,29 @@ body::-webkit-scrollbar {
text-align: center;
}
}
@media screen and (max-width: 600px) {
.top.nav button {
font-size: 16px;
}
.topnav button {display: none;}
/*.topnav button:not(:first-child) {display: none;}*/
.topnav button.icon {
display: block;
width: 100%;
margin-left: auto;
margin-right: auto;
}
}
@media screen and (max-width: 600px) {
.topnav button {
font-size: 16px;
}
.topnav.responsive {position: relative;}
.topnav.responsive button {
float: left;
display: block;
text-align: center;
}
}
+33 -9
View File
@@ -1,5 +1,6 @@
<link rel="stylesheet" href="style.css">
<meta name="viewport" content="width=device-width, initial-scale=1">
<div class="topbar">
<div class="topnav" id="myTopnav">
<form action="" method="POST" id="views">
<button type="submit" name="view" value="Overview" id="views">Overview</button>
@@ -13,11 +14,12 @@
<button type="submit" name="log" value="log" id="log">View Log</button>
</form>
<form action="index.php" method="GET" id="spectrogram">
<button type="submit" name="spectrogram" value="view" id="spectrogram">Spectrogram</button>
<button style="float:none;"type="submit" name="spectrogram" value="view" id="spectrogram">Spectrogram</button>
</form>
<button href="javascript:void(0);" class="icon" onclick="myFunction()"><img src="images/menu.png"></button>
</div>
</div>
</body>
<?php
if(isset($_POST['view'])){
if($_POST['view'] == "System"){header('location:phpsysinfo/index.php');}
@@ -27,12 +29,34 @@ if(isset($_POST['view'])){
if($_POST['view'] == "Species Stats"){include('stats.php');}
if($_POST['view'] == "Daily Charts"){include('history.php');}
if($_POST['view'] == "Tools"){
echo "<form action=\"\" method=\"POST\">
<button type=\"submit\" name=\"view\" value=\"Settings\">Settings</button>
<button type=\"submit\" name=\"view\" value=\"System\">System Info</button>
<button type=\"submit\" name=\"view\" value=\"Included\">Custom Species List</button>
<button type=\"submit\" name=\"view\" value=\"Excluded\">Excluded Species List</button>
</form>";
if (file_exists('/home/pi/BirdNET-Pi/thisrun.txt')) {
$config = parse_ini_file('/home/pi/BirdNET-Pi/thisrun.txt');
} elseif (file_exists('/home/pi/BirdNET-Pi/firstrun.ini')) {
$config = parse_ini_file('/home/pi/BirdNET-Pi/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 edit the settings for this installation';
exit;
} else {
$submittedpwd = $_SERVER['PHP_AUTH_PW'];
$submitteduser = $_SERVER['PHP_AUTH_USER'];
if($submittedpwd == $caddypwd && $submitteduser == 'birdnet'){
echo "<form action=\"\" method=\"POST\">
<button type=\"submit\" name=\"view\" value=\"Settings\">Settings</button>
<button type=\"submit\" name=\"view\" value=\"System\">System Info</button>
<button type=\"submit\" name=\"view\" value=\"Included\">Custom Species List</button>
<button type=\"submit\" name=\"view\" value=\"Excluded\">Excluded Species List</button>
</form>";
} else {
header('WWW-Authenticate: Basic realm="My Realm"');
header('HTTP/1.0 401 Unauthorized');
echo 'You cannot edit the settings for this installation';
exit;
}
}
}
if($_POST['view'] == "Recordings"){include('play.php');}
if($_POST['view'] == "Settings"){include('scripts/config.php');}
@@ -106,4 +130,4 @@ function myFunction() {
}
}
</script>
</body>