From 500b43197c7e46fdcc82176431e52651ef37d05e Mon Sep 17 00:00:00 2001 From: altaf-creator Date: Mon, 29 Dec 2025 20:36:59 +0800 Subject: hmm --- backend/notif.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'backend') diff --git a/backend/notif.py b/backend/notif.py index 00a1b63..09a6e44 100644 --- a/backend/notif.py +++ b/backend/notif.py @@ -27,9 +27,14 @@ CREATE TABLE IF NOT EXISTS subscriptions ( # --- subscribe def subscribe(data: PushSubscriptionData): - cursor.execute(""" - INSERT INTO subscriptions (endpoint, expiration_time, keys_p256dh, keys_auth) - VALUES (?, ?, ?, ?)""", (data.endpoint, data.expirationTime, data.keys["p256dh"], data.keys["auth"])) + if data.expirationTime: + cursor.execute(""" + INSERT INTO subscriptions (endpoint, expiration_time, keys_p256dh, keys_auth) + VALUES (?, ?, ?, ?)""", (data.endpoint, data.expirationTime, data.keys["p256dh"], data.keys["auth"])) + else: + cursor.execute(""" + INSERT INTO subscriptions (endpoint, keys_p256dh, keys_auth) + VALUES (?, ?, ?, ?)""", (data.endpoint, data.keys["p256dh"], data.keys["auth"])) conn.commit() return data.endpoint -- cgit v1.2.3