From b37acb473675a79169a1f5862ed8655beb1fe5cf Mon Sep 17 00:00:00 2001 From: Matthew Raymer Date: Sun, 13 Aug 2023 20:34:50 +0800 Subject: [PATCH] Fixing a few bits --- src/notificationService.ts | 3 ++- src/vapidService.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/notificationService.ts b/src/notificationService.ts index 53b9d75..e1d48f9 100644 --- a/src/notificationService.ts +++ b/src/notificationService.ts @@ -43,8 +43,9 @@ export class NotificationService { const payload = JSON.stringify(message); 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 options: https.RequestOptions = { diff --git a/src/vapidService.ts b/src/vapidService.ts index 97b14ad..81a1a24 100644 --- a/src/vapidService.ts +++ b/src/vapidService.ts @@ -31,7 +31,7 @@ export class VapidService { async getVapidKeys(): Promise { 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 (row) {