This commit is contained in:
2026-05-29 00:49:37 +02:00
parent 8fe79c643f
commit 421a1a5ff9
2 changed files with 9 additions and 8 deletions
+6 -5
View File
@@ -35,17 +35,18 @@ async def push_register(request: Request) -> JSONResponse:
if not (isinstance(keys, dict) and body.get("endpoint") and keys.get("p256dh") and keys.get("auth")):
return JSONResponse({"error": "Invalid request"}, status_code=400)
await push.register(
_, created = await push.register(
user_uid=user["uid"],
endpoint=body["endpoint"],
key_auth=keys["auth"],
key_p256dh=keys["p256dh"],
)
try:
await push.notify_user(user["uid"], WELCOME_PAYLOAD)
except Exception as exc:
logger.warning("Welcome push failed for %s: %s", user["uid"], exc)
if created:
try:
await push.notify_user(user["uid"], WELCOME_PAYLOAD)
except Exception as exc:
logger.warning("Welcome push failed for %s: %s", user["uid"], exc)
return JSONResponse({"registered": True})