Prefix Ntfy titles with app name and remove startup notification

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
derekcandClaude Opus 5.5 committed 2026-10-14 07:42:06 -07:00
1 parent acfa21ec38
commit 5b7d689453
5 files changed
+6 -9

No files matched your search

+1 -2
View File
@@ -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 - **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) - **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 - **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 ## Stack
@@ -233,7 +233,6 @@ When `NTFY_URL` is set, the following events trigger push notifications:
| Event | Priority | | Event | Priority |
|---|---| |---|---|
| Service startup | Low |
| New user registration | Default | | New user registration | Default |
| Admin login | High | | Admin login | High |
| User account disabled | Default | | User account disabled | Default |
-2
View File
@@ -43,8 +43,6 @@ async def lifespan(app: FastAPI):
await init_db() await init_db()
await _seed_admin() await _seed_admin()
logger.info("Bourbonacci started") logger.info("Bourbonacci started")
from app.utils.notify import notify
await notify("Bourbonacci started", "Service startup complete.", priority="low")
yield yield
logger.info("Bourbonacci shutting down") logger.info("Bourbonacci shutting down")
+2 -2
View File
@@ -74,7 +74,7 @@ async def disable_user(
user.is_disabled = True user.is_disabled = True
await db.commit() 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) @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.delete(user)
await db.commit() 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) @router.post("/users/{user_id}/impersonate", response_model=Token)
+2 -2
View File
@@ -37,7 +37,7 @@ async def register(request: Request, body: UserCreate, db: AsyncSession = Depend
await db.refresh(user) await db.refresh(user)
logger.info("New user registered: %s", body.email) 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)) 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) logger.info("Login: %s (id=%s)", body.email, user.id)
if user.is_admin: 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)) return Token(access_token=create_token(user.id))
+1 -1
View File
@@ -9,7 +9,7 @@ logger = logging.getLogger("bourbonacci.notify")
async def notify(title: str, message: str, priority: str = "default") -> None: async def notify(title: str, message: str, priority: str = "default") -> None:
if not settings.ntfy_url: if not settings.ntfy_url:
return return
headers = {"Title": title, "Priority": priority} headers = {"Title": f"Bourbonacci Admin - {title}", "Priority": priority}
if settings.ntfy_token: if settings.ntfy_token:
headers["Authorization"] = f"Bearer {settings.ntfy_token}" headers["Authorization"] = f"Bearer {settings.ntfy_token}"
try: try: