Skip to content

A live bird collage card for your Home Assistant dashboard.

Show # of commits local repo is behind by, on Sys Controls

ehpersonal385c2aab01e44d
diff --git a/homepage/style.css b/homepage/style.css
index 88ac29ee..f54d98d3 100644
--- a/homepage/style.css
+++ b/homepage/style.css
@@ -687,4 +687,16 @@ dialog::backdrop {
#gain.centered {
margin-bottom:10px;
+}
+
+.updatenumber {
+ margin-left:5px;
+ position:absolute;
+ display:inline-block;
+ background-color:#c8191a;
+ color:white;
+ width:20px;
+ line-height:20px;
+ border-radius:12px;
+ text-align:center;
}
\ No newline at end of file
diff --git a/scripts/system_controls.php b/scripts/system_controls.php
index 35e50727..6abc7144 100644
--- a/scripts/system_controls.php
+++ b/scripts/system_controls.php
@@ -1,3 +1,9 @@
+<?php
+$user = shell_exec("awk -F: '/1000/{print $1}' /etc/passwd");
+$home = shell_exec("awk -F: '/1000/{print $6}' /etc/passwd");
+$home = trim($home);
+$behind = trim(shell_exec("sudo git -C ".$home."/BirdNET-Pi fetch > /dev/null 2>&1 && git -C ".$home."/BirdNET-Pi status | sed -n '2 p' | cut -d ' ' -f 7"));
+?>
<html>
<meta name="viewport" content="width=device-width, initial-scale=1">
<br>
@@ -7,12 +13,12 @@
<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</button>
+ <button type="submit" name="submit" value="update_birdnet.sh" onclick="return confirm('Are you sure you want to update?')">Update <?php if($behind != "0" && $behind != "with"){?><div class="updatenumber"><?php echo $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>
+ </form>
</div>