Skip to content

Commit

Permalink
feat(gotify): add priority option (#2546)
Browse files Browse the repository at this point in the history
  • Loading branch information
kaysond committed May 18, 2021
1 parent 0378a7c commit 32fe440
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/reference/notification.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ Default provider is Gmail. If you use a different email provider, you must provi

| Environment variable | Description |
|:---:|---|
| `GOTIFY_PRIORITY` | Message Priority |
| `GOTIFY_TOKEN` | Application token |
| `GOTIFY_URL` | Gotify's URL, e.g. `https://push.example.com` |

Expand Down
3 changes: 3 additions & 0 deletions dotenv-example
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ DISCORD_WEB_HOOK=
EMAIL_PASSWORD=
EMAIL_TO=
EMAIL_USERNAME=
GOTIFY_PRIORITY=
GOTIFY_TOKEN=
GOTIFY_URL=
HEADLESS=
IN_STOCK_WAIT_TIME=
INCOGNITO=
Expand Down
1 change: 1 addition & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ const notifications = {
username: envOrString(process.env.EMAIL_USERNAME),
},
gotify: {
priority: envOrNumber(process.env.GOTIFY_PRIORITY),
token: envOrString(process.env.GOTIFY_TOKEN),
url: envOrString(process.env.GOTIFY_URL),
},
Expand Down
1 change: 1 addition & 0 deletions src/messaging/gotify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export function sendGotifyNotification(link: Link, store: Store) {
const params = new URLSearchParams();
params.append('title', Print.inStock(link, store));
params.append('message', Print.productInStock(link));
params.append('priority', gotify.priority.toString());
const response = await fetch(
`${gotify.url}/message?token=${gotify.token}`,
{
Expand Down

0 comments on commit 32fe440

Please sign in to comment.