logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe
commit: 7cc3b36f3f8f38c737515d6b941056efe45a6228
parent: d23a03ea39fe35ebc580130fd7b779bfffbfc967
Author: Morgan Bazalgette <the@howl.moe>
Date:   Sat, 31 Mar 2018 19:12:24 +0200

Default when there is no applicationServerKey meta on the page

Diffstat:

Mapp/javascript/mastodon/actions/push_notifications/registerer.js5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/app/javascript/mastodon/actions/push_notifications/registerer.js b/app/javascript/mastodon/actions/push_notifications/registerer.js @@ -19,7 +19,10 @@ const urlBase64ToUint8Array = (base64String) => { return outputArray; }; -const getApplicationServerKey = () => document.querySelector('[name="applicationServerKey"]').getAttribute('content'); +const getApplicationServerKey = () => { + const k = document.querySelector('[name="applicationServerKey"]'); + return k === null ? '' : k.getAttribute('content'); +} const getRegistration = () => navigator.serviceWorker.ready;