|
@ -226,7 +226,8 @@ class WebPushService(): |
|
|
"auth": subscription.auth |
|
|
"auth": subscription.auth |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
WebPushService._send_push_notification(subscription_info, message, vapid_key) |
|
|
result = WebPushService._send_push_notification(subscription_info, message, vapid_key) |
|
|
|
|
|
print(f"Result from sub {subscription.id}: success={result['success']} text={result['message']}", flush=True) |
|
|
print(f"{now} - Finished sending {len(all_subscriptions)} subscriptions.", flush=True) |
|
|
print(f"{now} - Finished sending {len(all_subscriptions)} subscriptions.", flush=True) |
|
|
|
|
|
|
|
|
# Sleeping for 24 hours before sending the next set of notifications |
|
|
# Sleeping for 24 hours before sending the next set of notifications |
|
@ -470,8 +471,11 @@ class WebPushService(): |
|
|
{"title": title, "message": message}, |
|
|
{"title": title, "message": message}, |
|
|
vapid_key |
|
|
vapid_key |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
print(f"Test sent: {result['success']}") |
|
|
return jsonify(success=result["success"], message=result["message"]) |
|
|
return jsonify(success=result["success"], message=result["message"]) |
|
|
else: |
|
|
else: |
|
|
|
|
|
print(f"Test failed due to missing subscription. Request: {json.dumps(content)}") |
|
|
return jsonify({"success": False, "message": "Subscription not found"}), 404 |
|
|
return jsonify({"success": False, "message": "Subscription not found"}), 404 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|