ac9a0e4cbe
The Config and Advanced setting pages received changes to use the new setSetting() function which looks after creating or updated the setting in the required config files. Optionally it also specification of a command to run after saving the settings. Some variables like models, audio formats and frequency shift tools were also moved into common.php Service Controls page received changes with the replacement of the actual command to execute with a sort of shorthand human friendly version e.g. service <action> <service_name> -- service restart livestream.service These commands map to the original commands in serviceMaintenance() so this could be called through the API without needing the full-blown commend. views.php was updated to accommodate this also System Controls page received a small change to make the process checking for new git updates or getting the last commit hash a single function call. Include and Exclude species updated to use getFilePath() to generate a path to the required file instead of the hard coded path Views.php also received similar treatment with replacing some hard coded paths with generated paths, but logic changes to handle the change in running service commands
45 lines
1.9 KiB
PHP
45 lines
1.9 KiB
PHP
<?php
|
|
if(file_exists('./scripts/common.php')){
|
|
include_once "./scripts/common.php";
|
|
}else{
|
|
include_once "./common.php";
|
|
}
|
|
|
|
$_SESSION['behind'] = getGitStatus();
|
|
?><html>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<br>
|
|
<br>
|
|
<script>
|
|
var seconds = 0;
|
|
function update() {
|
|
if(confirm('Are you sure you want to update?')) {
|
|
setInterval(function(){ seconds += 1; document.getElementById('updatebtn').innerHTML = "Updating: <pre id='timer' class='bash'>"+new Date(seconds * 1000).toISOString().substring(14, 19)+"</span>"; }, 1000);
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
</script>
|
|
<div class="systemcontrols">
|
|
<form action="" method="GET">
|
|
<button type="submit" name="submit" value="sudo reboot" onclick="return confirm('Are you sure you want to reboot?')">Reboot</button>
|
|
</form>
|
|
<form action="" method="GET">
|
|
<button type="submit" name="submit" id="updatebtn" value="update_birdnet.sh" onclick="update();">Update <?php if(isset($_SESSION['behind']) && $_SESSION['behind'] != "0" && $_SESSION['behind'] != "with"){?><div class="updatenumber"><?php echo $_SESSION['behind']; ?></div><?php } ?></button>
|
|
</form>
|
|
<form action="" method="GET">
|
|
<button type="submit" name="submit" value="sudo shutdown now" onclick="return confirm('Are you sure you want to shutdown?')">Shutdown</button>
|
|
</form>
|
|
<form action="" method="GET">
|
|
<button type="submit" name="submit" value="sudo clear_all_data.sh" onclick="return confirm('Clear ALL Data? Note that this cannot be undone and will take up to 90 seconds.')">Clear ALL data</button>
|
|
</form>
|
|
<?php
|
|
$curr_hash = getGitCurrentHash()
|
|
?>
|
|
<p style="font-size:11px;text-align:center"></br></br>Running version: </p>
|
|
<a href="https://github.com/mcguirepr89/BirdNET-Pi/commit/<?php echo $curr_hash; ?>" target="_blank">
|
|
<p style="font-size:11px;text-align:center;box-sizing: border-box"><?php echo $curr_hash; ?></p>
|
|
</a>
|
|
</div>
|