Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 20 additions & 27 deletions root/dashboard/www/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ function GetHeader() {
td {
padding-right: 20px;
}
h1 {
text-transform: none;
}
.far, .fas {
font-family: "Font Awesome 5 Free" !important;
}
Expand Down Expand Up @@ -89,7 +92,7 @@ function GetProxies() {
$index++;
}
return <<<HTML
<div class="wrap-panel status-div">
<article class="wrap-panel status-div">
<div id="proxiesTable">
<script>
$.ajax({
Expand All @@ -116,10 +119,8 @@ function GetProxies() {
{$status}
</tbody>
</table>
<br/>
</div>
<br/>
</div>
</article>
HTML;
}

Expand All @@ -137,7 +138,7 @@ function GetF2B() {
$index++;
}
return <<<HTML
<div class="wrap-panel status-div">
<article class="wrap-panel status-div">
<div>
<h2>Fail2Ban</h2>
<table class="table-hover">
Expand All @@ -152,10 +153,8 @@ function GetF2B() {
{$status}
</tbody>
</table>
<br/>
</div>
<br/>
</div>
</article>
HTML;
}

Expand Down Expand Up @@ -202,7 +201,7 @@ function GetTemplates() {
return "";
}
return <<<HTML
<div class="wrap-panel status-div">
<article class="wrap-panel status-div">
<div>
<h2>Version Updates <i class="fas fa-info-circle" title="{$tooltip}"></i></h2>
<table class="table-hover">
Expand All @@ -218,10 +217,8 @@ function GetTemplates() {
{$files}
</tbody>
</table>
<br/>
</div>
<br/>
</div>
</article>
HTML;
}

Expand All @@ -243,24 +240,22 @@ function GetAnnouncements() {
$counter++;
}
return <<<HTML
<div class="wrap-panel status-div">
<article class="wrap-panel status-div">
<div>
<h2>Announcements</h2>
<table class="table-hover">
<tbody class="tbody-data">
{$output}
</tbody>
</table>
<br/>
</div>
<br/>
</div>
</article>
HTML;
}

function GetLinks() {
return <<<HTML
<div class="wrap-panel status-div">
<article class="wrap-panel status-div">
<div>
<h2>Useful Links</h2>
<table class="table-hover">
Expand All @@ -272,10 +267,8 @@ function GetLinks() {
<tr><td class="link-text left-text"><span class="status-text"><a href="https://opencollective.com/linuxserver/donate">Donate</a></span></td></tr>
</tbody>
</table>
<br/>
</div>
<br/>
</div>
</article>
HTML;
}

Expand All @@ -299,9 +292,9 @@ function GetGoaccess() {

$access_log = file_exists("/dashboard/logs") ? "/dashboard/logs/*.log" : "/config/log/nginx/access.log";
$goaccess = shell_exec("cat $access_log | /usr/bin/goaccess -a -o html --config-file=/dashboard/goaccess.conf $geodb $asndb -");
$goaccess = str_replace("<div class='loading-container'>", "<div hidden>", $goaccess);
$goaccess = str_replace("<title>Server&nbsp;Statistics", "<title>SWAG&nbsp;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'>&nbsp;SWAG&nbsp;", $goaccess);
$goaccess = str_replace("<i class='fa fa-tachometer' aria-hidden='true'></i>", "<img src='/icon.svg' width='32' height='32'>&nbsp;SWAG&nbsp;", $goaccess);
$goaccess = preg_replace("/(<link rel='icon' )(.*?)(>)/", "<link rel='icon' type='image/svg+xml' href='/icon.svg'>", $goaccess);
return $goaccess;
}
Expand All @@ -318,7 +311,7 @@ function GetCertificate() {
return <<<HTML
<div class="pull-right status-div">
<h4>
<span class="label label-info" style="display:block">
<span class="label label-info" style="display:block" id="last-updated">
{$ssl}
</span>
</h4>
Expand Down Expand Up @@ -365,10 +358,10 @@ function GetStats() {
echo json_encode($page);
} else {
$goaccess = GetGoaccess();
$status = GetHeader() . GetProxies() . GetF2B() . GetTemplates() . GetAnnouncements() . GetLinks() . "<div class='wrap-general'>";
$page = str_replace("<div class='wrap-general'>", $status, $goaccess);
$ssl = GetCertificate() . "<div class='pull-right hide'>";
$page = str_replace("<div class='pull-right'>", $ssl, $page);
$status = GetHeader() . GetProxies() . GetF2B() . GetTemplates() . GetAnnouncements() . GetLinks() . "<br/><br/><aside id='overall' aria-labelledby='overall-heading'>";
$page = str_replace("<aside id='overall' aria-labelledby='overall-heading'>", $status, $goaccess);
$ssl = GetCertificate() . "<div hidden style='margin-left: auto;'>";
$page = str_replace("<div style='margin-left: auto;'>", $ssl, $page);
echo $page;
}
?>