From bd53bce231ab3df599fece294cc98b7ccb4a9196 Mon Sep 17 00:00:00 2001 From: nessi Date: Fri, 13 Feb 2026 09:24:53 +0100 Subject: [PATCH] Add service update notification and version check enhancements Introduced a front-end mechanism to notify users of available service updates and enhanced the service info page to reflect update status dynamically. Removed backend audit log writes for version checks to streamline operations and improve performance. Updated styling to visually highlight update notifications. --- backend/app/api/routes/service_info.py | 13 +---- frontend/src/App.jsx | 7 ++- frontend/src/pages/ServiceInfoPage.jsx | 41 ++++++++++------ frontend/src/state.jsx | 48 ++++++++++++++++++- frontend/src/styles.css | 66 ++++++++++++++++++++++++++ 5 files changed, 146 insertions(+), 29 deletions(-) diff --git a/backend/app/api/routes/service_info.py b/backend/app/api/routes/service_info.py index f33a5b4..e54870d 100644 --- a/backend/app/api/routes/service_info.py +++ b/backend/app/api/routes/service_info.py @@ -11,7 +11,6 @@ from app.core.db import get_db from app.core.deps import get_current_user from app.models.models import ServiceInfoSettings, User from app.schemas.service_info import ServiceInfoCheckResult, ServiceInfoOut -from app.services.audit import write_audit_log from app.services.service_info import ( UPSTREAM_REPO_WEB, fetch_latest_from_upstream, @@ -71,6 +70,7 @@ async def check_service_version( user: User = Depends(get_current_user), db: AsyncSession = Depends(get_db), ) -> ServiceInfoCheckResult: + _ = user row = await _get_or_create_service_settings(db) check_time = utcnow() latest, latest_ref, error = await fetch_latest_from_upstream() @@ -85,17 +85,6 @@ async def check_service_version( row.update_available = False await db.commit() await db.refresh(row) - await write_audit_log( - db, - "service.info.check", - user.id, - { - "latest_version": row.latest_version, - "latest_ref": row.release_check_url, - "update_available": row.update_available, - "last_check_error": row.last_check_error, - }, - ) return ServiceInfoCheckResult( latest_version=row.latest_version, latest_ref=(row.release_check_url or None), diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 2471ca5..d2689a6 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -18,7 +18,7 @@ function Protected({ children }) { } function Layout({ children }) { - const { me, logout, uiMode, setUiMode, alertToasts, dismissAlertToast } = useAuth(); + const { me, logout, uiMode, setUiMode, alertToasts, dismissAlertToast, serviceUpdateAvailable } = useAuth(); const navigate = useNavigate(); const navClass = ({ isActive }) => `nav-btn${isActive ? " active" : ""}`; @@ -62,7 +62,10 @@ function Layout({ children }) { Alerts - + `nav-btn${isActive ? " active" : ""}${serviceUpdateAvailable ? " update-available" : ""}`} + >