Prefix Ntfy titles with app name and remove startup notification
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
acfa21ec38
commit
5b7d689453
5 files changed
+6
-9
No files matched your search
@@ -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")
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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))
|
||||
@@ -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:
|
||||
|
||||
Reference in new issue
Block a user