mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-02-24 16:58:47 +01:00
Check vapidKey
This commit is contained in:
parent
1c01e1b0f4
commit
04e1d60e54
1 changed files with 21 additions and 17 deletions
|
@ -147,6 +147,7 @@ export async function initSubscription() {
|
||||||
if (subscription && !backendSubscription) {
|
if (subscription && !backendSubscription) {
|
||||||
// check if account's vapidKey is same as subscription's applicationServerKey
|
// check if account's vapidKey is same as subscription's applicationServerKey
|
||||||
const { vapidKey } = getCurrentAccount();
|
const { vapidKey } = getCurrentAccount();
|
||||||
|
if (vapidKey) {
|
||||||
const { applicationServerKey } = subscription.options;
|
const { applicationServerKey } = subscription.options;
|
||||||
const vapidKeyStr = urlBase64ToUint8Array(vapidKey).toString();
|
const vapidKeyStr = urlBase64ToUint8Array(vapidKey).toString();
|
||||||
const applicationServerKeyStr = new Uint8Array(
|
const applicationServerKeyStr = new Uint8Array(
|
||||||
|
@ -166,6 +167,9 @@ export async function initSubscription() {
|
||||||
await subscription.unsubscribe();
|
await subscription.unsubscribe();
|
||||||
throw new Error('Subscription key and vapid key changed');
|
throw new Error('Subscription key and vapid key changed');
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
console.warn('No vapidKey found');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if backend subscription returns 404
|
// Check if backend subscription returns 404
|
||||||
|
|
Loading…
Reference in a new issue