feat(notif): add Pushbullet channel tag (#2198)

* feat(notif): add pushbullet channel tag to server notif settings

* feat(notif): suggested changes

* docs(notif): add pushbullet channel tag
This commit is contained in:
Danshil Kokil Mungur
2022-01-20 15:38:24 +04:00
committed by GitHub
parent eb9ca2e86f
commit f9200b7977
6 changed files with 36 additions and 7 deletions

View File

@@ -19,6 +19,7 @@ interface PushbulletPayload {
type: string;
title: string;
body: string;
channel_tag?: string;
}
class PushbulletAgent
@@ -116,11 +117,15 @@ class PushbulletAgent
});
try {
await axios.post(endpoint, notificationPayload, {
headers: {
'Access-Token': settings.options.accessToken,
},
});
await axios.post(
endpoint,
{ ...notificationPayload, channel_tag: settings.options.channelTag },
{
headers: {
'Access-Token': settings.options.accessToken,
},
}
);
} catch (e) {
logger.error('Error sending Pushbullet notification', {
label: 'Notifications',
@@ -188,8 +193,9 @@ class PushbulletAgent
.map(async (user) => {
if (
user.settings?.pushbulletAccessToken &&
user.settings.pushbulletAccessToken !==
settings.options.accessToken
(settings.options.channelTag ||
user.settings.pushbulletAccessToken !==
settings.options.accessToken)
) {
logger.debug('Sending Pushbullet notification', {
label: 'Notifications',

View File

@@ -181,6 +181,7 @@ export interface NotificationAgentTelegram extends NotificationAgentConfig {
export interface NotificationAgentPushbullet extends NotificationAgentConfig {
options: {
accessToken: string;
channelTag?: string;
};
}