Compare commits
	
		
			2 Commits
		
	
	
		
			b446b00fc6
			...
			c9329a33ea
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| c9329a33ea | |||
| b95f00486b | 
| @ -1,5 +1,5 @@ | |||||||
| [tool.bumpversion] | [tool.bumpversion] | ||||||
| current_version = "1.3.26" | current_version = "1.3.27" | ||||||
| commit = true | commit = true | ||||||
| tag = true | tag = true | ||||||
| tag_name = "{new_version}" | tag_name = "{new_version}" | ||||||
|  | |||||||
| @ -74,12 +74,13 @@ | |||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         function subscribeUser(registration) { |         function subscribeUser(registration) { | ||||||
|             let baseUrl = '{{ config.BASE_URL }}'.replace(/\/$/, ""); // Remove trailing slash if present |             fetch('/vapid-public-key') | ||||||
|             if (window.location.protocol === 'https:') { |                 .then(response => { | ||||||
|                 baseUrl = baseUrl.replace(/^http:/, 'https:'); |                     if (!response.ok) { | ||||||
|             } |                         throw new Error('Failed to fetch VAPID public key'); | ||||||
|             fetch(`${baseUrl}/vapid-public-key`) |                     } | ||||||
|                 .then(response => response.json()) |                     return response.json(); | ||||||
|  |                 }) | ||||||
|                 .then(data => { |                 .then(data => { | ||||||
|                     const applicationServerKey = urlB64ToUint8Array(data.public_key); |                     const applicationServerKey = urlB64ToUint8Array(data.public_key); | ||||||
|                     registration.pushManager.subscribe({ |                     registration.pushManager.subscribe({ | ||||||
| @ -92,16 +93,12 @@ | |||||||
|                         console.log('Failed to subscribe the user: ', err); |                         console.log('Failed to subscribe the user: ', err); | ||||||
|                     }); |                     }); | ||||||
|                 }).catch(function(err) { |                 }).catch(function(err) { | ||||||
|                     console.error('Failed to fetch vapid key:', err); |                     console.error('Error during subscription process:', err); | ||||||
|                 }); |                 }); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         function saveSubscription(subscription) { |         function saveSubscription(subscription) { | ||||||
|             let baseUrl = '{{ config.BASE_URL }}'.replace(/\/$/, ""); // Remove trailing slash if present |             fetch('/save-subscription', { | ||||||
|             if (window.location.protocol === 'https:') { |  | ||||||
|                 baseUrl = baseUrl.replace(/^http:/, 'https:'); |  | ||||||
|             } |  | ||||||
|             fetch(`${baseUrl}/save-subscription`, { |  | ||||||
|                 method: 'POST', |                 method: 'POST', | ||||||
|                 headers: { |                 headers: { | ||||||
|                     'Content-Type': 'application/json', |                     'Content-Type': 'application/json', | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user