Compare commits

..

No commits in common. "87753785d4c2db574f5d124d4836b546d3819370" and "51138c9d505b920f42dfcad85dc216a7f2f714c7" have entirely different histories.

3 changed files with 4 additions and 17 deletions

View File

@ -1,5 +1,5 @@
[tool.bumpversion]
current_version = "1.2.14"
current_version = "1.2.13"
commit = true
tag = true
tag_name = "{new_version}"

View File

@ -1 +1 @@
1.2.14
1.2.13

View File

@ -227,29 +227,16 @@ def send_test_notification_route(username: str, password: str) -> Response:
data = request.get_json()
message = data.get("message", "Ktv Test") if data else "Ktv Test"
try:
subscriptions = get_push_subscriptions() # Get all subscriptions
except Exception as e:
print(f"Error getting push subscriptions: {e}")
return jsonify({"error": "Could not retrieve push subscriptions from the database."}), 500
subscriptions = get_push_subscriptions() # Get all subscriptions
if not subscriptions:
return jsonify({"message": "No push subscriptions found."}), 404
message_body = json.dumps({"title": "KTVManager", "body": message})
success_count = 0
failure_count = 0
for sub in subscriptions:
try:
send_notification(json.loads(sub['subscription_json']), message_body)
success_count += 1
except Exception as e:
print(f"Error sending notification to subscription ID {sub.get('id', 'N/A')}: {e}")
failure_count += 1
return jsonify({
"message": f"Test notification sending process completed.",
"sent": success_count,
"failed": failure_count
})
return jsonify({"message": f"Test notification sent to {len(subscriptions)} subscription(s)."})