Compare commits

..

2 Commits

Author SHA1 Message Date
60190750ec Bump version: 1.2.7 → 1.2.8
All checks were successful
Build and Publish Docker Image / build-and-push (push) Successful in 1m40s
2025-07-17 17:19:36 +01:00
19c84fb900 loggin 2025-07-17 17:19:31 +01:00
3 changed files with 13 additions and 7 deletions

View File

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

View File

@ -1 +1 @@
1.2.7 1.2.8

View File

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