From f010a652f4abcab677af044e254897c9497afa21 Mon Sep 17 00:00:00 2001 From: Giorgio Ravera Date: Tue, 17 Mar 2026 14:15:38 +0100 Subject: [PATCH] Added function to get domain with ssl --- backend/app.py | 2 ++ backend/db/aliases.py | 9 +++++++++ backend/db/hosts.py | 9 +++++++++ 3 files changed, 20 insertions(+) diff --git a/backend/app.py b/backend/app.py index 99b4c4a..b32c37f 100644 --- a/backend/app.py +++ b/backend/app.py @@ -12,6 +12,7 @@ import os # Import Routers from backend.routes.about import router as about_router from backend.routes.backup import router as backup_router +from backend.routes.certificates import router as certificates_router from backend.routes.health import router as health_router from backend.routes.login import router as login_router from backend.routes.hosts import router as hosts_router @@ -200,6 +201,7 @@ def create_app() -> FastAPI: # Routers app.include_router(about_router) app.include_router(backup_router) + app.include_router(certificates_router) app.include_router(health_router) app.include_router(login_router) app.include_router(hosts_router) diff --git a/backend/db/aliases.py b/backend/db/aliases.py index 65cc0b7..967ae67 100644 --- a/backend/db/aliases.py +++ b/backend/db/aliases.py @@ -60,6 +60,15 @@ def get_aliases() -> List[Dict[str, Any]]: rows = [dict(r) for r in cur.fetchall()] return rows +# ----------------------------- +# SELECT ALL ALIASES with SSL Certificate +# ----------------------------- +def get_aliases_certificates() -> List[Dict[str, Any]]: + conn = get_db() + cur = conn.execute("SELECT name FROM aliases WHERE ssl_enabled = 1") + rows = [dict(r) for r in cur.fetchall()] + return rows + # ----------------------------- # SELECT SINGLE ALIAS # ----------------------------- diff --git a/backend/db/hosts.py b/backend/db/hosts.py index 7fd71a4..952f192 100644 --- a/backend/db/hosts.py +++ b/backend/db/hosts.py @@ -93,6 +93,15 @@ def get_hosts() -> List[Dict[str, Any]]: rows.sort(key=ipv4_sort_key) return rows +# ----------------------------- +# SELECT ALL HOSTS with SSL Certificate +# ----------------------------- +def get_hosts_certificates() -> List[Dict[str, Any]]: + conn = get_db() + cur = conn.execute("SELECT name FROM hosts WHERE ssl_enabled = 1") + rows = [dict(r) for r in cur.fetchall()] + return rows + # ----------------------------- # SELECT SINGLE HOST # ----------------------------- -- 2.47.3