Browse Source

Fixing a few bits

pull/1/head
Matthew Raymer 1 year ago
parent
commit
b37acb4736
  1. 3
      src/notificationService.ts
  2. 2
      src/vapidService.ts

3
src/notificationService.ts

@ -43,8 +43,9 @@ export class NotificationService {
const payload = JSON.stringify(message); const payload = JSON.stringify(message);
const encrypted = this.encrypt(subscription.keys.p256dh, subscription.keys.auth, payload); const encrypted = this.encrypt(subscription.keys.p256dh, subscription.keys.auth, payload);
const endpoint = subscription.endpoint;
const vapidHeaders = await this.vapidService.createVapidAuthHeader(); const vapidHeaders = await this.vapidService.createVapidAuthHeader(endpoint, 12 * 60 * 60, 'mailto:example@example.com');
const parsedUrl = new URL(subscription.endpoint); const parsedUrl = new URL(subscription.endpoint);
const options: https.RequestOptions = { const options: https.RequestOptions = {

2
src/vapidService.ts

@ -31,7 +31,7 @@ export class VapidService {
async getVapidKeys(): Promise<VapidKeys> { async getVapidKeys(): Promise<VapidKeys> {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.db.get('SELECT publicKey, privateKey FROM vapid WHERE id = ?', [1], (err, row) => { this.db.get('SELECT publicKey, privateKey FROM vapid WHERE id = ?', [1], (err, row: VapidKeys) => {
if (err) reject(err); if (err) reject(err);
if (row) { if (row) {

Loading…
Cancel
Save