From 51ff05559a783896c214bc715f5ae81a60bb4cf2 Mon Sep 17 00:00:00 2001 From: laur Date: Thu, 6 Feb 2025 15:38:31 +0100 Subject: [PATCH] test notifiers also without a provided URL --- src/device-login.ts | 6 +++--- src/interfaces/notification-reason.ts | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/device-login.ts b/src/device-login.ts index c72fc4b5..8112312d 100644 --- a/src/device-login.ts +++ b/src/device-login.ts @@ -145,7 +145,8 @@ export class DeviceLogin { pendingRedirects.set(reqId, this.onTestVisit(resolve, reject).bind(this)); }), ), - await this.notify(NotificationReason.TEST, url), + await this.notify(NotificationReason.TEST_WITH_URL, url), + await this.notify(NotificationReason.TEST_WITHOUT_URL), ]); pendingRedirects.delete(reqId); } @@ -175,10 +176,9 @@ export class DeviceLogin { private async notify(reason: NotificationReason, inUrl?: string): Promise { let url: string | undefined; if (inUrl) { + url = inUrl; if (config.webPortalConfig?.localtunnel) { url = await getLocaltunnelUrl(inUrl); - } else { - url = inUrl; } } this.L.info({ reason, url }, 'Dispatching notification'); diff --git a/src/interfaces/notification-reason.ts b/src/interfaces/notification-reason.ts index 99103902..391dcccb 100644 --- a/src/interfaces/notification-reason.ts +++ b/src/interfaces/notification-reason.ts @@ -2,6 +2,7 @@ export enum NotificationReason { LOGIN = 'LOGIN', PURCHASE = 'PURCHASE', CREATE_ACCOUNT = 'CREATE_ACCOUNT', - TEST = 'TEST', + TEST_WITH_URL = 'TEST_WITH_URL', + TEST_WITHOUT_URL = 'TEST_WITHOUT_URL', PURCHASE_ERROR = 'PURCHASE ERROR', }