1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-12-12 11:02:21 -05:00

Merge pull request #812 from sdbarker/pushbullet-fixes

Updates to Pushbullet functionality to address rejected keys / connections, provide "All Devices" functionality
This commit is contained in:
echel0n 2014-09-19 20:56:10 -07:00
commit 36bf98fcc5
2 changed files with 3 additions and 4 deletions

View File

@ -267,6 +267,7 @@ $(document).ready(function(){
function (data) { function (data) {
var devices = jQuery.parseJSON(data).devices; var devices = jQuery.parseJSON(data).devices;
$("#pushbullet_device_list").html(''); $("#pushbullet_device_list").html('');
$("#pushbullet_device_list").append('<option value="" selected>-- All Devices --</option>')
for (var i = 0; i < devices.length; i++) { for (var i = 0; i < devices.length; i++) {
if(devices[i].active == true) { if(devices[i].active == true) {
if(current_pushbullet_device == devices[i].iden) { if(current_pushbullet_device == devices[i].iden) {

View File

@ -79,13 +79,11 @@ class PushbulletNotifier:
http_handler = HTTPSConnection("api.pushbullet.com") http_handler = HTTPSConnection("api.pushbullet.com")
authString = base64.encodestring('%s:' % (pushbullet_api)).replace('\n', '')
if notificationType == None: if notificationType == None:
testMessage = True testMessage = True
try: try:
logger.log(u"Testing Pushbullet authentication and retrieving the device list.", logger.DEBUG) logger.log(u"Testing Pushbullet authentication and retrieving the device list.", logger.DEBUG)
http_handler.request(method, uri, None, headers={'Authorization': 'Basic %s:' % authString}) http_handler.request(method, uri, None, headers={'Authorization': 'Bearer %s' % pushbullet_api})
except (SSLError, HTTPException, socket.error): except (SSLError, HTTPException, socket.error):
logger.log(u"Pushbullet notification failed.", logger.ERROR) logger.log(u"Pushbullet notification failed.", logger.ERROR)
return False return False
@ -99,7 +97,7 @@ class PushbulletNotifier:
'type': notificationType} 'type': notificationType}
data = json.dumps(data) data = json.dumps(data)
http_handler.request(method, uri, body=data, http_handler.request(method, uri, body=data,
headers={'Content-Type': 'application/json', 'Authorization': 'Basic %s' % authString}) headers={'Content-Type': 'application/json', 'Authorization': 'Bearer %s' % pushbullet_api})
pass pass
except (SSLError, HTTPException, socket.error): except (SSLError, HTTPException, socket.error):
return False return False