Skip to content

A live bird collage card for your Home Assistant dashboard.

update timer

ehpersonal389ffdc928bfe2
diff --git a/homepage/index.php b/homepage/index.php
index 554b6413..dd7c0aeb 100644
--- a/homepage/index.php
+++ b/homepage/index.php
@@ -5,7 +5,7 @@ body::-webkit-scrollbar {
display:none
}
</style>
-<link rel="stylesheet" href="style.css?v=7.24.22">
+<link rel="stylesheet" href="style.css?v=8.05.22">
<link rel="stylesheet" type="text/css" href="static/dialog-polyfill.css" />
<body>
<div class="banner">
diff --git a/homepage/style.css b/homepage/style.css
index b5edaf2a..90a44443 100644
--- a/homepage/style.css
+++ b/homepage/style.css
@@ -795,6 +795,10 @@ pre.bash {
width: 100%;
display: inline-block;
}
+pre.bash #timer {
+ display:unset;
+ width:unset;
+}
#toolsbtn {
min-width: max-content;
diff --git a/homepage/views.php b/homepage/views.php
index ea153e53..f37426a3 100644
--- a/homepage/views.php
+++ b/homepage/views.php
@@ -21,7 +21,7 @@ if (file_exists('./scripts/thisrun.txt')) {
$config = parse_ini_file('./scripts/firstrun.ini');
}
?>
-<link rel="stylesheet" href="style.css?v=7.24.22">
+<link rel="stylesheet" href="style.css?v=8.05.22">
<style>
body::-webkit-scrollbar {
display:none
diff --git a/scripts/system_controls.php b/scripts/system_controls.php
index 335444cd..77a7791c 100644
--- a/scripts/system_controls.php
+++ b/scripts/system_controls.php
@@ -10,12 +10,23 @@ $_SESSION['behind'] = trim(shell_exec("sudo -u".$user." git -C ".$home."/BirdNET
<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" value="update_birdnet.sh" onclick="return confirm('Are you sure you want to update?')">Update <?php if(isset($_SESSION['behind']) && $_SESSION['behind'] != "0" && $_SESSION['behind'] != "with"){?><div class="updatenumber"><?php echo $_SESSION['behind']; ?></div><?php } ?></button>
+ <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>