Skip to content

Commit 84be9ea

Browse files
authored
Merge pull request #1050 from linuxserver/fix-swag-dashboard
Fix swag dashboard
2 parents c8d0303 + cf225b5 commit 84be9ea

File tree

1 file changed

+20
-27
lines changed

1 file changed

+20
-27
lines changed

root/dashboard/www/index.php

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ function GetHeader() {
2222
td {
2323
padding-right: 20px;
2424
}
25+
h1 {
26+
text-transform: none;
27+
}
2528
.far, .fas {
2629
font-family: "Font Awesome 5 Free" !important;
2730
}
@@ -89,7 +92,7 @@ function GetProxies() {
8992
$index++;
9093
}
9194
return <<<HTML
92-
<div class="wrap-panel status-div">
95+
<article class="wrap-panel status-div">
9396
<div id="proxiesTable">
9497
<script>
9598
$.ajax({
@@ -116,10 +119,8 @@ function GetProxies() {
116119
{$status}
117120
</tbody>
118121
</table>
119-
<br/>
120122
</div>
121-
<br/>
122-
</div>
123+
</article>
123124
HTML;
124125
}
125126

@@ -137,7 +138,7 @@ function GetF2B() {
137138
$index++;
138139
}
139140
return <<<HTML
140-
<div class="wrap-panel status-div">
141+
<article class="wrap-panel status-div">
141142
<div>
142143
<h2>Fail2Ban</h2>
143144
<table class="table-hover">
@@ -152,10 +153,8 @@ function GetF2B() {
152153
{$status}
153154
</tbody>
154155
</table>
155-
<br/>
156156
</div>
157-
<br/>
158-
</div>
157+
</article>
159158
HTML;
160159
}
161160

@@ -202,7 +201,7 @@ function GetTemplates() {
202201
return "";
203202
}
204203
return <<<HTML
205-
<div class="wrap-panel status-div">
204+
<article class="wrap-panel status-div">
206205
<div>
207206
<h2>Version Updates <i class="fas fa-info-circle" title="{$tooltip}"></i></h2>
208207
<table class="table-hover">
@@ -218,10 +217,8 @@ function GetTemplates() {
218217
{$files}
219218
</tbody>
220219
</table>
221-
<br/>
222220
</div>
223-
<br/>
224-
</div>
221+
</article>
225222
HTML;
226223
}
227224

@@ -243,24 +240,22 @@ function GetAnnouncements() {
243240
$counter++;
244241
}
245242
return <<<HTML
246-
<div class="wrap-panel status-div">
243+
<article class="wrap-panel status-div">
247244
<div>
248245
<h2>Announcements</h2>
249246
<table class="table-hover">
250247
<tbody class="tbody-data">
251248
{$output}
252249
</tbody>
253250
</table>
254-
<br/>
255251
</div>
256-
<br/>
257-
</div>
252+
</article>
258253
HTML;
259254
}
260255

261256
function GetLinks() {
262257
return <<<HTML
263-
<div class="wrap-panel status-div">
258+
<article class="wrap-panel status-div">
264259
<div>
265260
<h2>Useful Links</h2>
266261
<table class="table-hover">
@@ -272,10 +267,8 @@ function GetLinks() {
272267
<tr><td class="link-text left-text"><span class="status-text"><a href="https://opencollective.com/linuxserver/donate">Donate</a></span></td></tr>
273268
</tbody>
274269
</table>
275-
<br/>
276270
</div>
277-
<br/>
278-
</div>
271+
</article>
279272
HTML;
280273
}
281274

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

300293
$access_log = file_exists("/dashboard/logs") ? "/dashboard/logs/*.log" : "/config/log/nginx/access.log";
301294
$goaccess = shell_exec("cat $access_log | /usr/bin/goaccess -a -o html --config-file=/dashboard/goaccess.conf $geodb $asndb -");
295+
$goaccess = str_replace("<div class='loading-container'>", "<div hidden>", $goaccess);
302296
$goaccess = str_replace("<title>Server&nbsp;Statistics", "<title>SWAG&nbsp;Dashboard", $goaccess);
303-
$goaccess = str_replace("<h1 class='h-dashboard'>", "<h1>", $goaccess);
304-
$goaccess = str_replace("<i class='fa fa-tachometer'></i>", "<img src='/icon.svg' width='32' height='32'>&nbsp;SWAG&nbsp;", $goaccess);
297+
$goaccess = str_replace("<i class='fa fa-tachometer' aria-hidden='true'></i>", "<img src='/icon.svg' width='32' height='32'>&nbsp;SWAG&nbsp;", $goaccess);
305298
$goaccess = preg_replace("/(<link rel='icon' )(.*?)(>)/", "<link rel='icon' type='image/svg+xml' href='/icon.svg'>", $goaccess);
306299
return $goaccess;
307300
}
@@ -318,7 +311,7 @@ function GetCertificate() {
318311
return <<<HTML
319312
<div class="pull-right status-div">
320313
<h4>
321-
<span class="label label-info" style="display:block">
314+
<span class="label label-info" style="display:block" id="last-updated">
322315
{$ssl}
323316
</span>
324317
</h4>
@@ -365,10 +358,10 @@ function GetStats() {
365358
echo json_encode($page);
366359
} else {
367360
$goaccess = GetGoaccess();
368-
$status = GetHeader() . GetProxies() . GetF2B() . GetTemplates() . GetAnnouncements() . GetLinks() . "<div class='wrap-general'>";
369-
$page = str_replace("<div class='wrap-general'>", $status, $goaccess);
370-
$ssl = GetCertificate() . "<div class='pull-right hide'>";
371-
$page = str_replace("<div class='pull-right'>", $ssl, $page);
361+
$status = GetHeader() . GetProxies() . GetF2B() . GetTemplates() . GetAnnouncements() . GetLinks() . "<br/><br/><aside id='overall' aria-labelledby='overall-heading'>";
362+
$page = str_replace("<aside id='overall' aria-labelledby='overall-heading'>", $status, $goaccess);
363+
$ssl = GetCertificate() . "<div hidden style='margin-left: auto;'>";
364+
$page = str_replace("<div style='margin-left: auto;'>", $ssl, $page);
372365
echo $page;
373366
}
374367
?>

0 commit comments

Comments
 (0)