Merge branch 'BirdNET-pi-main' into New-UI-API
# Resolve Conflicts due to code movement: # homepage/views.php # scripts/config.php # scripts/play.php
This commit is contained in:
+5
-1
@@ -118,6 +118,8 @@ if(isset($_GET['view'])){
|
|||||||
if($_GET['view'] == "Streamlit"){echo "<iframe src=\"/stats\"></iframe>";}
|
if($_GET['view'] == "Streamlit"){echo "<iframe src=\"/stats\"></iframe>";}
|
||||||
if($_GET['view'] == "Daily Charts"){include('history.php');}
|
if($_GET['view'] == "Daily Charts"){include('history.php');}
|
||||||
if($_GET['view'] == "Tools"){
|
if($_GET['view'] == "Tools"){
|
||||||
|
parseConfig();
|
||||||
|
//Authenticate before proceeding
|
||||||
$caddypwd = $config['CADDY_PWD'];
|
$caddypwd = $config['CADDY_PWD'];
|
||||||
if (!isset($_SERVER['PHP_AUTH_USER'])) {
|
if (!isset($_SERVER['PHP_AUTH_USER'])) {
|
||||||
header('WWW-Authenticate: Basic realm="My Realm"');
|
header('WWW-Authenticate: Basic realm="My Realm"');
|
||||||
@@ -210,6 +212,7 @@ if(isset($_GET['view'])){
|
|||||||
}
|
}
|
||||||
if($_GET['view'] == "Webterm"){
|
if($_GET['view'] == "Webterm"){
|
||||||
parseConfig();
|
parseConfig();
|
||||||
|
//Authenticate before proceeding
|
||||||
$caddypwd = $config['CADDY_PWD'];
|
$caddypwd = $config['CADDY_PWD'];
|
||||||
if (!isset($_SERVER['PHP_AUTH_USER'])) {
|
if (!isset($_SERVER['PHP_AUTH_USER'])) {
|
||||||
header('WWW-Authenticate: Basic realm="My Realm"');
|
header('WWW-Authenticate: Basic realm="My Realm"');
|
||||||
@@ -232,6 +235,7 @@ if(isset($_GET['view'])){
|
|||||||
}
|
}
|
||||||
} elseif(isset($_GET['submit'])) {
|
} elseif(isset($_GET['submit'])) {
|
||||||
parseConfig();
|
parseConfig();
|
||||||
|
//Authenticate before proceeding
|
||||||
$caddypwd = $config['CADDY_PWD'];
|
$caddypwd = $config['CADDY_PWD'];
|
||||||
if (!isset($_SERVER['PHP_AUTH_USER'])) {
|
if (!isset($_SERVER['PHP_AUTH_USER'])) {
|
||||||
header('WWW-Authenticate: Basic realm="My Realm"');
|
header('WWW-Authenticate: Basic realm="My Realm"');
|
||||||
@@ -310,7 +314,7 @@ if(isset($_GET['view'])){
|
|||||||
//explode the string by " " space so we can get each individual component of the command
|
//explode the string by " " space so we can get each individual component of the command
|
||||||
//and eventually the service name at the end
|
//and eventually the service name at the end
|
||||||
$separate_command_tmp = explode(" ", trim($indiv_service_command));
|
$separate_command_tmp = explode(" ", trim($indiv_service_command));
|
||||||
//get the service names so we can poll th status
|
//get the service names so we can poll the status
|
||||||
$new_multiservice_status_command .= " " . trim(end($separate_command_tmp));
|
$new_multiservice_status_command .= " " . trim(end($separate_command_tmp));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+24
-19
@@ -3,8 +3,32 @@ if(file_exists('./scripts/common.php')){
|
|||||||
include_once "./scripts/common.php";
|
include_once "./scripts/common.php";
|
||||||
}else{
|
}else{
|
||||||
include_once "./common.php";
|
include_once "./common.php";
|
||||||
|
|
||||||
|
//Parse the ini files to get the current config
|
||||||
|
parseConfig();
|
||||||
|
|
||||||
|
//Authenticate first before allowing further execution
|
||||||
|
$caddypwd = $config['CADDY_PWD'];
|
||||||
|
if (!isset($_SERVER['PHP_AUTH_USER'])) {
|
||||||
|
header('WWW-Authenticate: Basic realm="My Realm"');
|
||||||
|
header('HTTP/1.0 401 Unauthorized');
|
||||||
|
echo '<table><tr><td>You cannot edit the settings for this installation</td></tr></table>';
|
||||||
|
exit;
|
||||||
|
} else {
|
||||||
|
$submittedpwd = $_SERVER['PHP_AUTH_PW'];
|
||||||
|
$submitteduser = $_SERVER['PHP_AUTH_USER'];
|
||||||
|
if($submittedpwd !== $caddypwd || $submitteduser !== 'birdnet'){
|
||||||
|
header('WWW-Authenticate: Basic realm="My Realm"');
|
||||||
|
header('HTTP/1.0 401 Unauthorized');
|
||||||
|
echo '<table><tr><td>You cannot edit the settings for this installation</td></tr></table>';
|
||||||
|
exit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Authenticated
|
||||||
|
//Read in the apprise config
|
||||||
|
$apprise_config = getAppriseConfig();
|
||||||
|
|
||||||
if(isset($_GET['threshold'])) {
|
if(isset($_GET['threshold'])) {
|
||||||
$threshold = $_GET['threshold'];
|
$threshold = $_GET['threshold'];
|
||||||
if (!is_numeric($threshold) || $threshold < 0 || $threshold > 1) {
|
if (!is_numeric($threshold) || $threshold < 0 || $threshold > 1) {
|
||||||
@@ -207,25 +231,6 @@ if(isset($_GET['sendtest']) && $_GET['sendtest'] == "true") {
|
|||||||
<div class="settings">
|
<div class="settings">
|
||||||
<div class="brbanner"><h1>Basic Settings</h1></div><br>
|
<div class="brbanner"><h1>Basic Settings</h1></div><br>
|
||||||
<form id="basicform" action="" method="GET">
|
<form id="basicform" action="" method="GET">
|
||||||
<?php
|
|
||||||
$apprise_config = getAppriseConfig();
|
|
||||||
$caddypwd = $config['CADDY_PWD'];
|
|
||||||
if (!isset($_SERVER['PHP_AUTH_USER'])) {
|
|
||||||
header('WWW-Authenticate: Basic realm="My Realm"');
|
|
||||||
header('HTTP/1.0 401 Unauthorized');
|
|
||||||
echo '<table><tr><td>You cannot edit the settings for this installation</td></tr></table>';
|
|
||||||
exit;
|
|
||||||
} else {
|
|
||||||
$submittedpwd = $_SERVER['PHP_AUTH_PW'];
|
|
||||||
$submitteduser = $_SERVER['PHP_AUTH_USER'];
|
|
||||||
if($submittedpwd !== $caddypwd || $submitteduser !== 'birdnet'){
|
|
||||||
header('WWW-Authenticate: Basic realm="My Realm"');
|
|
||||||
header('HTTP/1.0 401 Unauthorized');
|
|
||||||
echo '<table><tr><td>You cannot edit the settings for this installation</td></tr></table>';
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
|||||||
+27
-5
@@ -64,6 +64,28 @@ $shifted_path = getDirectory('shifted_dir');
|
|||||||
|
|
||||||
if(isset($_GET['shiftfile'])) {
|
if(isset($_GET['shiftfile'])) {
|
||||||
|
|
||||||
|
//Parse the ini files
|
||||||
|
parseConfig();
|
||||||
|
|
||||||
|
//Authenticate before going any further
|
||||||
|
$caddypwd = $config['CADDY_PWD'];
|
||||||
|
if (!isset($_SERVER['PHP_AUTH_USER'])) {
|
||||||
|
header('WWW-Authenticate: Basic realm="My Realm"');
|
||||||
|
header('HTTP/1.0 401 Unauthorized');
|
||||||
|
echo '<table><tr><td>You cannot shift files for this installation</td></tr></table>';
|
||||||
|
exit;
|
||||||
|
} else {
|
||||||
|
$submittedpwd = $_SERVER['PHP_AUTH_PW'];
|
||||||
|
$submitteduser = $_SERVER['PHP_AUTH_USER'];
|
||||||
|
if($submittedpwd !== $caddypwd || $submitteduser !== 'birdnet'){
|
||||||
|
header('WWW-Authenticate: Basic realm="My Realm"');
|
||||||
|
header('HTTP/1.0 401 Unauthorized');
|
||||||
|
echo '<table><tr><td>You cannot shift files for this installation<</td></tr></table>';
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Authenticated
|
||||||
$filename = $_GET['shiftfile'];
|
$filename = $_GET['shiftfile'];
|
||||||
$doShift = null;
|
$doShift = null;
|
||||||
if (isset($_GET['doshift'])) {
|
if (isset($_GET['doshift'])) {
|
||||||
@@ -403,11 +425,11 @@ if(isset($_SESSION['date'])) {
|
|||||||
$result2_data = getSpeciesDetectionInfo($name, null, $confidence);
|
$result2_data = getSpeciesDetectionInfo($name, null, $confidence);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result2_data['success'] == False) {
|
if ($result2_data['success'] == False) {
|
||||||
echo $result2_data['message'];
|
echo $result2_data['message'];
|
||||||
header("refresh: 0;");
|
header("refresh: 0;");
|
||||||
}
|
}
|
||||||
$result2 = $result2_data['data'];
|
$result2 = $result2_data['data'];
|
||||||
|
|
||||||
//Count number of records we have
|
//Count number of records we have
|
||||||
$num_rows = count($result2);
|
$num_rows = count($result2);
|
||||||
|
|||||||
Reference in New Issue
Block a user