add: dev branch + caddy && nginx display properly on dashboard

This commit is contained in:
pika 2025-03-30 15:43:11 +02:00
parent ac3acbd1a0
commit 93b355d6c5
2 changed files with 116 additions and 29 deletions

12
app.py
View file

@ -208,11 +208,11 @@ def index():
# Calculate stats
caddy_servers = len(caddy_proxies)
nginx_servers = len(nginx_proxies)
# Calculate total domains
total_domains = 0
domain_list = []
# Build the domain list for both Caddy and Nginx
for server, domains in caddy_proxies.items():
for domain, target in domains.items():
@ -223,7 +223,7 @@ def index():
"server_type": "caddy"
})
total_domains += 1
for server, domains in nginx_proxies.items():
for domain, target in domains.items():
domain_list.append({
@ -233,17 +233,17 @@ def index():
"server_type": "nginx"
})
total_domains += 1
# Sort domains by name
domain_list.sort(key=lambda x: x["domain"])
# Get the latest update time
last_update = "Never"
if timestamps:
# Find the most recent timestamp
latest_time = max(timestamps.values())
last_update = latest_time
return render_template('dashboard.html',
caddy_count=caddy_servers,
nginx_count=nginx_servers,