mirror of
https://github.com/linuxserver/docker-mods.git
synced 2026-01-20 20:33:57 +08:00
Merge pull request #1028 from linuxserver/swag-dashboard-add-asn
Add ASN support
This commit is contained in:
commit
d56841b417
@ -32,6 +32,7 @@ Remove the allow/deny lines in `/config/nginx/proxy-confs/dashboard.subdomain.co
|
||||
proxy_pass $upstream_proto://$upstream_app:$upstream_port;
|
||||
```
|
||||
- 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.
|
||||
- Either Maxmind's or DB-IP's ASN mmdb are required under `/config/geoip2db/asn.mmdb` to enable the ASN graph.
|
||||
- To clear the dashboard stats, you must remove the logs (/config/log/nginx) and **recreate** the container.
|
||||
|
||||
## Dashboard Support
|
||||
|
||||
@ -280,6 +280,7 @@
|
||||
}
|
||||
|
||||
function GetGoaccess() {
|
||||
$geodb = '';
|
||||
$dbip = '/config/geoip2db/dbip-country-lite.mmdb';
|
||||
$maxmind = '/config/geoip2db/GeoLite2-City.mmdb';
|
||||
if (file_exists($dbip) and file_exists($maxmind)):
|
||||
@ -288,12 +289,16 @@
|
||||
$geodb = '--geoip-database='.$dbip;
|
||||
elseif (file_exists($maxmind)):
|
||||
$geodb = '--geoip-database='.$maxmind;
|
||||
else:
|
||||
$geodb = '';
|
||||
endif;
|
||||
|
||||
$asndb = '';
|
||||
$asn = '/config/geoip2db/asn.mmdb';
|
||||
if (file_exists($asn)):
|
||||
$asndb = '--geoip-database='.$asn;
|
||||
endif;
|
||||
|
||||
$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 -");
|
||||
$goaccess = shell_exec("cat $access_log | /usr/bin/goaccess -a -o html --config-file=/dashboard/goaccess.conf $geodb $asndb -");
|
||||
$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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user