mirror of
https://github.com/home-assistant/core.git
synced 2025-11-27 19:48:01 +00:00
Fixes notify.html5 for notifications on FireFox (#12993)
* Only pass the gcm_key when using Google Cloud Messaging as endpoint. * Test if the gcm_key is only included for GCM endpoints.
This commit is contained in:
committed by
Paulus Schoutsen
parent
19a529e917
commit
2ee73ca911
@@ -404,8 +404,14 @@ class HTML5NotificationService(BaseNotificationService):
|
||||
jwt_token = jwt.encode(jwt_claims, jwt_secret).decode('utf-8')
|
||||
payload[ATTR_DATA][ATTR_JWT] = jwt_token
|
||||
|
||||
# Only pass the gcm key if we're actually using GCM
|
||||
# If we don't, notifications break on FireFox
|
||||
gcm_key = self._gcm_key \
|
||||
if 'googleapis.com' in info[ATTR_SUBSCRIPTION][ATTR_ENDPOINT] \
|
||||
else None
|
||||
response = WebPusher(info[ATTR_SUBSCRIPTION]).send(
|
||||
json.dumps(payload), gcm_key=self._gcm_key, ttl='86400')
|
||||
json.dumps(payload), gcm_key=gcm_key, ttl='86400'
|
||||
)
|
||||
|
||||
# pylint: disable=no-member
|
||||
if response.status_code == 410:
|
||||
|
||||
Reference in New Issue
Block a user