Compare commits

..

No commits in common. "60190750ec67249f057e57543376b7e0b2bd2b32" and "af30d19f06c483863adaa21b5487dfda917d6d46" have entirely different histories.

3 changed files with 7 additions and 13 deletions

View File

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

View File

@ -1 +1 @@
1.2.8
1.2.7

View File

@ -14,7 +14,6 @@ from ktvmanager.lib.auth import requires_basic_auth, check_login
from ktvmanager.lib.checker import validate_account
from typing import Tuple
import json
import re
from pywebpush import webpush, WebPushException
api_blueprint = Blueprint("api", __name__)
@ -147,16 +146,11 @@ def login_route(username: str, password: str) -> Response:
@api_blueprint.route("/vapid-public-key", methods=["GET"])
def vapid_public_key():
"""Provides the VAPID public key in the correct format."""
pem_key = current_app.config["VAPID_PUBLIC_KEY"]
# Use regex to robustly extract the base64 content from the PEM key
match = re.search(r"-----BEGIN PUBLIC KEY-----(.*)-----END PUBLIC KEY-----", pem_key, re.DOTALL)
if not match:
return jsonify({"error": "Could not parse VAPID public key from config"}), 500
# Join the split lines to remove all whitespace and newlines
base64_key = "".join(match.group(1).split())
return jsonify({"public_key": base64_key})
"""Provides the VAPID public key."""
public_key = current_app.config["VAPID_PUBLIC_KEY"]
# Clean up the key by removing headers, footers, and all whitespace
public_key = "".join(public_key.replace("-----BEGIN PUBLIC KEY-----", "").replace("-----END PUBLIC KEY-----", "").split())
return jsonify({"public_key": public_key})
@api_blueprint.route("/save-subscription", methods=["POST"])