-
Notifications
You must be signed in to change notification settings - Fork 135
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 #278 from rigrassm/master
Add pushbullet channels; Add auto-migrate database feature; #218
- Loading branch information
Showing
8 changed files
with
86 additions
and
35 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ [email protected] | |
[email protected] | ||
[email protected] | ||
[email protected] | ||
davidyaha:[email protected] | ||
dburles:[email protected] | ||
[email protected] | ||
[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
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
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,28 +1,53 @@ | ||
Meteor.methods({ | ||
"sendPushbulletNotification": function (settings, title, body) { | ||
var access_token = settings.pushbulletAPI; | ||
var pushbullet_url = 'https://api.pushbullet.com/v2/pushes'; | ||
"sendPushbulletNotification": function(settings, title, body) { | ||
|
||
try { | ||
HTTP.post( | ||
pushbullet_url, | ||
{ | ||
headers: { | ||
'Access-Token': access_token | ||
}, | ||
params: { | ||
type: 'note', | ||
title: title, | ||
body: body | ||
}, | ||
timeout: 4000 | ||
} | ||
); | ||
return true; | ||
} catch (error) { | ||
var err = error.response.data.error.message; | ||
logger.error("Pushbullet notification error: " + err); | ||
throw err; | ||
} | ||
//////// Function Constants | ||
|
||
var access_token = settings.pushbulletAPI; | ||
var channel_tag = settings.pushbulletChannel; | ||
var pushbullet_url = 'https://api.pushbullet.com/v2/pushes'; | ||
|
||
//////// Create JSON object of http.post Parameters | ||
if(typeof channel_tag === 'undefined' ) { | ||
var payload = { | ||
headers: { | ||
'Access-Token': access_token | ||
}, | ||
params: { | ||
type: 'note', | ||
title: title, | ||
body: body | ||
}, | ||
timeout: 4000 | ||
}; | ||
logger.debug('Empty Channel'); | ||
} else { | ||
var payload = { | ||
headers: { | ||
'Access-Token': access_token | ||
}, | ||
params: { | ||
type: 'note', | ||
title: title, | ||
body: body, | ||
channel_tag: channel_tag | ||
}, | ||
timeout: 4000 | ||
}; | ||
logger.debug('channel_tag: ' + channel_tag); | ||
} | ||
|
||
////// Attempt to send notification with HTTP.post() | ||
|
||
try { | ||
HTTP.post(pushbullet_url, payload); | ||
return true; | ||
} | ||
|
||
catch (error) { | ||
var err = error.response.data.error.message; | ||
logger.error("Pushbullet notification error: " + err); | ||
throw err; | ||
} | ||
} | ||
}); | ||
}); |
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 +1 @@ | ||
1.6.2 | ||
1.7.0 |