1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-08-13 16:53:54 -04:00

- Update Pushbullet notifier to no longer base64 encode the API key which was causing Pushbullet to reject the key and connections

- Update Pushbullet notifier's authorization header to reflect their API
- Update the JS that populates the Pushbullet device list to provide an "All Devices" option
This commit is contained in:
Scott D. Barker 2014-09-17 20:24:27 -07:00
parent c65385da96
commit 50dc83892f
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