Skip to content

Commit

Permalink
feat(pushover): ability to specify device (#2101)
Browse files Browse the repository at this point in the history
  • Loading branch information
picchioni authored Apr 9, 2021
1 parent ea095a3 commit d03aea0
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
17 changes: 10 additions & 7 deletions docs/reference/notification.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,17 @@ Generate token at [pushbullet.com/#settings/account](https://pushbullet.com/#set

Generate token at [pushover.net/apps/build](https://pushover.net/apps/build).

| Environment variable | Description |
|:---:|---|
| `PUSHOVER_EXPIRE` | How many seconds your notification will continue to be retried for (every `PUSHOVER_RETRY` seconds) |
| `PUSHOVER_RETRY` | How often (in seconds) the Pushover servers will send the same notification to the user |
| `PUSHOVER_PRIORITY` | Message priority |
| `PUSHOVER_TOKEN` | API token |
| `PUSHOVER_USER` | Username |
API Documentation: [pushover.net/api](https://pushover.net/api)

| Environment variable | Description | Required
|:---:|---|---|
| `PUSHOVER_EXPIRE` | How many seconds your notification will continue to be retried for (every `PUSHOVER_RETRY` seconds) | false |
| `PUSHOVER_DEVICE` | Devices to send notificaiton to. Blank will send to all registered devices. | false |
| `PUSHOVER_PRIORITY` | Message priority | false |
| `PUSHOVER_RETRY` | How often (in seconds) the Pushover servers will send the same notification to the user | false |
| `PUSHOVER_SOUND` | Message sound |
| `PUSHOVER_TOKEN` | Application API token | true |
| `PUSHOVER_USER` | User key | true |

???+ note
`PUSHOVER_EXPIRE` and `PUSHOVER_RETRY` are only used when `PUSHOVER_PRIORITY="2"`
Expand Down
5 changes: 3 additions & 2 deletions dotenv-example
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,12 @@ PROXY_PROTOCOL=
PROXY_PORT=
PUSHBULLET=
PUSHOVER_EXPIRE=
PUSHOVER_DEVICE=
PUSHOVER_PRIORITY=
PUSHOVER_RETRY=
PUSHOVER_SOUND=
PUSHOVER_TOKEN=
PUSHOVER_USER=
PUSHOVER_PRIORITY=
PUSHOVER_SOUND=
RESTART_TIME=
SCREENSHOT=
SHOW_ONLY_BRANDS=
Expand Down
1 change: 1 addition & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ const notifications = {
sound: envOrString(process.env.PUSHOVER_SOUND, 'pushover'),
token: envOrString(process.env.PUSHOVER_TOKEN),
username: envOrString(process.env.PUSHOVER_USER),
device: envOrString(process.env.PUSHOVER_DEVICE),
},
redis: {
url: envOrString(process.env.REDIS_URL),
Expand Down
2 changes: 2 additions & 0 deletions src/notification/pushover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export function sendPushoverNotification(link: Link, store: Store) {
priority: pushover.priority,
sound: pushover.sound,
title: Print.inStock(link, store),
device: pushover.device,
...(link.screenshot && {file: `./${link.screenshot}`}),
}
: {
Expand All @@ -30,6 +31,7 @@ export function sendPushoverNotification(link: Link, store: Store) {
sound: pushover.sound,
retry: pushover.retry,
title: Print.inStock(link, store),
device: pushover.device,
...(link.screenshot && {file: `./${link.screenshot}`}),
};

Expand Down

0 comments on commit d03aea0

Please sign in to comment.