add ability to send back a chosen title & message
This commit is contained in:
10
app.py
10
app.py
@@ -450,10 +450,18 @@ class WebPushService():
|
|||||||
"auth": subscription.auth
|
"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()
|
vapid_key = VAPIDKey.query.filter_by(id=subscription.vapid_key_id).first()
|
||||||
result = WebPushService._send_push_notification(
|
result = WebPushService._send_push_notification(
|
||||||
subscription_info,
|
subscription_info,
|
||||||
{"title": "Test Notification", "message": "This is a test notification"},
|
{"title": title, "message": message},
|
||||||
vapid_key
|
vapid_key
|
||||||
)
|
)
|
||||||
return jsonify(
|
return jsonify(
|
||||||
|
|||||||
Reference in New Issue
Block a user