From 3c0e196c11bc98060ec5934e99e7dbd591b5da4d Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Sat, 23 Dec 2023 19:42:45 -0700 Subject: [PATCH] add ability to send back a chosen title & message --- app.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app.py b/app.py index 7af369c..815e0a8 100644 --- a/app.py +++ b/app.py @@ -450,10 +450,18 @@ class WebPushService(): "auth": subscription.auth } } + + title = "Test Notification" + if "title" in content: + title = content['title'] + message = "This is a test notification." + if "message" in content: + message = content['message'] + vapid_key = VAPIDKey.query.filter_by(id=subscription.vapid_key_id).first() result = WebPushService._send_push_notification( subscription_info, - {"title": "Test Notification", "message": "This is a test notification"}, + {"title": title, "message": message}, vapid_key ) return jsonify(