Skip to content

Commit ce45557

Browse files
committed
Upgrade to 5.2
1 parent 6bf7e41 commit ce45557

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
}
1111
],
1212
"require": {
13-
"minishlink/web-push": "^5.0.0"
13+
"minishlink/web-push": "^5.2.0"
1414
}
1515
}

composer.lock

Lines changed: 9 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -208,16 +208,12 @@ document.addEventListener("DOMContentLoaded", () => {
208208
return;
209209
}
210210

211-
const key = subscription.getKey('p256dh');
212-
const token = subscription.getKey('auth');
213211
const contentEncoding = (PushManager.supportedContentEncodings || ['aesgcm'])[0];
214-
212+
const jsonSubscription = subscription.toJSON();
215213
fetch('send_push_notification.php', {
216214
method: 'POST',
217215
body: JSON.stringify({
218-
endpoint: subscription.endpoint,
219-
publicKey: key ? btoa(String.fromCharCode.apply(null, new Uint8Array(subscription.getKey('p256dh')))) : null,
220-
authToken: token ? btoa(String.fromCharCode.apply(null, new Uint8Array(subscription.getKey('auth')))) : null,
216+
...jsonSubscription,
221217
contentEncoding,
222218
})
223219
})

0 commit comments

Comments
 (0)