From d81e979d354f2fd67d5b946a1696f2e1a5f61eb0 Mon Sep 17 00:00:00 2001 From: quietsy Date: Sat, 15 Jan 2022 13:40:02 +0200 Subject: [PATCH] Add version updates to the dashboard --- root/dashboard/www/index.php | 41 +++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/root/dashboard/www/index.php b/root/dashboard/www/index.php index 1ea0ee1..c99fa1d 100644 --- a/root/dashboard/www/index.php +++ b/root/dashboard/www/index.php @@ -85,7 +85,7 @@ } function GetF2B() { - $output = exec("python3 /dashboard/swag-f2b.py"); + $output = shell_exec("python3 /dashboard/swag-f2b.py"); $jails = json_decode($output, true); $status = ""; $index = 0; @@ -119,6 +119,41 @@ HTML; } + function GetTemplates() { + $tooltip = ""; + $files = ""; + $counter = 1; + $output = shell_exec("/etc/cont-init.d/70-templates"); + foreach(explode(PHP_EOL, $output) as $line) { + if(substr($line, 0, 1) === "*"){ + $tooltip .= str_replace("*", "", $line)." "; + } elseif(substr($line, 0, 1) === "/") { + $tr_class = ($counter % 2 == 0) ? 'shaded' : ''; + $files .= ''.htmlspecialchars($line).''; + $file_name = substr($line, strrpos($line, '/') + 1); + $files .= '📝'; + $counter++; + } + } + if(empty($files)) { + return ""; + } + return << +
+

Version Updates

+ + + {$files} + +
+
+
+
+ + HTML; + } + function GetAnnouncements() { $feed_url = 'https://info.linuxserver.io/index.xml'; $max_entries = 8; @@ -193,9 +228,9 @@ $goaccess = preg_replace("/()/", "", $goaccess); return $goaccess; } - + $goaccess = GetGoaccess(); - $status = GetHeader() . GetProxies() . GetF2B() . GetAnnouncements() . GetLinks() . '
'; + $status = GetHeader() . GetProxies() . GetF2B() . GetTemplates() . GetAnnouncements() . GetLinks() . '
'; $page = str_replace("
", $status, $goaccess); echo $page; ?>