Self-hosted homelab infrastructure visualizer — interactive network diagram with live status monitoring
TypeScript diagramhomelabhomelab-infrastructure-observabilitynetworkproxmox-veself-hostedzigbeezwavezwave-js
fix: thread-safe signature loading, clear missing-file error, restrict CORS methods
Pouzor09b5317a0cae
diff --git a/backend/app/main.py b/backend/app/main.pyindex faa61b7..9767ec6 100644--- a/backend/app/main.py+++ b/backend/app/main.py@@ -30,8 +30,8 @@ app.add_middleware(CORSMiddleware,allow_origins=settings.cors_origins,allow_credentials=True,- allow_methods=["*"],- allow_headers=["*"],+ allow_methods=["GET", "POST", "PUT", "PATCH", "DELETE"],+ allow_headers=["Authorization", "Content-Type"],)app.include_router(auth.router, prefix="/api/v1/auth", tags=["auth"])diff --git a/backend/app/services/fingerprint.py b/backend/app/services/fingerprint.pyindex 8457eae..e6c9700 100644--- a/backend/app/services/fingerprint.py+++ b/backend/app/services/fingerprint.py@@ -1,18 +1,28 @@"""Match nmap scan results against service_signatures.json."""import jsonimport re+import threadingfrom pathlib import Pathfrom typing import Any_SIGNATURES: list[dict[str, Any]] | None = None+_LOCK = threading.Lock()def _load() -> list[dict[str, Any]]:global _SIGNATURESif _SIGNATURES is None:- path = Path(__file__).parent.parent / "data" / "service_signatures.json"- with open(path) as f:- _SIGNATURES = json.load(f)+ with _LOCK:+ if _SIGNATURES is None:+ path = Path(__file__).parent.parent / "data" / "service_signatures.json"+ try:+ with open(path) as f:+ _SIGNATURES = json.load(f)+ except FileNotFoundError as err:+ raise FileNotFoundError(+ f"service_signatures.json not found at {path}. "+ "This file should be bundled with the application."+ ) from errreturn _SIGNATURES