Compare commits
No commits in common. "001cf43cd70a063ae17c2b0248ffc96f9afbe4e4" and "950da269583b8dc08a5db43660a1b8ca558f097d" have entirely different histories.
001cf43cd7
...
950da26958
@ -1,5 +1,5 @@
|
|||||||
[tool.bumpversion]
|
[tool.bumpversion]
|
||||||
current_version = "1.2.12"
|
current_version = "1.2.11"
|
||||||
commit = true
|
commit = true
|
||||||
tag = true
|
tag = true
|
||||||
tag_name = "{new_version}"
|
tag_name = "{new_version}"
|
||||||
|
@ -217,27 +217,4 @@ def send_expiry_notifications_route(username: str, password: str) -> Response:
|
|||||||
"""
|
"""
|
||||||
from ktvmanager.account_checker import send_expiry_notifications
|
from ktvmanager.account_checker import send_expiry_notifications
|
||||||
send_expiry_notifications()
|
send_expiry_notifications()
|
||||||
return jsonify({"message": "Expiry notifications sent."})
|
return jsonify({"message": "Expiry notifications sent."})
|
||||||
|
|
||||||
|
|
||||||
@api_blueprint.route("/send-test-notification", methods=["POST"])
|
|
||||||
@requires_basic_auth
|
|
||||||
def send_test_notification_route(username: str, password: str) -> Response:
|
|
||||||
"""Sends a test push notification to the user."""
|
|
||||||
user_id = get_user_id_from_username(username)
|
|
||||||
if not user_id:
|
|
||||||
return jsonify({"message": "User not found"}), 404
|
|
||||||
|
|
||||||
subscriptions = get_push_subscriptions(user_id)
|
|
||||||
if not subscriptions:
|
|
||||||
return jsonify({"message": "No push subscriptions found for this user."}), 404
|
|
||||||
|
|
||||||
message_body = json.dumps({"title": "Test Notification", "body": "This is a test notification."})
|
|
||||||
|
|
||||||
for sub in subscriptions:
|
|
||||||
try:
|
|
||||||
send_notification(json.loads(sub['subscription_json']), message_body)
|
|
||||||
except Exception as e:
|
|
||||||
print(f"Error sending notification to subscription ID {sub.get('id', 'N/A')}: {e}")
|
|
||||||
|
|
||||||
return jsonify({"message": f"Test notification sent to {len(subscriptions)} subscription(s)."})
|
|
Loading…
x
Reference in New Issue
Block a user