From 5b7d68945325f58a582d74a080148d7e21251b0f Mon Sep 17 00:00:00 2001 From: derekc Date: Wed, 14 Oct 2026 07:42:06 -0700 Subject: [PATCH] Prefix Ntfy titles with app name and remove startup notification Co-Authored-By: Claude Opus 5.5 --- README.md | 3 +-- backend/app/main.py | 2 -- backend/app/routers/admin.py | 4 ++-- backend/app/routers/auth.py | 4 ++-- backend/app/utils/notify.py | 2 +- 5 files changed, 6 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index e9101e3..bdfdd3d 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Built with FastAPI, vanilla JS, and MySQL — fully containerized with Docker Co - **Admin panel** — list all users, reset passwords, disable/enable accounts, delete users, and impersonate any user for debugging - **JWT auth** — Bearer token auth with impersonation support (admin tokens carry an `admin_id` claim) - **About page** — public explainer on what an infinity bottle is, why to track it, and how to get started -- **Push notifications** — Ntfy alerts for admin logins, new registrations, account changes, and service startup +- **Push notifications** — Ntfy alerts for admin logins, new registrations, and account changes ## Stack @@ -233,7 +233,6 @@ When `NTFY_URL` is set, the following events trigger push notifications: | Event | Priority | |---|---| -| Service startup | Low | | New user registration | Default | | Admin login | High | | User account disabled | Default | diff --git a/backend/app/main.py b/backend/app/main.py index 3ab49c6..9d484dd 100644 --- a/backend/app/main.py +++ b/backend/app/main.py @@ -43,8 +43,6 @@ async def lifespan(app: FastAPI): await init_db() await _seed_admin() logger.info("Bourbonacci started") - from app.utils.notify import notify - await notify("Bourbonacci started", "Service startup complete.", priority="low") yield logger.info("Bourbonacci shutting down") diff --git a/backend/app/routers/admin.py b/backend/app/routers/admin.py index 121e327..905d833 100644 --- a/backend/app/routers/admin.py +++ b/backend/app/routers/admin.py @@ -74,7 +74,7 @@ async def disable_user( user.is_disabled = True await db.commit() - await notify("User disabled", f"Account disabled: {user.email} (by admin {current_admin.email})", priority="default") + await notify("User Disabled", f"Account disabled: {user.email} (by admin {current_admin.email})", priority="default") @router.post("/users/{user_id}/enable", status_code=status.HTTP_204_NO_CONTENT) @@ -108,7 +108,7 @@ async def delete_user( await db.delete(user) await db.commit() - await notify("User deleted", f"Account deleted: {user.email} (by admin {current_admin.email})", priority="default") + await notify("User Deleted", f"Account deleted: {user.email} (by admin {current_admin.email})", priority="default") @router.post("/users/{user_id}/impersonate", response_model=Token) diff --git a/backend/app/routers/auth.py b/backend/app/routers/auth.py index 2f1b1af..705aa9e 100644 --- a/backend/app/routers/auth.py +++ b/backend/app/routers/auth.py @@ -37,7 +37,7 @@ async def register(request: Request, body: UserCreate, db: AsyncSession = Depend await db.refresh(user) logger.info("New user registered: %s", body.email) - await notify("New registration", f"User registered: {body.email}", priority="default") + await notify("New Registration", f"User registered: {body.email}", priority="default") return Token(access_token=create_token(user.id)) @@ -57,5 +57,5 @@ async def login(request: Request, body: LoginRequest, db: AsyncSession = Depends logger.info("Login: %s (id=%s)", body.email, user.id) if user.is_admin: - await notify("Admin login", f"Admin login: {body.email}", priority="high") + await notify("Admin Login", f"Admin login: {body.email}", priority="high") return Token(access_token=create_token(user.id)) diff --git a/backend/app/utils/notify.py b/backend/app/utils/notify.py index 8e38ba6..62c4e22 100644 --- a/backend/app/utils/notify.py +++ b/backend/app/utils/notify.py @@ -9,7 +9,7 @@ logger = logging.getLogger("bourbonacci.notify") async def notify(title: str, message: str, priority: str = "default") -> None: if not settings.ntfy_url: return - headers = {"Title": title, "Priority": priority} + headers = {"Title": f"Bourbonacci Admin - {title}", "Priority": priority} if settings.ntfy_token: headers["Authorization"] = f"Bearer {settings.ntfy_token}" try: