Skip to content

Commit

Permalink
Upgrade to 5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Minishlink committed Feb 23, 2019
1 parent 6bf7e41 commit ce45557
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
}
],
"require": {
"minishlink/web-push": "^5.0.0"
"minishlink/web-push": "^5.2.0"
}
}
16 changes: 9 additions & 7 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 2 additions & 6 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,16 +208,12 @@ document.addEventListener("DOMContentLoaded", () => {
return;
}

const key = subscription.getKey('p256dh');
const token = subscription.getKey('auth');
const contentEncoding = (PushManager.supportedContentEncodings || ['aesgcm'])[0];

const jsonSubscription = subscription.toJSON();
fetch('send_push_notification.php', {
method: 'POST',
body: JSON.stringify({
endpoint: subscription.endpoint,
publicKey: key ? btoa(String.fromCharCode.apply(null, new Uint8Array(subscription.getKey('p256dh')))) : null,
authToken: token ? btoa(String.fromCharCode.apply(null, new Uint8Array(subscription.getKey('auth')))) : null,
...jsonSubscription,
contentEncoding,
})
})
Expand Down

0 comments on commit ce45557

Please sign in to comment.