dashboard.py 893 B

12345678910111213141516171819202122232425262728293031
  1. """Admin dashboard routes."""
  2. from flask import render_template
  3. from services.auth.auth_service import admin_required
  4. from services.squid.ssl_bump_service import get_ssl_bump_status
  5. from .helpers import get_config_manager
  6. def register_routes(bp):
  7. @bp.route("/")
  8. @admin_required
  9. def admin_dashboard():
  10. cm = get_config_manager()
  11. acls = cm.get_acls()
  12. delay_pools = cm.get_delay_pools()
  13. http_access_rules = cm.get_http_access_rules()
  14. stats = {
  15. "total_acls": len(acls),
  16. "total_delay_pools": len(delay_pools),
  17. "total_http_rules": len(http_access_rules),
  18. }
  19. status = cm.get_status()
  20. ssl_bump = get_ssl_bump_status(cm)
  21. return render_template(
  22. "admin/dashboardAdmin.html",
  23. stats=stats,
  24. status=status,
  25. ssl_bump=ssl_bump,
  26. )