From 0133da401d4ba3689f9ad37900cf6b1ea5b6d05a Mon Sep 17 00:00:00 2001 From: Fmstrat Date: Sun, 21 Mar 2021 14:05:09 -0400 Subject: [PATCH 1/2] feat: added support for pushover sound --- dotenv-example | 1 + src/config.ts | 1 + src/notification/pushover.ts | 2 ++ src/types/pushover-notifications.d.ts | 2 +- 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/dotenv-example b/dotenv-example index aafaacc956..a4895ef9e2 100644 --- a/dotenv-example +++ b/dotenv-example @@ -96,6 +96,7 @@ PUSHOVER_RETRY= PUSHOVER_TOKEN= PUSHOVER_USER= PUSHOVER_PRIORITY= +PUSHOVER_SOUND= RESTART_TIME= SCREENSHOT= SHOW_ONLY_BRANDS= diff --git a/src/config.ts b/src/config.ts index cfa219c177..9a9f9bb1b8 100644 --- a/src/config.ts +++ b/src/config.ts @@ -302,6 +302,7 @@ const notifications = { expire: envOrNumber(process.env.PUSHOVER_EXPIRE), priority: envOrNumber(process.env.PUSHOVER_PRIORITY), retry: envOrNumber(process.env.PUSHOVER_RETRY), + sound: envOrString(process.env.PUSHOVER_SOUND, 'pushover'), token: envOrString(process.env.PUSHOVER_TOKEN), username: envOrString(process.env.PUSHOVER_USER), }, diff --git a/src/notification/pushover.ts b/src/notification/pushover.ts index 467bcbfd92..ffee26d69a 100644 --- a/src/notification/pushover.ts +++ b/src/notification/pushover.ts @@ -19,6 +19,7 @@ export function sendPushoverNotification(link: Link, store: Store) { ? { message: link.cartUrl ? link.cartUrl : link.url, priority: pushover.priority, + sound: pushover.sound, title: Print.inStock(link, store), ...(link.screenshot && {file: `./${link.screenshot}`}), } @@ -26,6 +27,7 @@ export function sendPushoverNotification(link: Link, store: Store) { expire: pushover.expire, message: link.cartUrl ? link.cartUrl : link.url, priority: pushover.priority, + sound: pushover.sound, retry: pushover.retry, title: Print.inStock(link, store), ...(link.screenshot && {file: `./${link.screenshot}`}), diff --git a/src/types/pushover-notifications.d.ts b/src/types/pushover-notifications.d.ts index be55eeb8f8..610afbea8a 100644 --- a/src/types/pushover-notifications.d.ts +++ b/src/types/pushover-notifications.d.ts @@ -43,7 +43,7 @@ declare module 'pushover-notifications' { message: string; priority?: number; retry?: number; - sound?: Sound; + sound?: string; timestamp?: number; title?: string; url?: string; From bd3434b9f8454a50777bca5656db6908359d2f60 Mon Sep 17 00:00:00 2001 From: Fmstrat Date: Sun, 21 Mar 2021 14:10:30 -0400 Subject: [PATCH 2/2] added docs for pushover sound --- docs/reference/notification.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/reference/notification.md b/docs/reference/notification.md index 462dbca1be..f4c17ce5a3 100644 --- a/docs/reference/notification.md +++ b/docs/reference/notification.md @@ -154,6 +154,7 @@ Generate token at [pushover.net/apps/build](https://pushover.net/apps/build). | `PUSHOVER_PRIORITY` | Message priority | | `PUSHOVER_TOKEN` | API token | | `PUSHOVER_USER` | Username | +| `PUSHOVER_SOUND` | Message sound | ???+ note `PUSHOVER_EXPIRE` and `PUSHOVER_RETRY` are only used when `PUSHOVER_PRIORITY="2"`