Fix of the notifikationssystem
This commit is contained in:
@@ -40,14 +40,18 @@ try:
|
|||||||
else:
|
else:
|
||||||
vapid = Vapid.from_file(VAPID_PRIVATE_PEM)
|
vapid = Vapid.from_file(VAPID_PRIVATE_PEM)
|
||||||
|
|
||||||
# Extract public key in standard uncompressed point format encoded in URL-safe base64
|
|
||||||
raw_pub = vapid.public_key.public_bytes(
|
raw_pub = vapid.public_key.public_bytes(
|
||||||
serialization.Encoding.X962,
|
serialization.Encoding.X962,
|
||||||
serialization.PublicFormat.UncompressedPoint
|
serialization.PublicFormat.UncompressedPoint
|
||||||
)
|
)
|
||||||
|
|
||||||
VAPID_PUBLIC_KEY = b64urlencode(raw_pub).decode('utf-8')
|
encoded_pub = b64urlencode(raw_pub)
|
||||||
VAPID_PRIVATE_KEY = VAPID_PRIVATE_PEM # pywebpush accepts the file path to the private PEM
|
if isinstance(encoded_pub, bytes):
|
||||||
|
VAPID_PUBLIC_KEY = encoded_pub.decode('utf-8')
|
||||||
|
else:
|
||||||
|
VAPID_PUBLIC_KEY = encoded_pub
|
||||||
|
|
||||||
|
VAPID_PRIVATE_KEY = VAPID_PRIVATE_PEM
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f'Could not load or generate VAPID keys: {e}')
|
logger.error(f'Could not load or generate VAPID keys: {e}')
|
||||||
|
|||||||
Reference in New Issue
Block a user