.status-div {
display: inline-block;
padding: 20px;
text-align: center;
vertical-align: top;
}
.status-text {
font-size: 15px;
}
td {
padding: 6px;
text-align: center;
}
.align-td {
text-align: center;
}
.green-circle {
padding: 2px 10px;
border-radius: 100%;
background-color: green;
border: 1px solid black;
}
.red-circle {
padding: 2px 10px;
border-radius: 50%;
background-color: red;
border: 1px solid black;
}
Welcome to your SWAG instance
A webserver and reverse proxy solution brought to you by linuxserver.io with php support and a built-in Certbot client.
We have an article on how to use swag here: docs.linuxserver.io
HTML;
}
function GetProxies() {
$output = shell_exec("python3 /dashboard/swag-proxies.py");
$results = json_decode($output);
$status = "";
$index = 0;
foreach($results as $result => $data){
$tr_class = ($index % 2 == 0) ? 'shaded' : '';
$status .= '| '.$result.' | ';
if ($data->status == 1) {
$status .= '';
} else {
$status .= '';
}
$status .= ' | ';
if (!empty($data->locations)) {
$locations = $data->locations;
$location = implode(",", $locations);
$status .= ' | '.$location.' | ';
} else {
$status .= ' | ';
}
$status .= '
';
$index++;
}
return <<
Proxies
Application |
Available |
Proxied |
Location |
{$status}
HTML;
}
function GetF2B() {
$output = exec("python3 /dashboard/swag-f2b.py");
$jails = json_decode($output, true);
$status = "";
$index = 0;
foreach($jails as $jail=>$bans){
$tr_class = ($index % 2 == 0) ? 'shaded' : '';
$status .= '| '.$jail.' | '.$bans.' |
';
$index++;
}
return <<
HTML;
}
$geodb = file_exists('/config/geoip2db/GeoLite2-City.mmdb') ? '--geoip-database=/config/geoip2db/GeoLite2-City.mmdb' : '';
$access = shell_exec("goaccess -a -o html --config-file=/dashboard/goaccess.conf ".$geodb);
$status = GetHeader() . GetProxies() . GetF2B() . '';
echo str_replace("
", $status, $access);
?>