replaced radio buttons with slider
This commit is contained in:
+22
-26
@@ -109,27 +109,16 @@ if(isset($_GET['submit'])) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($_GET["privacy_mode"])) {
|
if(isset($_GET["privacy_threshold"])) {
|
||||||
$privacy_mode = $_GET["privacy_mode"];
|
$privacy_threshold = $_GET["privacy_threshold"];
|
||||||
if(strcmp($config['PRIVACY_MODE'], "1") == 0 ) {
|
if(strcmp($config['PRIVACY_THRESHOLD'], "1") == 0 ) {
|
||||||
$pmode = "on";
|
$pmode = "on";
|
||||||
}elseif(strcmp($config['PRIVACY_MODE'], "") == 0) {
|
}elseif(strcmp($config['PRIVACY_THRESHOLD'], "") == 0) {
|
||||||
$pmode = "off";
|
$pmode = "off";
|
||||||
}
|
}
|
||||||
if(strcmp($privacy_mode,$pmode) !== 0) {
|
if(strcmp($privacy_threshold,$pmode) !== 0) {
|
||||||
$contents = preg_replace("/PRIVACY_MODE=.*/", "PRIVACY_MODE=$privacy_mode", $contents);
|
$contents = preg_replace("/PRIVACY_THRESHOLD=.*/", "PRIVACY_THRESHOLD=$privacy_threshold", $contents);
|
||||||
$contents2 = preg_replace("/PRIVACY_MODE=.*/", "PRIVACY_MODE=$privacy_mode", $contents2);
|
$contents2 = preg_replace("/PRIVACY_THRESHOLD=.*/", "PRIVACY_THRESHOLD=$privacy_threshold", $contents2);
|
||||||
if(strcmp($privacy_mode,"on") == 0) {
|
|
||||||
exec('sudo sed -i \'s/\/usr\/local\/bin\/server.py/\/usr\/local\/bin\/privacy_server.py/g\' ../../BirdNET-Pi/templates/birdnet_server.service');
|
|
||||||
exec('sudo systemctl daemon-reload');
|
|
||||||
exec('restart_services.sh');
|
|
||||||
header('Location: /log');
|
|
||||||
} elseif(strcmp($privacy_mode,"off") == 0) {
|
|
||||||
exec('sudo sed -i \'s/\/usr\/local\/bin\/privacy_server.py/\/usr\/local\/bin\/server.py/g\' ../../BirdNET-Pi/templates/birdnet_server.service');
|
|
||||||
exec('sudo systemctl daemon-reload');
|
|
||||||
exec('restart_services.sh');
|
|
||||||
header('Location: /log');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,14 +183,21 @@ if (file_exists('./scripts/thisrun.txt')) {
|
|||||||
?>
|
?>
|
||||||
<h2>Advanced Settings</h2>
|
<h2>Advanced Settings</h2>
|
||||||
<form action="" method="GET">
|
<form action="" method="GET">
|
||||||
<label>Privacy Mode: </label>
|
<label>Privacy Threshold: </label><br>
|
||||||
<label for="on">
|
<div class="slidecontainer">
|
||||||
<input name="privacy_mode" type="radio" id="on" value="on" <?php if (strcmp($newconfig['PRIVACY_MODE'], "1") == 0) { echo "checked"; }?>>On</label>
|
<input type="range" min="0" max="25" value="0" class="slider" id="myRange">
|
||||||
<label for="off">
|
<p>Value: <span id="demo"></span>%</p>
|
||||||
<input name="privacy_mode" type="radio" id="off" value="off" <?php if (strcmp($newconfig['PRIVACY_MODE'], "") == 0) { echo "checked"; }?>>Off</label>
|
</div>
|
||||||
<p>Privacy mode can be set to 'on' or 'off' to configure analysis to be more sensitive to human detections. Privacy mode 'on' will purge any data that receives even a low Human confidence score.
|
<script>
|
||||||
Please note that changing this setting restarts services and replaces the running server. It will take about 90, so please be patient!</p>
|
var slider = document.getElementById("myRange");
|
||||||
|
var output = document.getElementById("demo");
|
||||||
|
output.innerHTML = slider.value; // Display the default slider value
|
||||||
|
|
||||||
|
// Update the current slider value (each time you drag the slider handle)
|
||||||
|
slider.oninput = function() {
|
||||||
|
output.innerHTML = this.value;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
<label>Full Disk Behavior: </label>
|
<label>Full Disk Behavior: </label>
|
||||||
<label for="purge">
|
<label for="purge">
|
||||||
<input name="full_disk" type="radio" id="purge" value="purge" <?php if (strcmp($newconfig['FULL_DISK'], "purge") == 0) { echo "checked"; }?>>Purge</label>
|
<input name="full_disk" type="radio" id="purge" value="purge" <?php if (strcmp($newconfig['FULL_DISK'], "purge") == 0) { echo "checked"; }?>>Purge</label>
|
||||||
|
|||||||
Reference in New Issue
Block a user