mirror of
https://github.com/TrezOne/docker-mods-uptime-kuma-timeout-fix.git
synced 2026-07-19 01:46:10 -04:00
Merge pull request #294 from quietsy/swag-dashboard
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 264 KiB After Width: | Height: | Size: 320 KiB |
@@ -22,7 +22,7 @@ Navigate to `dashboard.domain.com` from your LAN to view the dashboard.
|
|||||||
set $upstream_proto http;
|
set $upstream_proto http;
|
||||||
proxy_pass $upstream_proto://$upstream_app:$upstream_port;
|
proxy_pass $upstream_proto://$upstream_app:$upstream_port;
|
||||||
```
|
```
|
||||||
- [Swag Maxmind mod](https://github.com/linuxserver/docker-mods/tree/swag-maxmind) is required to enable the geo location graph
|
- Either [Swag Maxmind mod](https://github.com/linuxserver/docker-mods/tree/swag-maxmind) or [Swag DBIP mod](https://github.com/linuxserver/docker-mods/tree/swag-dbip) are required to enable the geo location graph.
|
||||||
|
|
||||||
# Example
|
# Example
|
||||||

|

|
||||||
|
|||||||
@@ -85,7 +85,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function GetF2B() {
|
function GetF2B() {
|
||||||
$output = exec("python3 /dashboard/swag-f2b.py");
|
$output = shell_exec("python3 /dashboard/swag-f2b.py");
|
||||||
$jails = json_decode($output, true);
|
$jails = json_decode($output, true);
|
||||||
$status = "";
|
$status = "";
|
||||||
$index = 0;
|
$index = 0;
|
||||||
@@ -119,6 +119,41 @@
|
|||||||
HTML;
|
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 .= '<tr class="'.$tr_class.'"><td class="left-text"><span class="status-text">'.htmlspecialchars($line).'</span></td>';
|
||||||
|
$file_name = substr($line, strrpos($line, '/') + 1);
|
||||||
|
$files .= '<td><a href="https://github.com/linuxserver/docker-swag/blob/master/root/defaults/'.$file_name.'">📝</a></td></tr>';
|
||||||
|
$counter++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(empty($files)) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return <<<HTML
|
||||||
|
<div class="wrap-panel status-div">
|
||||||
|
<div title="{$tooltip}">
|
||||||
|
<h2>Version Updates</h2>
|
||||||
|
<table class="table-hover">
|
||||||
|
<tbody class="tbody-data">
|
||||||
|
{$files}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<br/>
|
||||||
|
</div>
|
||||||
|
<br/>
|
||||||
|
</div>
|
||||||
|
HTML;
|
||||||
|
}
|
||||||
|
|
||||||
function GetAnnouncements() {
|
function GetAnnouncements() {
|
||||||
$feed_url = 'https://info.linuxserver.io/index.xml';
|
$feed_url = 'https://info.linuxserver.io/index.xml';
|
||||||
$max_entries = 8;
|
$max_entries = 8;
|
||||||
@@ -173,13 +208,29 @@
|
|||||||
HTML;
|
HTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
$geodb = file_exists('/config/geoip2db/GeoLite2-City.mmdb') ? '--geoip-database=/config/geoip2db/GeoLite2-City.mmdb' : '';
|
function GetGoaccess() {
|
||||||
$goaccess = shell_exec("/usr/local/bin/goaccess -a -o html --config-file=/dashboard/goaccess.conf ".$geodb);
|
$dbip = '/config/geoip2db/dbip-country-lite.mmdb';
|
||||||
$status = GetHeader() . GetProxies() . GetF2B() . GetAnnouncements() . GetLinks() . '<div class="wrap-general">';
|
$maxmind = '/config/geoip2db/GeoLite2-City.mmdb';
|
||||||
|
if (file_exists($dbip) and file_exists($maxmind)):
|
||||||
|
$geodb = (filemtime($dbip) > filemtime($maxmind)) ? '--geoip-database='.$dbip : '--geoip-database='.$maxmind;
|
||||||
|
elseif (file_exists($dbip)):
|
||||||
|
$geodb = '--geoip-database='.$dbip;
|
||||||
|
elseif (file_exists($maxmind)):
|
||||||
|
$geodb = '--geoip-database='.$maxmind;
|
||||||
|
else:
|
||||||
|
$geodb = '';
|
||||||
|
endif;
|
||||||
|
|
||||||
|
$goaccess = shell_exec("/usr/local/bin/goaccess -a -o html --config-file=/dashboard/goaccess.conf ".$geodb);
|
||||||
|
$goaccess = str_replace("<title>Server Statistics", "<title>SWAG Dashboard", $goaccess);
|
||||||
|
$goaccess = str_replace("<h1 class='h-dashboard'>", "<h1>", $goaccess);
|
||||||
|
$goaccess = str_replace("<i class='fa fa-tachometer'></i>", "<img src='/icon.svg' width='32' height='32'> SWAG ", $goaccess);
|
||||||
|
$goaccess = preg_replace("/(<link rel='icon' )(.*?)(>)/", "<link rel='icon' type='image/svg+xml' href='/icon.svg'>", $goaccess);
|
||||||
|
return $goaccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
$goaccess = GetGoaccess();
|
||||||
|
$status = GetHeader() . GetProxies() . GetF2B() . GetTemplates() . GetAnnouncements() . GetLinks() . '<div class="wrap-general">';
|
||||||
$page = str_replace("<div class='wrap-general'>", $status, $goaccess);
|
$page = str_replace("<div class='wrap-general'>", $status, $goaccess);
|
||||||
$page = str_replace("<title>Server Statistics", "<title>SWAG Dashboard", $page);
|
|
||||||
$page = str_replace("<h1 class='h-dashboard'>", "<h1>", $page);
|
|
||||||
$page = str_replace("<i class='fa fa-tachometer'></i>", "<img src='/icon.svg' width='32' height='32'> SWAG ", $page);
|
|
||||||
$page = preg_replace("/(<link rel='icon' )(.*?)(>)/", "<link rel='icon' type='image/svg+xml' href='/icon.svg'>", $page);
|
|
||||||
echo $page;
|
echo $page;
|
||||||
?>
|
?>
|
||||||
|
|||||||
Reference in New Issue
Block a user