this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Check vapidKey

+21 -17
+21 -17
src/utils/push-notifications.js
··· 147 147 if (subscription && !backendSubscription) { 148 148 // check if account's vapidKey is same as subscription's applicationServerKey 149 149 const { vapidKey } = getCurrentAccount(); 150 - const { applicationServerKey } = subscription.options; 151 - const vapidKeyStr = urlBase64ToUint8Array(vapidKey).toString(); 152 - const applicationServerKeyStr = new Uint8Array( 153 - applicationServerKey, 154 - ).toString(); 155 - const sameKey = vapidKeyStr === applicationServerKeyStr; 156 - if (sameKey) { 157 - // Subscription didn't change 150 + if (vapidKey) { 151 + const { applicationServerKey } = subscription.options; 152 + const vapidKeyStr = urlBase64ToUint8Array(vapidKey).toString(); 153 + const applicationServerKeyStr = new Uint8Array( 154 + applicationServerKey, 155 + ).toString(); 156 + const sameKey = vapidKeyStr === applicationServerKeyStr; 157 + if (sameKey) { 158 + // Subscription didn't change 159 + } else { 160 + // Subscription changed 161 + console.error('🔔 Subscription changed', { 162 + vapidKeyStr, 163 + applicationServerKeyStr, 164 + sameKey, 165 + }); 166 + // Unsubscribe since backend doesn't have a subscription 167 + await subscription.unsubscribe(); 168 + throw new Error('Subscription key and vapid key changed'); 169 + } 158 170 } else { 159 - // Subscription changed 160 - console.error('🔔 Subscription changed', { 161 - vapidKeyStr, 162 - applicationServerKeyStr, 163 - sameKey, 164 - }); 165 - // Unsubscribe since backend doesn't have a subscription 166 - await subscription.unsubscribe(); 167 - throw new Error('Subscription key and vapid key changed'); 171 + console.warn('No vapidKey found'); 168 172 } 169 173 } 170 174