From 8d00c24ac1eb8dd50f9ea286f784117e0747380c Mon Sep 17 00:00:00 2001 From: quietsy Date: Thu, 13 Jan 2022 00:06:52 +0200 Subject: [PATCH] Fix a fast_cgi bug --- README.md | 1 + root/dashboard/swag-status.py | 4 ++-- root/dashboard/www/index.php | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a3403de..5e12b90 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ If adding multiple mods, enter them in an array separated by |, such as DOCKER_M # Usage Navigate to `dashboard.domain.com` from your LAN to view the dashboard + Note: The application discovery works best when the container names match the `proxy-conf` files # Example diff --git a/root/dashboard/swag-status.py b/root/dashboard/swag-status.py index 430d06f..b25dff2 100644 --- a/root/dashboard/swag-status.py +++ b/root/dashboard/swag-status.py @@ -16,7 +16,7 @@ def find_apps(): continue file = open(file_path, "r") content = file.read() - results = re.finditer(r"(\s+)set \$upstream_app (?P\S+?);(\s+)set \$upstream_port (?P\d+);\n(\s+)set \$upstream_proto (?P\w+);", content) + results = re.finditer(r"(\s+)set \$upstream_app (?P\S+?);.*\n(\s+)set \$upstream_port (?P\d+);.*\n(\s+)set \$upstream_proto (?P\w+);.*", content) for result in results: params = result.groupdict() app = f"{params['proto']}://{params['name']}:{params['port']}" @@ -46,4 +46,4 @@ with concurrent.futures.ThreadPoolExecutor(max_workers=100) as executor: discovered_apps[app]["status"] = future.result() discovered_apps[app]["locations"] = list(apps[app]) -print(json.dumps(discovered_apps, sort_keys=True)) \ No newline at end of file +print(json.dumps(discovered_apps, sort_keys=True)) diff --git a/root/dashboard/www/index.php b/root/dashboard/www/index.php index 45a141f..5d7c30c 100644 --- a/root/dashboard/www/index.php +++ b/root/dashboard/www/index.php @@ -81,7 +81,8 @@
HTML; } - $access = shell_exec("cat /config/log/nginx/access.log | goaccess -a -o html --html-prefs='{\"theme\":\"darkGray\"}' --log-format COMBINED --geoip-database=/config/geoip2db/GeoLite2-City.mmdb -"); + $geodb = file_exists('/config/geoip2db/GeoLite2-City.mmdb') ? '--geoip-database=/config/geoip2db/GeoLite2-City.mmdb' : ''; + $access = shell_exec("cat /config/log/nginx/access.log | goaccess -a -o html --html-prefs='{\"theme\":\"darkGray\"}' --log-format COMBINED ".$geodb." -"); $status = GetStatus(); echo str_replace("
", $status, $access); ?>