mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-10 23:42:37 -07:00
Remove PlexPy Pushover API token
* User's own API token is now required
This commit is contained in:
parent
f31c4dcccd
commit
6d5b5e15d5
3 changed files with 29 additions and 34 deletions
|
@ -158,12 +158,7 @@ from plexpy import helpers
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#testSlack').click(function() {
|
$('#pushbullet_apikey, #pushover_apitoken').on('change', function () {
|
||||||
$.get("/test_slack", function(data) { $('#ajaxMsg').html("<i class='fa fa-check'></i>" + data); });
|
|
||||||
$('#ajaxMsg').addClass('success').fadeIn().delay(3000).fadeOut();
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#pushbullet_apikey').on('change', function () {
|
|
||||||
doAjaxCall('set_notification_config', $(this), 'tabs', true);
|
doAjaxCall('set_notification_config', $(this), 'tabs', true);
|
||||||
reloadModal();
|
reloadModal();
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -983,15 +983,11 @@ class PUSHOVER(object):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.enabled = plexpy.CONFIG.PUSHOVER_ENABLED
|
self.enabled = plexpy.CONFIG.PUSHOVER_ENABLED
|
||||||
|
self.application_token = plexpy.CONFIG.PUSHOVER_APITOKEN
|
||||||
self.keys = plexpy.CONFIG.PUSHOVER_KEYS
|
self.keys = plexpy.CONFIG.PUSHOVER_KEYS
|
||||||
self.priority = plexpy.CONFIG.PUSHOVER_PRIORITY
|
self.priority = plexpy.CONFIG.PUSHOVER_PRIORITY
|
||||||
self.sound = plexpy.CONFIG.PUSHOVER_SOUND
|
self.sound = plexpy.CONFIG.PUSHOVER_SOUND
|
||||||
|
|
||||||
if plexpy.CONFIG.PUSHOVER_APITOKEN:
|
|
||||||
self.application_token = plexpy.CONFIG.PUSHOVER_APITOKEN
|
|
||||||
else:
|
|
||||||
self.application_token = "aVny3NZFwZaXC642c831b4wd7KUhQS"
|
|
||||||
|
|
||||||
def conf(self, options):
|
def conf(self, options):
|
||||||
return cherrypy.config['config'].get('Pushover', options)
|
return cherrypy.config['config'].get('Pushover', options)
|
||||||
|
|
||||||
|
@ -1041,25 +1037,35 @@ class PUSHOVER(object):
|
||||||
self.notify('Main Screen Activate', 'Test Message')
|
self.notify('Main Screen Activate', 'Test Message')
|
||||||
|
|
||||||
def get_sounds(self):
|
def get_sounds(self):
|
||||||
http_handler = HTTPSConnection("api.pushover.net")
|
if plexpy.CONFIG.PUSHOVER_APITOKEN:
|
||||||
http_handler.request("GET", "/1/sounds.json?token=" + self.application_token)
|
http_handler = HTTPSConnection("api.pushover.net")
|
||||||
response = http_handler.getresponse()
|
http_handler.request("GET", "/1/sounds.json?token=" + self.application_token)
|
||||||
request_status = response.status
|
response = http_handler.getresponse()
|
||||||
|
request_status = response.status
|
||||||
if request_status == 200:
|
|
||||||
data = json.loads(response.read())
|
if request_status == 200:
|
||||||
sounds = data.get('sounds', {})
|
data = json.loads(response.read())
|
||||||
sounds.update({'': ''})
|
sounds = data.get('sounds', {})
|
||||||
return sounds
|
sounds.update({'': ''})
|
||||||
elif request_status >= 400 and request_status < 500:
|
return sounds
|
||||||
logger.info(u"Unable to retrieve Pushover notification sounds list: %s" % response.reason)
|
elif request_status >= 400 and request_status < 500:
|
||||||
return {'': ''}
|
logger.info(u"Unable to retrieve Pushover notification sounds list: %s" % response.reason)
|
||||||
|
return {'': ''}
|
||||||
|
else:
|
||||||
|
logger.info(u"Unable to retrieve Pushover notification sounds list.")
|
||||||
|
return {'': ''}
|
||||||
|
|
||||||
else:
|
else:
|
||||||
logger.info(u"Unable to retrieve Pushover notification sounds list.")
|
|
||||||
return {'': ''}
|
return {'': ''}
|
||||||
|
|
||||||
def return_config_options(self):
|
def return_config_options(self):
|
||||||
config_option = [{'label': 'Pushover User or Group Key',
|
config_option = [{'label': 'Pushover API Token',
|
||||||
|
'value': plexpy.CONFIG.PUSHOVER_APITOKEN,
|
||||||
|
'name': 'pushover_apitoken',
|
||||||
|
'description': 'Your Pushover API token.',
|
||||||
|
'input_type': 'text'
|
||||||
|
},
|
||||||
|
{'label': 'Pushover User or Group Key',
|
||||||
'value': self.keys,
|
'value': self.keys,
|
||||||
'name': 'pushover_keys',
|
'name': 'pushover_keys',
|
||||||
'description': 'Your Pushover user or group key.',
|
'description': 'Your Pushover user or group key.',
|
||||||
|
@ -1078,12 +1084,6 @@ class PUSHOVER(object):
|
||||||
'description': 'Set the notification sound. Leave blank for the default sound.',
|
'description': 'Set the notification sound. Leave blank for the default sound.',
|
||||||
'input_type': 'select',
|
'input_type': 'select',
|
||||||
'select_options': self.get_sounds()
|
'select_options': self.get_sounds()
|
||||||
},
|
|
||||||
{'label': 'Pushover API Token',
|
|
||||||
'value': plexpy.CONFIG.PUSHOVER_APITOKEN,
|
|
||||||
'name': 'pushover_apitoken',
|
|
||||||
'description': 'Your Pushover API token. Leave blank to use PlexPy default.',
|
|
||||||
'input_type': 'text'
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -554,8 +554,8 @@ class WebInterface(object):
|
||||||
|
|
||||||
# Get new server URLs for SSL communications.
|
# Get new server URLs for SSL communications.
|
||||||
plextv.get_real_pms_url()
|
plextv.get_real_pms_url()
|
||||||
|
|
||||||
# Get new server friendly name
|
# Get new server friendly name
|
||||||
pmsconnect.get_server_friendly_name()
|
pmsconnect.get_server_friendly_name()
|
||||||
|
|
||||||
# Reconfigure scheduler if intervals changed
|
# Reconfigure scheduler if intervals changed
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue