Move notification agent instructions to wiki

This commit is contained in:
JonnyWong16 2018-03-18 17:05:30 -07:00
parent ed0b41cd19
commit 9f964b5a87
5 changed files with 60 additions and 65 deletions

View file

@ -55,7 +55,7 @@ DOCUMENTATION :: END
}) })
} }
return deferred; return deferred;
} };
function checkQRAddress(url) { function checkQRAddress(url) {
var parser = document.createElement('a'); var parser = document.createElement('a');
@ -82,7 +82,7 @@ DOCUMENTATION :: END
verifiedDevice = false; verifiedDevice = false;
getPlexPyURL().then(function (url) { getPlexPyURL().then(function (url) {
checkQRAddress(url) checkQRAddress(url);
$.get('generate_api_key', { device: true }).then(function (token) { $.get('generate_api_key', { device: true }).then(function (token) {
$('#api_qr_address').val(url); $('#api_qr_address').val(url);
@ -120,7 +120,7 @@ DOCUMENTATION :: END
$('#api_qr_address').change(function () { $('#api_qr_address').change(function () {
var url = $(this).val(); var url = $(this).val();
checkQRAddress(url) checkQRAddress(url);
$('#api_qr_code').empty().qrcode({ $('#api_qr_code').empty().qrcode({
text: url + '|' + $('#api_qr_token').val() text: url + '|' + $('#api_qr_token').val()

View file

@ -433,16 +433,30 @@
}); });
% if notifier['agent_name'] == 'facebook': % if notifier['agent_name'] == 'facebook':
if (location.protocol !== 'https:') {
$('#tabs-config .form-group:first').prepend(
'<div class="form-group">' +
'<label>Warning</label>' +
'<p class="help-block" style="color: #eb8600;">Facebook requires HTTPS for authorization. ' +
'Please enable HTTPS for Tautulli under <a data-tab-destination="tabs-web_interface" data-dismiss="modal" style="cursor: pointer;">Web Interface</a>.</p>' +
'</div>'
);
$('#facebook_redirect_uri').val('HTTPS not enabled');
} else {
$('#facebook_redirect_uri').val(location.href.split('/settings')[0] + '/facebook_redirect');
}
function disableFacebookRequest() { function disableFacebookRequest() {
if ($('#facebook_app_id').val() !== '' && $('#facebook_app_secret').val() !== '') { $('#facebook_facebookStep1').prop('disabled', false); } if ($('#facebook_app_id').val() !== '' && $('#facebook_app_secret').val() !== '') { $('#facebook_facebook_auth').prop('disabled', false); }
else { $('#facebook_facebookStep1').prop('disabled', true); } else { $('#facebook_facebook_auth').prop('disabled', true); }
} }
disableFacebookRequest(); disableFacebookRequest();
$('#facebook_app_id, #facebook_app_secret').on('change', function () { $('#facebook_app_id, #facebook_app_secret').on('change', function () {
disableFacebookRequest(); disableFacebookRequest();
}); });
$('#facebook_facebookStep1').click(function () { $('#facebook_facebook_auth').click(function () {
// Remove trailing '/' from Facebook redirect URI // Remove trailing '/' from Facebook redirect URI
if ($('#facebook_redirect_uri') && $('#facebook_redirect_uri').val().endsWith('/')) { if ($('#facebook_redirect_uri') && $('#facebook_redirect_uri').val().endsWith('/')) {
$('#facebook_redirect_uri').val($('#facebook_redirect_uri').val().slice(0, -1)); $('#facebook_redirect_uri').val($('#facebook_redirect_uri').val().slice(0, -1));
@ -450,7 +464,7 @@
var facebook_token; var facebook_token;
$.ajax({ $.ajax({
url: 'facebookStep1', url: 'facebook_auth',
data: { data: {
app_id: $('#facebook_app_id').val(), app_id: $('#facebook_app_id').val(),
app_secret: $('#facebook_app_secret').val(), app_secret: $('#facebook_app_secret').val(),

View file

@ -969,6 +969,9 @@
<p class="help-block"> <p class="help-block">
Add a new notification agent, or configure an existing notification agent by clicking the settings icon on the right. Add a new notification agent, or configure an existing notification agent by clicking the settings icon on the right.
</p> </p>
<p class="help-block">
Please see the <a target='_blank' href='${anon_url('https://github.com/%s/%s-Wiki/wiki/Notification-Agents-Guide' % (plexpy.CONFIG.GIT_USER, plexpy.CONFIG.GIT_REPO))}'>Notification Agents Guide</a> for instructions on setting up each notification agent.
</p>
<br /> <br />
<div id="plexpy-notifiers-table"> <div id="plexpy-notifiers-table">
<div class='text-muted'><i class="fa fa-refresh fa-spin"></i> Loading notification agents...</div> <div class='text-muted'><i class="fa fa-refresh fa-spin"></i> Loading notification agents...</div>
@ -983,7 +986,7 @@
<h3>Database Import</h3> <h3>Database Import</h3>
</div> </div>
<p class="help-block">Click a button below to import an exisiting database from another app.</p> <p class="help-block">Click a button below to import an existing database from another app.</p>
<div class="btn-group"> <div class="btn-group">
<button class="btn btn-form toggle-app-import-modal" type="button" data-target="#app-import-modal" data-toggle="modal" data-app="plexwatch">PlexWatch</button> <button class="btn btn-form toggle-app-import-modal" type="button" data-target="#app-import-modal" data-toggle="modal" data-app="plexwatch">PlexWatch</button>
<button class="btn btn-form toggle-app-import-modal" type="button" data-target="#app-import-modal" data-toggle="modal" data-app="plexivity">Plexivity</button> <button class="btn btn-form toggle-app-import-modal" type="button" data-target="#app-import-modal" data-toggle="modal" data-app="plexivity">Plexivity</button>

View file

@ -143,6 +143,10 @@ def available_notification_agents():
'name': 'join', 'name': 'join',
'id': AGENT_IDS['join'] 'id': AGENT_IDS['join']
}, },
{'label': 'Kodi',
'name': 'xbmc',
'id': AGENT_IDS['xbmc']
},
{'label': 'Notify My Android', {'label': 'Notify My Android',
'name': 'nma', 'name': 'nma',
'id': AGENT_IDS['nma'] 'id': AGENT_IDS['nma']
@ -159,10 +163,10 @@ def available_notification_agents():
'name': 'prowl', 'name': 'prowl',
'id': AGENT_IDS['prowl'] 'id': AGENT_IDS['prowl']
}, },
{'label': 'Pushalot', # {'label': 'Pushalot',
'name': 'pushalot', # 'name': 'pushalot',
'id': AGENT_IDS['pushalot'] # 'id': AGENT_IDS['pushalot']
}, # },
{'label': 'Pushbullet', {'label': 'Pushbullet',
'name': 'pushbullet', 'name': 'pushbullet',
'id': AGENT_IDS['pushbullet'] 'id': AGENT_IDS['pushbullet']
@ -187,10 +191,6 @@ def available_notification_agents():
'name': 'twitter', 'name': 'twitter',
'id': AGENT_IDS['twitter'] 'id': AGENT_IDS['twitter']
}, },
{'label': 'XBMC',
'name': 'xbmc',
'id': AGENT_IDS['xbmc']
},
{'label': 'Zapier', {'label': 'Zapier',
'name': 'zapier', 'name': 'zapier',
'id': AGENT_IDS['zapier'] 'id': AGENT_IDS['zapier']
@ -199,7 +199,7 @@ def available_notification_agents():
# OSX Notifications should only be visible if it can be used # OSX Notifications should only be visible if it can be used
if OSX().validate(): if OSX().validate():
agents.append({'label': 'OSX Notify', agents.append({'label': 'macOS Notification Center',
'name': 'osx', 'name': 'osx',
'id': AGENT_IDS['osx'] 'id': AGENT_IDS['osx']
}) })
@ -1441,7 +1441,7 @@ class FACEBOOK(Notifier):
plexpy.CONFIG.FACEBOOK_TOKEN = 'temp' plexpy.CONFIG.FACEBOOK_TOKEN = 'temp'
return facebook.auth_url(app_id=app_id, return facebook.auth_url(app_id=app_id,
canvas_url=redirect_uri + '/facebookStep2', canvas_url=redirect_uri,
perms=['user_managed_groups','publish_actions']) perms=['user_managed_groups','publish_actions'])
def _get_credentials(self, code=''): def _get_credentials(self, code=''):
@ -1455,7 +1455,7 @@ class FACEBOOK(Notifier):
# Request user access token # Request user access token
api = facebook.GraphAPI(version='2.12') api = facebook.GraphAPI(version='2.12')
response = api.get_access_token_from_code(code=code, response = api.get_access_token_from_code(code=code,
redirect_uri=redirect_uri + '/facebookStep2', redirect_uri=redirect_uri,
app_id=app_id, app_id=app_id,
app_secret=app_secret) app_secret=app_secret)
access_token = response['access_token'] access_token = response['access_token']
@ -1519,25 +1519,11 @@ class FACEBOOK(Notifier):
return self._post_facebook(**data) return self._post_facebook(**data)
def return_config_options(self): def return_config_options(self):
config_option = [{'label': 'Instructions', config_option = [{'label': 'OAuth Redirect URI',
'description': 'Step 1: Visit <a href="' + helpers.anon_url('https://developers.facebook.com/apps') + '" target="_blank">'
'Facebook Developers</a> to add a new app using <strong>basic setup</strong>.<br>'
'Step 2: Click <strong>Add Product</strong> on the left, then <strong>Get Started</strong>'
'for <strong>Facebook Login</strong>.<br>'
'Step 3: Fill in <strong>Valid OAuth redirect URIs</strong> with your Tautulli URL (e.g. http://localhost:8181).<br>'
'Step 4: Click <strong>App Review</strong> on the left and toggle "make public" to <strong>Yes</strong>.<br>'
'Step 5: Fill in the <strong>Tautulli URL</strong> below with the exact same URL from Step 3.<br>'
'Step 6: Fill in the <strong>App ID</strong> and <strong>App Secret</strong> below.<br>'
'Step 7: Click the <strong>Request Authorization</strong> button below to retrieve your access token.<br>'
'Step 8: Fill in your <strong>Access Token</strong> below if it is not filled in automatically.<br>'
'Step 9: Fill in your <strong>Group ID</strong> number below. It can be found in the URL of your group page.',
'input_type': 'help'
},
{'label': 'Tautulli URL',
'value': self.config['redirect_uri'], 'value': self.config['redirect_uri'],
'name': 'facebook_redirect_uri', 'name': 'facebook_redirect_uri',
'description': 'Your Tautulli URL. This will tell Facebook where to redirect you after authorization.\ 'description': 'Fill in this address for the "Valid OAuth redirect URIs" '
(e.g. http://localhost:8181)', 'in your Facebook App.',
'input_type': 'text' 'input_type': 'text'
}, },
{'label': 'Facebook App ID', {'label': 'Facebook App ID',
@ -1554,14 +1540,15 @@ class FACEBOOK(Notifier):
}, },
{'label': 'Request Authorization', {'label': 'Request Authorization',
'value': 'Request Authorization', 'value': 'Request Authorization',
'name': 'facebook_facebookStep1', 'name': 'facebook_facebook_auth',
'description': 'Request Facebook authorization. (Ensure you allow the browser pop-up).', 'description': 'Request Facebook authorization. (Ensure you allow the browser pop-up).',
'input_type': 'button' 'input_type': 'button'
}, },
{'label': 'Facebook Access Token', {'label': 'Facebook Access Token',
'value': self.config['access_token'], 'value': self.config['access_token'],
'name': 'facebook_access_token', 'name': 'facebook_access_token',
'description': 'Your Facebook access token. Automatically filled in after requesting authorization.', 'description': 'Your Facebook access token. '
'Automatically filled in after requesting authorization.',
'input_type': 'text' 'input_type': 'text'
}, },
{'label': 'Facebook Group ID', {'label': 'Facebook Group ID',
@ -1760,7 +1747,7 @@ class GROWL(Notifier):
config_option = [{'label': 'Growl Host', config_option = [{'label': 'Growl Host',
'value': self.config['host'], 'value': self.config['host'],
'name': 'growl_host', 'name': 'growl_host',
'description': 'Your Growl hostname.', 'description': 'Your Growl hostname or IP address.',
'input_type': 'text' 'input_type': 'text'
}, },
{'label': 'Growl Password', {'label': 'Growl Password',
@ -1862,7 +1849,7 @@ class HIPCHAT(Notifier):
return self.make_request(self.config['hook'], headers=headers, json=data) return self.make_request(self.config['hook'], headers=headers, json=data)
def return_config_options(self): def return_config_options(self):
config_option = [{'label': 'Hipchat Custom Integrations Full URL', config_option = [{'label': 'Hipchat Custom Integrations URL',
'value': self.config['hook'], 'value': self.config['hook'],
'name': 'hipchat_hook', 'name': 'hipchat_hook',
'description': 'Your Hipchat BYO integration URL. You can get a key from' 'description': 'Your Hipchat BYO integration URL. You can get a key from'
@ -2317,9 +2304,9 @@ class NMA(Notifier):
class OSX(Notifier): class OSX(Notifier):
""" """
OSX notifications macOS notifications
""" """
NAME = 'OSX Notify' NAME = 'macOS'
_DEFAULT_CONFIG = {'notify_app': '/Applications/Tautulli' _DEFAULT_CONFIG = {'notify_app': '/Applications/Tautulli'
} }
@ -2485,7 +2472,7 @@ class PLEX(Notifier):
return True return True
def return_config_options(self): def return_config_options(self):
config_option = [{'label': 'Plex Home Theater Host:Port', config_option = [{'label': 'Plex Home Theater Host Address',
'value': self.config['hosts'], 'value': self.config['hosts'],
'name': 'plex_hosts', 'name': 'plex_hosts',
'description': 'Host running Plex Home Theater (eg. http://localhost:3005). Separate multiple hosts with commas (,).', 'description': 'Host running Plex Home Theater (eg. http://localhost:3005). Separate multiple hosts with commas (,).',
@ -2676,10 +2663,10 @@ class PUSHBULLET(Notifier):
return {'': ''} return {'': ''}
def return_config_options(self): def return_config_options(self):
config_option = [{'label': 'Pushbullet API Key', config_option = [{'label': 'Pushbullet Access Token',
'value': self.config['api_key'], 'value': self.config['api_key'],
'name': 'pushbullet_api_key', 'name': 'pushbullet_api_key',
'description': 'Your Pushbullet API key.', 'description': 'Your Pushbullet access token.',
'input_type': 'text', 'input_type': 'text',
'refresh': True 'refresh': True
}, },
@ -3426,16 +3413,7 @@ class TWITTER(Notifier):
return self._send_tweet(body, attachment=poster_url) return self._send_tweet(body, attachment=poster_url)
def return_config_options(self): def return_config_options(self):
config_option = [{'label': 'Instructions', config_option = [{'label': 'Twitter Consumer Key',
'description': 'Step 1: Visit <a href="' + helpers.anon_url('https://apps.twitter.com') + '" target="_blank">'
'Twitter Apps</a> to <strong>Create New App</strong>. A vaild "Website" is not required.<br>'
'Step 2: Go to <strong>Keys and Access Tokens</strong> and click '
'<strong>Create my access token</strong>.<br>'
'Step 3: Fill in the <strong>Consumer Key</strong>, <strong>Consumer Secret</strong>, '
'<strong>Access Token</strong>, and <strong>Access Token Secret</strong> below.',
'input_type': 'help'
},
{'label': 'Twitter Consumer Key',
'value': self.config['consumer_key'], 'value': self.config['consumer_key'],
'name': 'twitter_consumer_key', 'name': 'twitter_consumer_key',
'description': 'Your Twitter consumer key.', 'description': 'Your Twitter consumer key.',
@ -3479,9 +3457,9 @@ class TWITTER(Notifier):
class XBMC(Notifier): class XBMC(Notifier):
""" """
XBMC notifications Kodi notifications
""" """
NAME = 'XBMC' NAME = 'Kodi'
_DEFAULT_CONFIG = {'hosts': '', _DEFAULT_CONFIG = {'hosts': '',
'username': '', 'username': '',
'password': '', 'password': '',
@ -3551,22 +3529,22 @@ class XBMC(Notifier):
return True return True
def return_config_options(self): def return_config_options(self):
config_option = [{'label': 'XBMC Host:Port', config_option = [{'label': 'Kodi Host Address',
'value': self.config['hosts'], 'value': self.config['hosts'],
'name': 'xbmc_hosts', 'name': 'xbmc_hosts',
'description': 'Host running XBMC (e.g. http://localhost:8080). Separate multiple hosts with commas (,).', 'description': 'Host running Kodi (e.g. http://localhost:8080). Separate multiple hosts with commas (,).',
'input_type': 'text' 'input_type': 'text'
}, },
{'label': 'XBMC Username', {'label': 'Kodi Username',
'value': self.config['username'], 'value': self.config['username'],
'name': 'xbmc_username', 'name': 'xbmc_username',
'description': 'Username of your XBMC client API (blank for none).', 'description': 'Username of your Kodi client API (blank for none).',
'input_type': 'text' 'input_type': 'text'
}, },
{'label': 'XBMC Password', {'label': 'Kodi Password',
'value': self.config['password'], 'value': self.config['password'],
'name': 'xbmc_password', 'name': 'xbmc_password',
'description': 'Password of your XBMC client API (blank for none).', 'description': 'Password of your Kodi client API (blank for none).',
'input_type': 'password' 'input_type': 'password'
}, },
{'label': 'Notification Duration', {'label': 'Notification Duration',

View file

@ -3191,7 +3191,7 @@ class WebInterface(object):
@cherrypy.expose @cherrypy.expose
@cherrypy.tools.json_out() @cherrypy.tools.json_out()
@requireAuth(member_of("admin")) @requireAuth(member_of("admin"))
def facebookStep1(self, app_id='', app_secret='', redirect_uri='', **kwargs): def facebook_auth(self, app_id='', app_secret='', redirect_uri='', **kwargs):
cherrypy.response.headers['Cache-Control'] = "max-age=0,no-cache,no-store" cherrypy.response.headers['Cache-Control'] = "max-age=0,no-cache,no-store"
facebook_notifier = notifiers.FACEBOOK() facebook_notifier = notifiers.FACEBOOK()
@ -3206,7 +3206,7 @@ class WebInterface(object):
@cherrypy.expose @cherrypy.expose
@requireAuth(member_of("admin")) @requireAuth(member_of("admin"))
def facebookStep2(self, code='', **kwargs): def facebook_redirect(self, code='', **kwargs):
cherrypy.response.headers['Cache-Control'] = "max-age=0,no-cache,no-store" cherrypy.response.headers['Cache-Control'] = "max-age=0,no-cache,no-store"
facebook = notifiers.FACEBOOK() facebook = notifiers.FACEBOOK()