-
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from simatec/multiplatform
(simatec) Added Pushover Notification
- Loading branch information
Showing
8 changed files
with
135 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,19 @@ | ||
{ | ||
"common": { | ||
"name": "backitup", | ||
"version": "0.3.9", | ||
"version": "0.4.0", | ||
"news": { | ||
"0.4.0": { | ||
"en": "Added Pushover Notification", | ||
"de": "Pushover-Benachrichtigung hinzugefügt", | ||
"ru": "Добавлено Pushover Уведомление", | ||
"pt": "Adicionado Pushover Notification", | ||
"nl": "Pushover-melding toegevoegd", | ||
"fr": "Notification Pushover ajoutée", | ||
"it": "Aggiunta notifica pushover", | ||
"es": "Notificación Pushover añadida", | ||
"pl": "Dodano powiadomienie pushover" | ||
}, | ||
"0.3.9": { | ||
"en": "Fix cifs/nfs mount and umount", | ||
"de": "Fix cifs/nfs mount und umount", | ||
|
@@ -423,6 +434,11 @@ | |
"telegramInstance": "telegram.0", | ||
"telegramNoticeType": "longTelegramNotice", | ||
"telegramUser": "All Receiver", | ||
"telegramSilentNotice": false, | ||
|
||
"pushoverInstance": "pushover.0", | ||
"pushoverNoticeType": "longPushoverNotice", | ||
"pushoverSilentNotice": false, | ||
|
||
"emailReceiver": "[email protected]", | ||
"emailSender": "[email protected]", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
'use strict'; | ||
const _ = require('../tools')._; | ||
|
||
function command(options, log, callback) { | ||
if (options.pushover.enabled && | ||
options.adapter && | ||
options.pushover.instance !== '' && | ||
options.pushover.instance !== null && | ||
options.pushover.instance !== undefined) { | ||
|
||
// Send pushover Message | ||
if (options.debugging) { | ||
log.debug(`[${options.name}] used pushover-Instance: ${options.pushover.instance}`); | ||
} | ||
|
||
// analyse here the info from options.context.error and options.context.done | ||
console.log(JSON.stringify(options.context.errors)); | ||
console.log(JSON.stringify(options.context.done)); | ||
|
||
let messageText = _('New %e Backup created on %t', options.pushover.systemLang); | ||
messageText = messageText.replace('%t', options.pushover.time).replace('%e', options.name); | ||
if (options.ftp && options.ftp.enabled && options.pushover.NoticeType == 'longPushoverNotice') { | ||
const m = _(', and copied / moved via FTP to %h%d', options.pushover.systemLang); | ||
messageText += m.replace('%h', options.ftp.host).replace('%d', options.ftp.dir); | ||
} | ||
|
||
if (options.cifs && options.cifs.enabled && options.pushover.NoticeType == 'longPushoverNotice') { | ||
const m = _(', and stored under %h%d', options.pushover.systemLang); | ||
messageText += m.replace('%h', options.cifs.mount).replace('%d', options.cifs.dir); | ||
} | ||
|
||
if (options.dropbox && options.dropbox.enabled && options.pushover.NoticeType == 'longPushoverNotice') { | ||
messageText +=_(', and stored in dropbox', options.pushover.systemLang); | ||
} | ||
|
||
messageText += '.'; | ||
if(options.pushover.SilentNotice === 'true' || options.pushover.SilentNotice === true){ | ||
options.adapter.sendTo(options.pushover.instance, 'send', {message: 'BackItUp:\n' + messageText, sound: '', priority: -1, title: 'Backitup'}); | ||
}else{ | ||
options.adapter.sendTo(options.pushover.instance, 'send', {message: 'BackItUp:\n' + messageText, sound: '', title: 'Backitup'}); | ||
} | ||
} | ||
callback(); | ||
} | ||
|
||
module.exports = { | ||
command, | ||
ignoreErrors: true, | ||
afterBackup: true | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "iobroker.backitup", | ||
"version": "0.3.9", | ||
"version": "0.4.0", | ||
"engines": { | ||
"node": ">=6.0.0" | ||
}, | ||
|