Add hybrid app version labels
This commit is contained in:
@@ -14,6 +14,7 @@ from media_library_viewer_api.auth import require_jwt_auth, validate_auth_settin
|
||||
from media_library_viewer_api.config import get_settings
|
||||
from media_library_viewer_api.logging_utils import configure_logging, describe_settings
|
||||
from media_library_viewer_api.routers import dashboard, monitoring, media, files, jobs, users, tasks
|
||||
from .version import get_backend_version, get_version_info
|
||||
from media_library_viewer_api.routers.settings import router as settings_router
|
||||
from media_library_viewer_api.dependencies import get_mail_queue, get_monitoring_poller, get_settings_store
|
||||
from media_library_viewer_api.services.known_hosts import ensure_known_hosts_for_machines
|
||||
@@ -46,7 +47,7 @@ async def lifespan(app: FastAPI):
|
||||
|
||||
app = FastAPI(
|
||||
title="Manage API",
|
||||
version="0.1.0",
|
||||
version=get_backend_version(),
|
||||
description="Manage API for Jellyfin media browsing, SSH file inspection, server monitoring, and JWT-protected access.",
|
||||
lifespan=lifespan,
|
||||
)
|
||||
@@ -67,6 +68,8 @@ app.add_middleware(
|
||||
|
||||
@app.middleware("http")
|
||||
async def enforce_jwt_auth(request: Request, call_next):
|
||||
if request.url.path in {"/api/health", "/api/version"}:
|
||||
return await call_next(request)
|
||||
return await require_jwt_auth(request, call_next)
|
||||
|
||||
@app.middleware("http")
|
||||
@@ -109,5 +112,12 @@ def health_check() -> dict[str, str]:
|
||||
return {"status": "ok"}
|
||||
|
||||
|
||||
@app.get("/api/version")
|
||||
def version_info() -> dict[str, str]:
|
||||
"""Expose backend version/build metadata for the UI."""
|
||||
logger.debug("version requested")
|
||||
return get_version_info()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
uvicorn.run(app, host="0.0.0.0", port=8000)
|
||||
uvicorn.run(app, host="0.0.0.0", port=8000)
|
||||
|
||||
Reference in New Issue
Block a user