Compare commits

..

No commits in common. "001cf43cd70a063ae17c2b0248ffc96f9afbe4e4" and "950da269583b8dc08a5db43660a1b8ca558f097d" have entirely different histories.

3 changed files with 3 additions and 26 deletions

View File

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

View File

@ -1 +1 @@
1.2.12
1.2.11

View File

@ -218,26 +218,3 @@ def send_expiry_notifications_route(username: str, password: str) -> Response:
from ktvmanager.account_checker import send_expiry_notifications
send_expiry_notifications()
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)."})