mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-11 07:46:07 -07:00
Add new notification system
This commit is contained in:
parent
258ec197d7
commit
f0595b8b0a
7 changed files with 1924 additions and 1838 deletions
|
@ -2328,6 +2328,7 @@ a .home-platforms-list-cover-face:hover
|
||||||
margin: 0px 0px 20px 0px;
|
margin: 0px 0px 20px 0px;
|
||||||
}
|
}
|
||||||
.stacked-configs > li {
|
.stacked-configs > li {
|
||||||
|
margin: 0;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
background-color: #282828;
|
background-color: #282828;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
@ -2349,21 +2350,27 @@ a .home-platforms-list-cover-face:hover
|
||||||
color: #eee;
|
color: #eee;
|
||||||
background-color: #2f2f2f;
|
background-color: #2f2f2f;
|
||||||
}
|
}
|
||||||
.stacked-configs > li > span > a.toggle-right {
|
.stacked-configs > li > span > a.toggle-right,
|
||||||
|
.stacked-configs > li > span > span.toggle-right {
|
||||||
float: right;
|
float: right;
|
||||||
color: #999;
|
color: #999;
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
}
|
}
|
||||||
.stacked-configs > li > span > a.toggle-left {
|
.stacked-configs > li > span > a.toggle-left,
|
||||||
|
.stacked-configs > li > span > span.toggle-left {
|
||||||
color: #444;
|
color: #444;
|
||||||
padding-right: 8px;
|
padding-right: 8px;
|
||||||
}
|
}
|
||||||
.stacked-configs > li > span > a:hover {
|
.stacked-configs > li > span > a:hover {
|
||||||
color: #eee;
|
color: #eee;
|
||||||
}
|
}
|
||||||
.stacked-configs > li > span > a.active {
|
.stacked-configs > li > span > a.active,
|
||||||
|
.stacked-configs > li > span > span.active {
|
||||||
color: #f9be03;
|
color: #f9be03;
|
||||||
}
|
}
|
||||||
|
.stacked-configs > li.new_notification_agent {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
.accordion {
|
.accordion {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 900px;
|
max-width: 900px;
|
||||||
|
@ -2382,10 +2389,13 @@ a .home-platforms-list-cover-face:hover
|
||||||
-o-transition: all 0.3s ease;
|
-o-transition: all 0.3s ease;
|
||||||
transition: all 0.3s ease;
|
transition: all 0.3s ease;
|
||||||
}
|
}
|
||||||
|
.accordion li {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
.accordion li:last-child .link {
|
.accordion li:last-child .link {
|
||||||
border-bottom: 0;
|
border-bottom: 0;
|
||||||
}
|
}
|
||||||
.accordion li i {
|
.accordion li i.fa {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 10px;
|
top: 10px;
|
||||||
left: 10px;
|
left: 10px;
|
||||||
|
@ -2449,7 +2459,7 @@ a .home-platforms-list-cover-face:hover
|
||||||
text-align: center;
|
text-align: center;
|
||||||
bottom: 10px;
|
bottom: 10px;
|
||||||
min-height: 32px;
|
min-height: 32px;
|
||||||
width: 250px;
|
width: 400px;
|
||||||
z-index: 9999;
|
z-index: 9999;
|
||||||
}
|
}
|
||||||
.ajaxMsg .msg {
|
.ajaxMsg .msg {
|
||||||
|
@ -3067,3 +3077,34 @@ a:hover .overlay-refresh-image:hover {
|
||||||
#api_key.form-control[readonly]:focus {
|
#api_key.form-control[readonly]:focus {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
}
|
}
|
||||||
|
#plexpy-notifiers-table .friendly_name {
|
||||||
|
color: #777;
|
||||||
|
}
|
||||||
|
#notifier-config-modal .nav-tabs {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
padding-left: 15px;
|
||||||
|
border-bottom: 1px solid #444;
|
||||||
|
}
|
||||||
|
#notifier-config-modal .nav-tabs > li {
|
||||||
|
margin: 0 0 -1px 0;
|
||||||
|
}
|
||||||
|
#notifier-config-modal .nav-tabs > li > a {
|
||||||
|
padding: 5px 10px;
|
||||||
|
color: #737373;
|
||||||
|
}
|
||||||
|
#notifier-config-modal .nav-tabs > li > a:hover {
|
||||||
|
border-color: #444;
|
||||||
|
background: #222;
|
||||||
|
}
|
||||||
|
#notifier-config-modal .nav-tabs > li.active > a,
|
||||||
|
#notifier-config-modal .nav-tabs > li.active > a:hover,
|
||||||
|
#notifier-config-modal .nav-tabs > li.active > a:focus {
|
||||||
|
color: #fff;
|
||||||
|
background: #222;
|
||||||
|
}
|
||||||
|
#notifier-config-modal .nav-tabs > li.active > a,
|
||||||
|
#notifier-config-modal .nav-tabs > li.active > a:hover,
|
||||||
|
#notifier-config-modal .nav-tabs > li.active > a:focus {
|
||||||
|
border: 1px solid #444;
|
||||||
|
border-bottom-color: transparent;
|
||||||
|
}
|
||||||
|
|
352
data/interfaces/default/notifier_config.html
Normal file
352
data/interfaces/default/notifier_config.html
Normal file
|
@ -0,0 +1,352 @@
|
||||||
|
<%!
|
||||||
|
from plexpy import helpers, notifiers
|
||||||
|
available_notification_actions = notifiers.available_notification_actions()
|
||||||
|
%>
|
||||||
|
% if notifier:
|
||||||
|
<div class="modal-dialog" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="fa fa-remove"></i></button>
|
||||||
|
<h4 class="modal-title" id="notifier-config-modal-header">${notifier['agent_label']} Settings</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row">
|
||||||
|
<ul class="nav nav-tabs list-unstyled" role="tablist">
|
||||||
|
<li role="presentation" class="active"><a href="#tabs-config" aria-controls="tabs-config" role="tab" data-toggle="tab">Configuration</a></li>
|
||||||
|
<li role="presentation"><a href="#tabs-triggers" aria-controls="tabs-triggers" role="tab" data-toggle="tab">Triggers</a></li>
|
||||||
|
<li role="presentation"><a href="#tabs-notify_text" aria-controls="tabs-notify_text" role="tab" data-toggle="tab">Notification Text</a></li>
|
||||||
|
<li role="presentation"><a href="#tabs-test_notifications" aria-controls="tabs-test_notifications" role="tab" data-toggle="tab">Test Notifications</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<form action="set_notifier_config" method="post" class="form" id="set_notifier_config" data-parsley-validate>
|
||||||
|
<div class="tab-content">
|
||||||
|
<div role="tabpanel" class="tab-pane active" id="tabs-config">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<input type="hidden" id="notifier_id" name="notifier_id" value="${notifier['id']}" />
|
||||||
|
<input type="hidden" id="agent_id" name="agent_id" value="${notifier['agent_id']}" />
|
||||||
|
% for item in notifier['config']:
|
||||||
|
% if item['input_type'] == 'help':
|
||||||
|
<div class="form-group">
|
||||||
|
<label>${item['label']}</label>
|
||||||
|
<p class="help-block">${item['description'] | n}</p>
|
||||||
|
</div>
|
||||||
|
% elif item['input_type'] == 'text' or item['input_type'] == 'number' or item['input_type'] == 'password':
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="${item['name']}">${item['label']}</label>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-8">
|
||||||
|
<input type="${item['input_type']}" class="form-control" id="${item['name']}" name="${item['name']}" value="${item['value']}" size="30">
|
||||||
|
% if item['name'] == 'osx_notify_app':
|
||||||
|
<a href="javascript:void(0)" id="osxnotifyregister">Register</a>
|
||||||
|
% endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<p class="help-block">${item['description'] | n}</p>
|
||||||
|
</div>
|
||||||
|
% elif item['input_type'] == 'button':
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="${item['name']}">${item['label']}</label>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-8">
|
||||||
|
<input type="button" class="btn btn-bright" id="${item['name']}" name="${item['name']}" value="${item['value']}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<p class="help-block">${item['description'] | n}</p>
|
||||||
|
</div>
|
||||||
|
% elif item['input_type'] == 'checkbox':
|
||||||
|
<div class="checkbox">
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" data-id="${item['name']}" class="checkboxes" value="1" ${helpers.checked(item['value'])}> ${item['label']}
|
||||||
|
</label>
|
||||||
|
<p class="help-block">${item['description'] | n}</p>
|
||||||
|
<input type="hidden" id="${item['name']}" name="${item['name']}" value="${item['value']}">
|
||||||
|
</div>
|
||||||
|
% elif item['input_type'] == 'select':
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="${item['name']}">${item['label']}</label>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-8">
|
||||||
|
<select class="form-control" id="${item['name']}" name="${item['name']}">
|
||||||
|
% for key, value in sorted(item['select_options'].iteritems()):
|
||||||
|
% if key == item['value']:
|
||||||
|
<option value="${key}" selected>${value}</option>
|
||||||
|
% else:
|
||||||
|
<option value="${key}">${value}</option>
|
||||||
|
% endif
|
||||||
|
% endfor
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<p class="help-block">${item['description'] | n}</p>
|
||||||
|
</div>
|
||||||
|
% endif
|
||||||
|
% endfor
|
||||||
|
</div>
|
||||||
|
<div class="col-md-12" style="margin-top: 10px; padding-top: 10px; border-top: 1px solid #444;">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="friendly_name">Friendly Identifier</label>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-8">
|
||||||
|
<input type="text" class="form-control" id="friendly_name" name="friendly_name" value="${notifier['friendly_name']}" size="30">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<p class="help-block">Optional: enter a friendly identifier the notification agent (e.g. Recently Added)</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div role="tabpanel" class="tab-pane" id="tabs-triggers">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<p class="help-block">
|
||||||
|
Select items that will trigger a notification for this ${notifier['agent_label']} notifiation agent.
|
||||||
|
</p>
|
||||||
|
% for action in available_notification_actions:
|
||||||
|
<div class="checkbox">
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" data-id="${action['name']}" class="checkboxes" value="1" ${helpers.checked(notifier['actions'][action['name']])}> Notify on ${action['label']}
|
||||||
|
</label>
|
||||||
|
<p class="help-block">${action['description'] | n}</p>
|
||||||
|
<input type="hidden" id="${action['name']}" name="${action['name']}" value="${notifier['actions'][action['name']]}">
|
||||||
|
</div>
|
||||||
|
% endfor
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div role="tabpanel" class="tab-pane" id="tabs-notify_text">
|
||||||
|
<p class="help-block">
|
||||||
|
% if notifier['agent_name'] == 'scripts':
|
||||||
|
Set the custom arguments passed to the script for each type of notification.<br />
|
||||||
|
% else:
|
||||||
|
Set the custom formatted text for each type of notification.<br />
|
||||||
|
% endif
|
||||||
|
<a href="#notify-text-sub-modal" data-toggle="modal">Click here</a> for a list of available parameters which can be used.
|
||||||
|
</p>
|
||||||
|
<p class="help-block">
|
||||||
|
You can also add tags to exclude certain text depending on the media type.<br />
|
||||||
|
<a href="#notify-text-tags-modal" data-toggle="modal">Click here</a> to view usage information.
|
||||||
|
</p>
|
||||||
|
<br />
|
||||||
|
<ul id="accordion-notify_text" class="accordion list-unstyled">
|
||||||
|
% if notifier['agent_name'] == 'scripts':
|
||||||
|
% for action in available_notification_actions:
|
||||||
|
<li>
|
||||||
|
<div class="link"><i class="fa ${action['icon']} fa-fw"></i> ${action['label']}<i class="fa fa-chevron-down"></i></div>
|
||||||
|
<ul class="submenu">
|
||||||
|
<li>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="${action['name']}_subject">Script Arguments</label>
|
||||||
|
<input class="form-control" type="text" id="${action['name']}_subject" name="${action['name']}_subject" value="${notifier['notify_text'][action['name']]['subject']}" data-parsley-trigger="change" required>
|
||||||
|
<p class="help-block">Set custom arguments passed to the script.</p>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
% endfor
|
||||||
|
% else:
|
||||||
|
% for action in available_notification_actions:
|
||||||
|
<li>
|
||||||
|
<div class="link"><i class="fa ${action['icon']} fa-fw"></i> ${action['label']}<i class="fa fa-chevron-down"></i></div>
|
||||||
|
<ul class="submenu">
|
||||||
|
<li>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="${action['name']}_subject">Subject Line</label>
|
||||||
|
<input class="form-control" type="text" id="${action['name']}_subject" name="${action['name']}_subject" value="${notifier['notify_text'][action['name']]['subject']}" data-parsley-trigger="change" required>
|
||||||
|
<p class="help-block">Set a custom subject line.</p>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="${action['name']}_body">Message Body</label>
|
||||||
|
<textarea class="form-control" id="${action['name']}_body" name="${action['name']}_body" data-parsley-trigger="change" data-autoresize required>${notifier['notify_text'][action['name']]['body']}</textarea>
|
||||||
|
<p class="help-block">Set a custom body.</p>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
% endfor
|
||||||
|
% endif
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div role="tabpanel" class="tab-pane" id="tabs-test_notifications">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<p class="help-block">
|
||||||
|
Test if ${notifier['agent_label']} notifications are working. See the <a href="logs">logs</a> for troubleshooting.
|
||||||
|
</p>
|
||||||
|
% if notifier['agent_name'] == 'scripts':
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="test_script">Script</label>
|
||||||
|
<select class="form-control" id="test_script" name="test_script">
|
||||||
|
% for key, value in sorted(notifier['config'][2]['select_options'].iteritems()):
|
||||||
|
<option value="${key}">${value}</option>
|
||||||
|
% endfor
|
||||||
|
</select>
|
||||||
|
<p class="help-block">Choose the script to test.</p>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="test_subject">Script Arguments</label>
|
||||||
|
<input class="form-control" type="text" id="test_subject" name="test_subject" value="">
|
||||||
|
<p class="help-block">Set custom arguments passed to the script.</p>
|
||||||
|
</div>
|
||||||
|
% else:
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="test_subject">Subject Line</label>
|
||||||
|
<input class="form-control" type="text" id="test_subject" name="test_subject" value="PlexPy">
|
||||||
|
<p class="help-block">Set a custom subject line.</p>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="test_body">Message Body</label>
|
||||||
|
<input class="form-control" type="text" id="test_body" name="test_body" value="Test notification">
|
||||||
|
<p class="help-block">Set a custom body.</p>
|
||||||
|
</div>
|
||||||
|
% endif
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-8">
|
||||||
|
<input type="button" class="btn btn-bright" id="test_notifier" name="test_notifier" value="Test ${notifier['agent_label']}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<input type="button" id="delete-notifier-item" class="btn btn-danger btn-edit" style="float:left;" value="Delete">
|
||||||
|
<input type="button" id="save-notifier-item" class="btn btn-bright" value="Save">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
% endif
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
function reloadModal() {
|
||||||
|
$.ajax({
|
||||||
|
url: 'get_notifier_config_modal',
|
||||||
|
data: { notifier_id: '${notifier["id"]}' },
|
||||||
|
cache: false,
|
||||||
|
async: true,
|
||||||
|
complete: function (xhr, status) {
|
||||||
|
$('#notifier-config-modal').html(xhr.responseText);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function saveCallback() {
|
||||||
|
$('#notifier-config-modal').modal('hide');
|
||||||
|
getNotifiersTable();
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#delete-notifier-item').click(function () {
|
||||||
|
var msg = 'Are you sure you want to delete this <strong>${notifier["agent_label"]}</strong> notification agent?';
|
||||||
|
var url = 'delete_notifier';
|
||||||
|
confirmAjaxCall(url, msg, { notifier_id: '${notifier["id"]}' }, null, saveCallback);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#save-notifier-item').click(function () {
|
||||||
|
// Reload modal to update certain fields
|
||||||
|
doAjaxCall('set_notifier_config', $(this), 'tabs', true, true, saveCallback);
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
function disableFacebookRequest() {
|
||||||
|
if ($('#facebook_app_id').val() != '' && $('#facebook_app_secret').val() != '') { $('#facebookStep1').prop('disabled', false); }
|
||||||
|
else { $('#facebookStep1').prop('disabled', true); }
|
||||||
|
}
|
||||||
|
disableFacebookRequest();
|
||||||
|
$('#facebook_app_id, #facebook_app_secret').on('change', function () {
|
||||||
|
disableFacebookRequest();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#facebook_facebookStep1').click(function () {
|
||||||
|
// Remove trailing '/' from Facebook redirect URI
|
||||||
|
if ($('#facebook_redirect_uri') && $('#facebook_redirect_uri').val().endsWith('/')) {
|
||||||
|
$('#facebook_redirect_uri').val($('#facebook_redirect_uri').val().slice(0, -1));
|
||||||
|
}
|
||||||
|
doAjaxCall('set_notifier_config', $(this), 'tabs', true);
|
||||||
|
$.get('facebookStep1', function (data) { window.open(data); })
|
||||||
|
.done(function () { showMsg('<i class="fa fa-check"></i> Confirm Authorization. Check pop-up blocker if no response.', false, true, 3000); });
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#browser_allow_browser').click(function () {
|
||||||
|
PNotify.desktop.permission();
|
||||||
|
})
|
||||||
|
|
||||||
|
$('#osxnotifyregister').click(function () {
|
||||||
|
var osx_notify_app = $('#osx_notify_app').val();
|
||||||
|
$.get('osxnotifyregister', { 'app': osx_notify_app }, function (data) { showMsg('<i class="fa fa-check"></i> ' + data, false, true, 3000); });
|
||||||
|
})
|
||||||
|
|
||||||
|
$('#test_notifier').click(function () {
|
||||||
|
doAjaxCall('set_notifier_config', $(this), 'tabs', true, false, sendTestNotification);
|
||||||
|
});
|
||||||
|
|
||||||
|
function sendTestNotification() {
|
||||||
|
if ('${notifier["agent_name"]}' != 'browser') {
|
||||||
|
$.ajax({
|
||||||
|
url: 'send_notification',
|
||||||
|
data: {
|
||||||
|
notifier_id: '${notifier["id"]}',
|
||||||
|
subject: $('#test_subject').val(),
|
||||||
|
body: $('#test_body').val(),
|
||||||
|
script: $('#test_script').val(),
|
||||||
|
notify_action: 'test'
|
||||||
|
},
|
||||||
|
cache: false,
|
||||||
|
async: true,
|
||||||
|
complete: function (xhr, status) {
|
||||||
|
if (xhr.responseText.indexOf('sent') > -1) {
|
||||||
|
msg = '<i class="fa fa-check"></i> ' + xhr.responseText;
|
||||||
|
showMsg(msg, false, true, 2000);
|
||||||
|
} else {
|
||||||
|
msg = '<i class="fa fa-times"></i> ' + xhr.responseText;
|
||||||
|
showMsg(msg, false, true, 2000, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
if ($('#browser_auto_hide_delay').val() == "0") {
|
||||||
|
PNotify.prototype.options.hide = false;
|
||||||
|
} else {
|
||||||
|
PNotify.prototype.options.hide = true;
|
||||||
|
PNotify.prototype.options.delay = $('#browser_auto_hide_delay').val() * 1000;
|
||||||
|
}
|
||||||
|
var notification = new PNotify({
|
||||||
|
title: $('#test_subject').val(),
|
||||||
|
text: $('#test_body').val()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$("${', '.join(['#' + c['name'] for c in notifier['config'] if c.get('refresh')])}").on('change', function () {
|
||||||
|
// Reload modal to update certain fields
|
||||||
|
doAjaxCall('set_notifier_config', $(this), 'tabs', true, false, reloadModal);
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Never send checkbox values directly, always substitute value in hidden input.
|
||||||
|
$('.checkboxes').click(function () {
|
||||||
|
var configToggle = $(this).data('id');
|
||||||
|
if ($(this).is(':checked')) {
|
||||||
|
$('#'+configToggle).val(1);
|
||||||
|
} else {
|
||||||
|
$('#'+configToggle).val(0);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var accordion_session = new Accordion($('#accordion-notify_text'), false);
|
||||||
|
|
||||||
|
// auto resizing textarea for custom notification message body
|
||||||
|
$('textarea[data-autoresize]').each(function () {
|
||||||
|
var offset = this.offsetHeight - this.clientHeight;
|
||||||
|
var resizeTextarea = function (el) {
|
||||||
|
$(el).css('height', 'auto').css('height', el.scrollHeight + offset);
|
||||||
|
};
|
||||||
|
$(this).on('focus keyup input', function () { resizeTextarea(this); }).removeAttr('data-autoresize');
|
||||||
|
});
|
||||||
|
</script>
|
46
data/interfaces/default/notifiers_table.html
Normal file
46
data/interfaces/default/notifiers_table.html
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
<%doc>
|
||||||
|
USAGE DOCUMENTATION :: PLEASE LEAVE THIS AT THE TOP OF THIS FILE
|
||||||
|
|
||||||
|
For Mako templating syntax documentation please visit: http://docs.makotemplates.org/en/latest/
|
||||||
|
|
||||||
|
Filename: notifiers_table.html
|
||||||
|
Version: 0.1
|
||||||
|
|
||||||
|
DOCUMENTATION :: END
|
||||||
|
</%doc>
|
||||||
|
|
||||||
|
<ul class="stacked-configs list-unstyled">
|
||||||
|
% for notifier in notifiers_list:
|
||||||
|
<li>
|
||||||
|
<span>
|
||||||
|
<span class="toggle-left trigger-tooltip ${'active' if any(notifier['actions'].values()) else ''}" data-toggle="tooltip" data-placement="top" title="Triggers active"><i class="fa fa-lg fa-bell"></i></span>
|
||||||
|
${notifier['agent_label']} <span class="friendly_name">(${notifier['friendly_name'] or notifier['id']})</span>
|
||||||
|
<a href="#" data-target="#notifier-config-modal" data-id="${notifier['id']}" class="toggle-notifier-config-modal toggle-right" data-toggle="modal"><i class="fa fa-lg fa-cog"></i></a>
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
% endfor
|
||||||
|
<li>
|
||||||
|
<span>
|
||||||
|
<span class="toggle-left"><i class="fa fa-lg fa-bell"></i></span> Add a new notification agent
|
||||||
|
<a href="#add-notifier-modal" data-toggle="modal" class="toggle-right"><i class="fa fa-lg fa-plus"></i></a>
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// Load notification agent config modal
|
||||||
|
$(".toggle-notifier-config-modal").click(function () {
|
||||||
|
var notifier_id = $(this).data('id');
|
||||||
|
$.ajax({
|
||||||
|
url: 'get_notifier_config_modal',
|
||||||
|
data: { notifier_id: notifier_id },
|
||||||
|
cache: false,
|
||||||
|
async: true,
|
||||||
|
complete: function (xhr, status) {
|
||||||
|
$("#notifier-config-modal").html(xhr.responseText);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.trigger-tooltip').tooltip();
|
||||||
|
</script>
|
|
@ -7,7 +7,7 @@
|
||||||
from plexpy import common, notifiers
|
from plexpy import common, notifiers
|
||||||
from plexpy.helpers import anon_url
|
from plexpy.helpers import anon_url
|
||||||
|
|
||||||
available_notification_agents = sorted(notifiers.available_notification_agents(), key=lambda k: k['name'])
|
available_notification_agents = sorted(notifiers.available_notification_agents(), key=lambda k: k['label'])
|
||||||
%>
|
%>
|
||||||
<%def name="headIncludes()">
|
<%def name="headIncludes()">
|
||||||
</%def>
|
</%def>
|
||||||
|
@ -973,274 +973,6 @@
|
||||||
<p class="help-block">Set the delay (in seconds) for recently added notifications to allow metadata to be processed. Minimum 60 seconds.</p>
|
<p class="help-block">Set the delay (in seconds) for recently added notifications to allow metadata to be processed. Minimum 60 seconds.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="padded-header">
|
|
||||||
<h3>Custom Notification Messages</h3>
|
|
||||||
</div>
|
|
||||||
<p class="help-block">
|
|
||||||
You can set custom formatted text for each type of notification.
|
|
||||||
<a href="#notify-text-sub-modal" data-toggle="modal">Click here</a> for a list of available parameters which can be used.
|
|
||||||
</p>
|
|
||||||
<p class="help-block">
|
|
||||||
You can also add tags to exclude certain text depending on the media type.
|
|
||||||
<a href="#notify-text-tags-modal" data-toggle="modal">Click here</a> to view usage information.
|
|
||||||
</p>
|
|
||||||
<br/>
|
|
||||||
<ul id="accordion-session" class="accordion list-unstyled">
|
|
||||||
<li>
|
|
||||||
<div class="link"><i class="fa fa-play fa-fw"></i> Playback Start<i class="fa fa-chevron-down"></i></div>
|
|
||||||
<ul class="submenu">
|
|
||||||
<li>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="notify_on_start_subject_text">Subject Line</label>
|
|
||||||
<input class="form-control" type="text" id="notify_on_start_subject_text" name="notify_on_start_subject_text" value="${config['notify_on_start_subject_text']}" data-parsley-trigger="change" required>
|
|
||||||
<p class="help-block">Set a custom subject line.</p>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="notify_on_start_body_text">Message Body</label>
|
|
||||||
<textarea class="form-control" id="notify_on_start_body_text" name="notify_on_start_body_text" data-parsley-trigger="change" data-autoresize required>${config['notify_on_start_body_text']}</textarea>
|
|
||||||
<p class="help-block">Set a custom body.</p>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<div class="link"><i class="fa fa-stop fa-fw"></i> Playback Stop<i class="fa fa-chevron-down"></i></div>
|
|
||||||
<ul class="submenu">
|
|
||||||
<li>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="notify_on_stop_subject_text">Subject Line</label>
|
|
||||||
<input class="form-control" type="text" id="notify_on_stop_subject_text" name="notify_on_stop_subject_text" value="${config['notify_on_stop_subject_text']}" data-parsley-trigger="change" required>
|
|
||||||
<p class="help-block">Set a custom subject line.</p>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="notify_on_stop_body_text">Message Body</label>
|
|
||||||
<textarea class="form-control" id="notify_on_stop_body_text" name="notify_on_stop_body_text" data-parsley-trigger="change" data-autoresize required>${config['notify_on_stop_body_text']}</textarea>
|
|
||||||
<p class="help-block">Set a custom body.</p>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<div class="link"><i class="fa fa-pause fa-fw"></i> Playback Pause<i class="fa fa-chevron-down"></i></div>
|
|
||||||
<ul class="submenu">
|
|
||||||
<li>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="notify_on_pause_subject_text">Subject Line</label>
|
|
||||||
<input class="form-control" type="text" id="notify_on_pause_subject_text" name="notify_on_pause_subject_text" value="${config['notify_on_pause_subject_text']}" data-parsley-trigger="change" required>
|
|
||||||
<p class="help-block">Set a custom subject line.</p>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="notify_on_pause_body_text">Message Body</label>
|
|
||||||
<textarea class="form-control" id="notify_on_pause_body_text" name="notify_on_pause_body_text" data-parsley-trigger="change" data-autoresize required>${config['notify_on_pause_body_text']}</textarea>
|
|
||||||
<p class="help-block">Set a custom body.</p>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<div class="link"><i class="fa fa-play fa-fw"></i> Playback Resume<i class="fa fa-chevron-down"></i></div>
|
|
||||||
<ul class="submenu">
|
|
||||||
<li>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="notify_on_resume_subject_text">Subject Line</label>
|
|
||||||
<input class="form-control" type="text" id="notify_on_resume_subject_text" name="notify_on_resume_subject_text" value="${config['notify_on_resume_subject_text']}" data-parsley-trigger="change" required>
|
|
||||||
<p class="help-block">Set a custom subject line.</p>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="notify_on_resume_body_text">Message Body</label>
|
|
||||||
<textarea class="form-control" id="notify_on_resume_body_text" name="notify_on_resume_body_text" data-parsley-trigger="change" data-autoresize required>${config['notify_on_resume_body_text']}</textarea>
|
|
||||||
<p class="help-block">Set a custom body.</p>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<div class="link"><i class="fa fa-eye fa-fw"></i> Watched<i class="fa fa-chevron-down"></i></div>
|
|
||||||
<ul class="submenu">
|
|
||||||
<li>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="notify_on_watched_subject_text">Subject Line</label>
|
|
||||||
<input class="form-control" type="text" id="notify_on_watched_subject_text" name="notify_on_watched_subject_text" value="${config['notify_on_watched_subject_text']}" data-parsley-trigger="change" required>
|
|
||||||
<p class="help-block">Set a custom subject line.</p>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="notify_on_watched_body_text">Message Body</label>
|
|
||||||
<textarea class="form-control" id="notify_on_watched_body_text" name="notify_on_watched_body_text" data-parsley-trigger="change" data-autoresize required>${config['notify_on_watched_body_text']}</textarea>
|
|
||||||
<p class="help-block">Set a custom body.</p>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<div class="link"><i class="fa fa-spinner fa-fw"></i> Buffer Warnings<i class="fa fa-chevron-down"></i></div>
|
|
||||||
<ul class="submenu">
|
|
||||||
<li>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="notify_on_buffer_subject_text">Subject Line</label>
|
|
||||||
<input class="form-control" type="text" id="notify_on_buffer_subject_text" name="notify_on_buffer_subject_text" value="${config['notify_on_buffer_subject_text']}" data-parsley-trigger="change" required>
|
|
||||||
<p class="help-block">Set a custom subject line.</p>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="notify_on_buffer_body_text">Message Body</label>
|
|
||||||
<textarea class="form-control" id="notify_on_buffer_body_text" name="notify_on_buffer_body_text" data-parsley-trigger="change" data-autoresize required>${config['notify_on_buffer_body_text']}</textarea>
|
|
||||||
<p class="help-block">Set a custom body.</p>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<div class="link"><i class="fa fa-arrow-circle-o-right fa-fw"></i> User Concurrent Streams<i class="fa fa-chevron-down"></i></div>
|
|
||||||
<ul class="submenu">
|
|
||||||
<li>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="notify_on_concurrent_subject_text">Subject Line</label>
|
|
||||||
<input class="form-control" type="text" id="notify_on_concurrent_subject_text" name="notify_on_concurrent_subject_text" value="${config['notify_on_concurrent_subject_text']}" data-parsley-trigger="change" required>
|
|
||||||
<p class="help-block">Set a custom subject line.</p>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="notify_on_buffer_body_text">Message Body</label>
|
|
||||||
<textarea class="form-control" id="notify_on_concurrent_body_text" name="notify_on_concurrent_body_text" data-parsley-trigger="change" data-autoresize required>${config['notify_on_concurrent_body_text']}</textarea>
|
|
||||||
<p class="help-block">Set a custom body.</p>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<div class="link"><i class="fa fa-desktop fa-fw"></i> User New Device<i class="fa fa-chevron-down"></i></div>
|
|
||||||
<ul class="submenu">
|
|
||||||
<li>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="notify_on_newdevice_subject_text">Subject Line</label>
|
|
||||||
<input class="form-control" type="text" id="notify_on_newdevice_subject_text" name="notify_on_newdevice_subject_text" value="${config['notify_on_newdevice_subject_text']}" data-parsley-trigger="change" required>
|
|
||||||
<p class="help-block">Set a custom subject line.</p>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="notify_on_buffer_body_text">Message Body</label>
|
|
||||||
<textarea class="form-control" id="notify_on_newdevice_body_text" name="notify_on_newdevice_body_text" data-parsley-trigger="change" data-autoresize required>${config['notify_on_newdevice_body_text']}</textarea>
|
|
||||||
<p class="help-block">Set a custom body.</p>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<ul id="accordion-timeline" class="accordion list-unstyled">
|
|
||||||
<li>
|
|
||||||
<div class="link"><i class="fa fa-download fa-fw"></i> Recently Added<i class="fa fa-chevron-down"></i></div>
|
|
||||||
<ul class="submenu">
|
|
||||||
<li>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="notify_on_created_subject_text">Subject Line</label>
|
|
||||||
<input class="form-control" type="text" id="notify_on_created_subject_text" name="notify_on_created_subject_text" value="${config['notify_on_created_subject_text']}" data-parsley-trigger="change" required>
|
|
||||||
<p class="help-block">Set a custom subject line.</p>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="notify_on_created_body_text">Message Body</label>
|
|
||||||
<textarea class="form-control" id="notify_on_created_body_text" name="notify_on_created_body_text" data-parsley-trigger="change" data-autoresize required>${config['notify_on_created_body_text']}</textarea>
|
|
||||||
<p class="help-block">Set a custom body.</p>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<div class="link"><i class="fa fa-server fa-fw"></i> Plex Server Down<i class="fa fa-chevron-down"></i></div>
|
|
||||||
<ul class="submenu">
|
|
||||||
<li>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="notify_on_intdown_subject_text">Subject Line</label>
|
|
||||||
<input class="form-control" type="text" id="notify_on_intdown_subject_text" name="notify_on_intdown_subject_text" value="${config['notify_on_intdown_subject_text']}" data-parsley-trigger="change" required>
|
|
||||||
<p class="help-block">Set a custom subject line.</p>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="notify_on_intdown_body_text">Message Body</label>
|
|
||||||
<textarea class="form-control" id="notify_on_intdown_body_text" name="notify_on_intdown_body_text" data-parsley-trigger="change" data-autoresize required>${config['notify_on_intdown_body_text']}</textarea>
|
|
||||||
<p class="help-block">Set a custom body.</p>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<div class="link"><i class="fa fa-server fa-fw"></i> Plex Server Back Up<i class="fa fa-chevron-down"></i></div>
|
|
||||||
<ul class="submenu">
|
|
||||||
<li>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="notify_on_intup_subject_text">Subject Line</label>
|
|
||||||
<input class="form-control" type="text" id="notify_on_intup_subject_text" name="notify_on_intup_subject_text" value="${config['notify_on_intup_subject_text']}" data-parsley-trigger="change" required>
|
|
||||||
<p class="help-block">Set a custom subject line.</p>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="notify_on_intup_body_text">Message Body</label>
|
|
||||||
<textarea class="form-control" id="notify_on_intup_body_text" name="notify_on_intup_body_text" data-parsley-trigger="change" data-autoresize required>${config['notify_on_intup_body_text']}</textarea>
|
|
||||||
<p class="help-block">Set a custom body.</p>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<div class="link"><i class="fa fa-server fa-fw"></i> Plex Remote Access Down<i class="fa fa-chevron-down"></i></div>
|
|
||||||
<ul class="submenu">
|
|
||||||
<li>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="notify_on_extdown_subject_text">Subject Line</label>
|
|
||||||
<input class="form-control" type="text" id="notify_on_extdown_subject_text" name="notify_on_extdown_subject_text" value="${config['notify_on_extdown_subject_text']}" data-parsley-trigger="change" required>
|
|
||||||
<p class="help-block">Set a custom subject line.</p>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="notify_on_extdown_body_text">Message Body</label>
|
|
||||||
<textarea class="form-control" id="notify_on_extdown_body_text" name="notify_on_extdown_body_text" data-parsley-trigger="change" data-autoresize required>${config['notify_on_extdown_body_text']}</textarea>
|
|
||||||
<p class="help-block">Set a custom body.</p>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<div class="link"><i class="fa fa-server fa-fw"></i> Plex Remote Access Back Up<i class="fa fa-chevron-down"></i></div>
|
|
||||||
<ul class="submenu">
|
|
||||||
<li>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="notify_on_extup_subject_text">Subject Line</label>
|
|
||||||
<input class="form-control" type="text" id="notify_on_extup_subject_text" name="notify_on_extup_subject_text" value="${config['notify_on_extup_subject_text']}" data-parsley-trigger="change" required>
|
|
||||||
<p class="help-block">Set a custom subject line.</p>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="notify_on_extup_body_text">Message Body</label>
|
|
||||||
<textarea class="form-control" id="notify_on_extup_body_text" name="notify_on_extup_body_text" data-parsley-trigger="change" data-autoresize required>${config['notify_on_extup_body_text']}</textarea>
|
|
||||||
<p class="help-block">Set a custom body.</p>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<div class="link"><i class="fa fa-refresh fa-fw"></i> Plex Update Available<i class="fa fa-chevron-down"></i></div>
|
|
||||||
<ul class="submenu">
|
|
||||||
<li>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="notify_on_pmsupdate_subject_text">Subject Line</label>
|
|
||||||
<input class="form-control" type="text" id="notify_on_pmsupdate_subject_text" name="notify_on_pmsupdate_subject_text" value="${config['notify_on_pmsupdate_subject_text']}" data-parsley-trigger="change" required>
|
|
||||||
<p class="help-block">Set a custom subject line.</p>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="notify_on_extup_body_text">Message Body</label>
|
|
||||||
<textarea class="form-control" id="notify_on_pmsupdate_body_text" name="notify_on_pmsupdate_body_text" data-parsley-trigger="change" data-autoresize required>${config['notify_on_pmsupdate_body_text']}</textarea>
|
|
||||||
<p class="help-block">Set a custom body.</p>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<ul id="accordion-scripts" class="accordion list-unstyled">
|
|
||||||
<li>
|
|
||||||
<div class="link"><i class="glyphicon glyphicon-console"></i> Script <i class="fa fa-chevron-down"></i></div>
|
|
||||||
<ul class="submenu">
|
|
||||||
<li>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="notify_scripts_args_text">Script Arguments</label>
|
|
||||||
<input class="form-control" type="text" id="notify_scripts_args_text" name="notify_scripts_args_text" value="${config['notify_scripts_args_text']}" data-parsley-trigger="change">
|
|
||||||
<p class="help-block">Set custom arguments passed to the scripts.</p>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<p><input type="button" class="btn btn-bright save-button" value="Save" data-success="Changes saved successfully"></p>
|
<p><input type="button" class="btn btn-bright save-button" value="Save" data-success="Changes saved successfully"></p>
|
||||||
</div>
|
</div>
|
||||||
<div role="tabpanel" class="tab-pane" id="tabs-10">
|
<div role="tabpanel" class="tab-pane" id="tabs-10">
|
||||||
|
@ -1249,27 +981,13 @@
|
||||||
<h3>Notification Agents</h3>
|
<h3>Notification Agents</h3>
|
||||||
</div>
|
</div>
|
||||||
<p class="help-block">
|
<p class="help-block">
|
||||||
Toggle the desired notification options by clicking the <span class="help-bold">bell icon (<i class="fa fa-sm fa-bell"></i>)</span> and configure it by clicking the settings icon to the right.
|
Add a new notification agent, or configure an existing notification agent by clicking the settings icon on the right.
|
||||||
</p>
|
</p>
|
||||||
<br />
|
<br />
|
||||||
<ul class="stacked-configs list-unstyled">
|
<div id="plexpy-notifiers-table">
|
||||||
% for agent in available_notification_agents:
|
<div class='text-muted'><i class="fa fa-refresh fa-spin"></i> Loading notification agents...</div>
|
||||||
<li>
|
<br>
|
||||||
<span>
|
</div>
|
||||||
% if any(k[:2] == 'on' and v == 1 for k, v in agent.iteritems()):
|
|
||||||
<a href="javascript:void(0)" data-target="#notification-triggers-modal" data-id="${agent['id']}" class="toggle-notification-triggers-modal toggle-left active" data-toggle="modal"><i class="fa fa-lg fa-bell"></i></a>
|
|
||||||
% else:
|
|
||||||
<a href="javascript:void(0)" data-target="#notification-triggers-modal" data-id="${agent['id']}" class="toggle-notification-triggers-modal toggle-left" data-toggle="modal"><i class="fa fa-lg fa-bell"></i></a>
|
|
||||||
% endif
|
|
||||||
${agent['name']}
|
|
||||||
% if agent['has_config']:
|
|
||||||
<a href="javascript:void(0)" rel="tooltip" data-target="#notification-config-modal" data-placement="top" title data-title="Open configuration" data-id="${agent['id']}" class="toggle-notification-config-modal toggle-right" data-toggle="modal"><i class="fa fa-lg fa-cog"></i></a>
|
|
||||||
% endif
|
|
||||||
</span>
|
|
||||||
</li>
|
|
||||||
% endfor
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
@ -1591,8 +1309,35 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="app-import-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="app-import-modal"></div>
|
<div id="app-import-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="app-import-modal"></div>
|
||||||
<div id="notification-config-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="notification-config-modal"></div>
|
<div id="add-notifier-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="add-notifier-modal">
|
||||||
<div id="notification-triggers-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="notification-triggers-modal"></div>
|
<div class="modal-dialog" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="fa fa-remove"></i></button>
|
||||||
|
<h4 class="modal-title">Add a Notification Agent</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<ul class="stacked-configs list-unstyled">
|
||||||
|
% for agent in available_notification_agents:
|
||||||
|
<li class="new_notification_agent" data-id="${agent['id']}">
|
||||||
|
<span>${agent['label']}</span>
|
||||||
|
</li>
|
||||||
|
% endfor
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<input type="button" class="btn btn-bright" data-dismiss="modal" value="Cancel">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="notifier-config-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="notifier-config-modal"></div>
|
||||||
<div id="notify-text-sub-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="notify-text-sub-modal">
|
<div id="notify-text-sub-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="notify-text-sub-modal">
|
||||||
<div class="modal-dialog" role="document">
|
<div class="modal-dialog" role="document">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
|
@ -2166,6 +1911,17 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getNotifiersTable() {
|
||||||
|
$.ajax({
|
||||||
|
url: 'get_notifiers_table',
|
||||||
|
cache: false,
|
||||||
|
async: true,
|
||||||
|
complete: function(xhr, status) {
|
||||||
|
$("#plexpy-notifiers-table").html(xhr.responseText);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
// Javascript to enable link to tab
|
// Javascript to enable link to tab
|
||||||
|
@ -2204,6 +1960,7 @@ $(document).ready(function() {
|
||||||
$("#http_hashed_password").val($("#http_hash_password").is(":checked") ? 1 : 0)
|
$("#http_hashed_password").val($("#http_hash_password").is(":checked") ? 1 : 0)
|
||||||
getConfigurationTable();
|
getConfigurationTable();
|
||||||
getSchedulerTable();
|
getSchedulerTable();
|
||||||
|
getNotifiersTable();
|
||||||
loadUpdateDistros();
|
loadUpdateDistros();
|
||||||
settingsChanged = false;
|
settingsChanged = false;
|
||||||
}
|
}
|
||||||
|
@ -2267,6 +2024,7 @@ $(document).ready(function() {
|
||||||
|
|
||||||
getConfigurationTable();
|
getConfigurationTable();
|
||||||
getSchedulerTable();
|
getSchedulerTable();
|
||||||
|
getNotifiersTable();
|
||||||
|
|
||||||
$('#changelog-modal-link').on('click', function (e) {
|
$('#changelog-modal-link').on('click', function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
@ -2452,39 +2210,6 @@ $(document).ready(function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Load notification agent config modal
|
|
||||||
$(".toggle-notification-config-modal").click(function() {
|
|
||||||
var agent_id = $(this).data('id');
|
|
||||||
$.ajax({
|
|
||||||
url: 'get_notification_agent_config',
|
|
||||||
data: { agent_id: agent_id },
|
|
||||||
cache: false,
|
|
||||||
async: true,
|
|
||||||
complete: function(xhr, status) {
|
|
||||||
$("#notification-config-modal").html(xhr.responseText);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Load notification triggers config modal
|
|
||||||
$(".toggle-notification-triggers-modal").click(function() {
|
|
||||||
var agent_id = $(this).data('id');
|
|
||||||
$.ajax({
|
|
||||||
url: 'get_notification_agent_triggers',
|
|
||||||
data: { agent_id: agent_id },
|
|
||||||
cache: false,
|
|
||||||
async: true,
|
|
||||||
complete: function(xhr, status) {
|
|
||||||
$("#notification-triggers-modal").html(xhr.responseText);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#osxnotifyregister').click(function () {
|
|
||||||
var osx_notify_app = $("#osx_notify_reg").val();
|
|
||||||
$.get("/osxnotifyregister", { 'app': osx_notify_app }, function (data) { showMsg("<div class='msg'><span class='fa fa-check'></span>" + data + "</div>", false, true, 3000); });
|
|
||||||
})
|
|
||||||
|
|
||||||
pms_version = false;
|
pms_version = false;
|
||||||
pms_logs_debug = false;
|
pms_logs_debug = false;
|
||||||
pms_logs = false;
|
pms_logs = false;
|
||||||
|
@ -2547,10 +2272,6 @@ $(document).ready(function() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var accordion_session = new Accordion($('#accordion-session'), false);
|
|
||||||
var accordion_timeline = new Accordion($('#accordion-timeline'), false);
|
|
||||||
var accordion_scripts = new Accordion($('#accordion-scripts'), false);
|
|
||||||
|
|
||||||
// Sortable home_sections
|
// Sortable home_sections
|
||||||
function set_home_sections() {
|
function set_home_sections() {
|
||||||
var home_sections = [];
|
var home_sections = [];
|
||||||
|
@ -2648,16 +2369,6 @@ $(document).ready(function() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// auto resizing textarea for custom notification message body
|
|
||||||
$('textarea[data-autoresize]').each(function() {
|
|
||||||
var offset = this.offsetHeight - this.clientHeight;
|
|
||||||
var resizeTextarea = function(el) {
|
|
||||||
$(el).css('height', 'auto').css('height', el.scrollHeight + offset);
|
|
||||||
};
|
|
||||||
$(this).on('focus keyup input', function() { resizeTextarea(this); }).removeAttr('data-autoresize');
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#notify_recently_added_grandparent").change(function () {
|
$("#notify_recently_added_grandparent").change(function () {
|
||||||
var c = this.checked ? '#eb8600' : '#737373';
|
var c = this.checked ? '#eb8600' : '#737373';
|
||||||
$('#notify_recently_added_grandparent_note').css('color', c);
|
$('#notify_recently_added_grandparent_note').css('color', c);
|
||||||
|
@ -2759,6 +2470,28 @@ $(document).ready(function() {
|
||||||
var distro = $("option:selected", this).data('distro')
|
var distro = $("option:selected", this).data('distro')
|
||||||
$('#pms_update_distro').val(distro)
|
$('#pms_update_distro').val(distro)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Add a new notification agent
|
||||||
|
$('.new_notification_agent').click(function () {
|
||||||
|
$.ajax({
|
||||||
|
url: 'add_notifier_config',
|
||||||
|
data: { agent_id: $(this).data('id') },
|
||||||
|
cache: false,
|
||||||
|
async: true,
|
||||||
|
complete: function (xhr, status) {
|
||||||
|
result = $.parseJSON(xhr.responseText);
|
||||||
|
msg = result.message;
|
||||||
|
if (result.result == 'success') {
|
||||||
|
showMsg('<i class="fa fa-check"></i> ' + msg, false, true, 5000)
|
||||||
|
} else {
|
||||||
|
showMsg('<i class="fa fa-times"></i> ' + msg, false, true, 5000, true)
|
||||||
|
}
|
||||||
|
$('#add-notifier-modal').modal('hide');
|
||||||
|
getNotifiersTable();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</%def>
|
</%def>
|
||||||
|
|
|
@ -462,6 +462,27 @@ def dbcheck():
|
||||||
'timestamp INTEGER, user_id INTEGER, user TEXT, user_group TEXT, ip_address TEXT, host TEXT, user_agent TEXT)'
|
'timestamp INTEGER, user_id INTEGER, user TEXT, user_group TEXT, ip_address TEXT, host TEXT, user_agent TEXT)'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# notifiers table :: This table keeps record of the notification agent settings
|
||||||
|
c_db.execute(
|
||||||
|
'CREATE TABLE IF NOT EXISTS notifiers (id INTEGER PRIMARY KEY AUTOINCREMENT, '
|
||||||
|
'agent_id INTEGER, agent_name TEXT, agent_label TEXT, friendly_name TEXT, notifier_config TEXT, '
|
||||||
|
'on_play INTEGER DEFAULT 0, on_stop INTEGER DEFAULT 0, on_pause INTEGER DEFAULT 0, '
|
||||||
|
'on_resume INTEGER DEFAULT 0, on_buffer INTEGER DEFAULT 0, on_watched INTEGER DEFAULT 0, '
|
||||||
|
'on_created INTEGER DEFAULT 0, on_extdown INTEGER DEFAULT 0, on_intdown INTEGER DEFAULT 0, '
|
||||||
|
'on_extup INTEGER DEFAULT 0, on_intup INTEGER DEFAULT 0, on_pmsupdate INTEGER DEFAULT 0, '
|
||||||
|
'on_concurrent INTEGER DEFAULT 0, on_newdevice INTEGER DEFAULT 0, '
|
||||||
|
'on_play_subject TEXT, on_stop_subject TEXT, on_pause_subject TEXT, '
|
||||||
|
'on_resume_subject TEXT, on_buffer_subject TEXT, on_watched_subject TEXT, '
|
||||||
|
'on_created_subject TEXT, on_extdown_subject TEXT, on_intdown_subject TEXT, '
|
||||||
|
'on_extup_subject TEXT, on_intup_subject TEXT, on_pmsupdate_subject TEXT, '
|
||||||
|
'on_concurrent_subject TEXT, on_newdevice_subject TEXT, '
|
||||||
|
'on_play_body TEXT, on_stop_body TEXT, on_pause_body TEXT, '
|
||||||
|
'on_resume_body TEXT, on_buffer_body TEXT, on_watched_body TEXT, '
|
||||||
|
'on_created_body TEXT, on_extdown_body TEXT, on_intdown_body TEXT, '
|
||||||
|
'on_extup_body TEXT, on_intup_body TEXT, on_pmsupdate_body TEXT, '
|
||||||
|
'on_concurrent_body TEXT, on_newdevice_body TEXT)'
|
||||||
|
)
|
||||||
|
|
||||||
# Upgrade sessions table from earlier versions
|
# Upgrade sessions table from earlier versions
|
||||||
try:
|
try:
|
||||||
c_db.execute('SELECT started FROM sessions')
|
c_db.execute('SELECT started FROM sessions')
|
||||||
|
|
2636
plexpy/notifiers.py
2636
plexpy/notifiers.py
File diff suppressed because it is too large
Load diff
|
@ -2843,46 +2843,183 @@ class WebInterface(object):
|
||||||
return {'result': 'error', 'message': 'GeoLite2 database uninstall failed.'}
|
return {'result': 'error', 'message': 'GeoLite2 database uninstall failed.'}
|
||||||
|
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
|
@cherrypy.tools.json_out()
|
||||||
@requireAuth(member_of("admin"))
|
@requireAuth(member_of("admin"))
|
||||||
def get_notification_agent_config(self, agent_id, **kwargs):
|
@addtoapi()
|
||||||
if agent_id.isdigit():
|
def get_notifiers(self, notify_action=None, **kwargs):
|
||||||
config = notifiers.get_notification_agent_config(agent_id=agent_id)
|
""" Get a list of configured notifiers.
|
||||||
agents = notifiers.available_notification_agents()
|
|
||||||
for agent in agents:
|
|
||||||
if int(agent_id) == agent['id']:
|
|
||||||
this_agent = agent
|
|
||||||
break
|
|
||||||
else:
|
|
||||||
this_agent = None
|
|
||||||
else:
|
|
||||||
return None
|
|
||||||
|
|
||||||
checkboxes = {'email_tls': checked(plexpy.CONFIG.EMAIL_TLS)}
|
```
|
||||||
|
Required parameters:
|
||||||
|
None
|
||||||
|
|
||||||
return serve_template(templatename="notification_config.html", title="Notification Configuration",
|
Optional parameters:
|
||||||
agent=this_agent, data=config, checkboxes=checkboxes)
|
notify_action (str): The notification action to filter out
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
json:
|
||||||
|
[{"id": 1,
|
||||||
|
"agent_id": 13,
|
||||||
|
"agent_name": "telegram",
|
||||||
|
"agent_label": "Telegram",
|
||||||
|
"friendly_name": "",
|
||||||
|
"actions": {"on_play": 0,
|
||||||
|
"on_stop": 0,
|
||||||
|
...
|
||||||
|
},
|
||||||
|
}
|
||||||
|
]
|
||||||
|
```
|
||||||
|
"""
|
||||||
|
result = notifiers.get_notifiers(notify_action=notify_action)
|
||||||
|
return result
|
||||||
|
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
@requireAuth(member_of("admin"))
|
@requireAuth(member_of("admin"))
|
||||||
def get_notification_agent_triggers(self, agent_id, **kwargs):
|
def get_notifiers_table(self, **kwargs):
|
||||||
if agent_id.isdigit():
|
result = notifiers.get_notifiers()
|
||||||
agents = notifiers.available_notification_agents()
|
return serve_template(templatename="notifiers_table.html", notifiers_list=result)
|
||||||
for agent in agents:
|
|
||||||
if int(agent_id) == agent['id']:
|
|
||||||
this_agent = agent
|
|
||||||
break
|
|
||||||
else:
|
|
||||||
this_agent = None
|
|
||||||
else:
|
|
||||||
return None
|
|
||||||
|
|
||||||
return serve_template(templatename="notification_triggers_modal.html", title="Notification Triggers",
|
@cherrypy.expose
|
||||||
data=this_agent)
|
@cherrypy.tools.json_out()
|
||||||
|
@requireAuth(member_of("admin"))
|
||||||
|
@addtoapi()
|
||||||
|
def delete_notifier(self, notifier_id=None, **kwargs):
|
||||||
|
""" Remove a notifier from the database.
|
||||||
|
|
||||||
|
```
|
||||||
|
Required parameters:
|
||||||
|
notifier_id (int): The notifier to delete
|
||||||
|
|
||||||
|
Optional parameters:
|
||||||
|
None
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
None
|
||||||
|
```
|
||||||
|
"""
|
||||||
|
result = notifiers.delete_notifier(notifier_id=notifier_id)
|
||||||
|
if result:
|
||||||
|
return {'result': 'success', 'message': 'Notifier deleted successfully.'}
|
||||||
|
else:
|
||||||
|
return {'result': 'error', 'message': 'Failed to delete notifier.'}
|
||||||
|
|
||||||
|
@cherrypy.expose
|
||||||
|
@cherrypy.tools.json_out()
|
||||||
|
@requireAuth(member_of("admin"))
|
||||||
|
@addtoapi()
|
||||||
|
def get_notifier_config(self, notifier_id=None, **kwargs):
|
||||||
|
""" Get the configuration for an existing notification agent.
|
||||||
|
|
||||||
|
```
|
||||||
|
Required parameters:
|
||||||
|
notifier_id (int): The notifier config to retrieve
|
||||||
|
|
||||||
|
Optional parameters:
|
||||||
|
None
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
json:
|
||||||
|
{"id": 1,
|
||||||
|
"agent_id": 13,
|
||||||
|
"agent_name": "telegram",
|
||||||
|
"agent_label": "Telegram",
|
||||||
|
"friendly_name": "",
|
||||||
|
"config": {"incl_poster": 0,
|
||||||
|
"html_support": 1,
|
||||||
|
"chat_id": "123456",
|
||||||
|
"bot_token": "13456789:fio9040NNo04jLEp-4S",
|
||||||
|
"incl_subject": 1,
|
||||||
|
"disable_web_preview": 0
|
||||||
|
},
|
||||||
|
"notify_text": {"on_play": {"subject": "...",
|
||||||
|
"body": "..."
|
||||||
|
}
|
||||||
|
"on_stop": {"subject": "...",
|
||||||
|
"body": "..."
|
||||||
|
}
|
||||||
|
...
|
||||||
|
},
|
||||||
|
|
||||||
|
"actions": {"on_play": 0,
|
||||||
|
"on_stop": 0,
|
||||||
|
...
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
"""
|
||||||
|
result = notifiers.get_notifier_config(notifier_id=notifier_id)
|
||||||
|
return result
|
||||||
|
|
||||||
|
@cherrypy.expose
|
||||||
|
@requireAuth(member_of("admin"))
|
||||||
|
def get_notifier_config_modal(self, notifier_id=None, **kwargs):
|
||||||
|
result = notifiers.get_notifier_config(notifier_id=notifier_id)
|
||||||
|
return serve_template(templatename="notifier_config.html", notifier=result)
|
||||||
|
|
||||||
|
@cherrypy.expose
|
||||||
|
@cherrypy.tools.json_out()
|
||||||
|
@requireAuth(member_of("admin"))
|
||||||
|
@addtoapi()
|
||||||
|
def add_notifier_config(self, agent_id=None, **kwargs):
|
||||||
|
""" Add a new notification agent.
|
||||||
|
|
||||||
|
```
|
||||||
|
Required parameters:
|
||||||
|
agent_id (int): The notification agent to add
|
||||||
|
|
||||||
|
Optional parameters:
|
||||||
|
None
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
None
|
||||||
|
```
|
||||||
|
"""
|
||||||
|
result = notifiers.add_notifier_config(agent_id=agent_id, **kwargs)
|
||||||
|
|
||||||
|
if result:
|
||||||
|
return {'result': 'success', 'message': 'Added notification agent.'}
|
||||||
|
else:
|
||||||
|
return {'result': 'error', 'message': 'Failed to add notification agent.'}
|
||||||
|
|
||||||
|
@cherrypy.expose
|
||||||
|
@cherrypy.tools.json_out()
|
||||||
|
@requireAuth(member_of("admin"))
|
||||||
|
@addtoapi()
|
||||||
|
def set_notifier_config(self, notifier_id=None, agent_id=None, **kwargs):
|
||||||
|
""" Configure an exisitng notificaiton agent.
|
||||||
|
|
||||||
|
```
|
||||||
|
Required parameters:
|
||||||
|
notifier_id (int): The notifier config to update
|
||||||
|
agent_id (int): The agent of the notifier
|
||||||
|
|
||||||
|
Optional parameters:
|
||||||
|
Pass all the config options for the agent with the agent prefix:
|
||||||
|
e.g. For Telegram: telegram_bot_token
|
||||||
|
telegram_chat_id
|
||||||
|
disable_web_preview
|
||||||
|
html_support
|
||||||
|
incl_poster
|
||||||
|
incl_subject
|
||||||
|
Notify actions with 'trigger_' prefix (trigger_on_play, trigger_on_stop, etc.),
|
||||||
|
and notify text with 'text_' prefix (text_on_play_subject, text_on_play_body, etc.) are optional.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
None
|
||||||
|
```
|
||||||
|
"""
|
||||||
|
result = notifiers.set_notifier_config(notifier_id=notifier_id, agent_id=agent_id, **kwargs)
|
||||||
|
|
||||||
|
if result:
|
||||||
|
return {'result': 'success', 'message': 'Added notification agent.'}
|
||||||
|
else:
|
||||||
|
return {'result': 'error', 'message': 'Failed to add notification agent.'}
|
||||||
|
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
@requireAuth(member_of("admin"))
|
@requireAuth(member_of("admin"))
|
||||||
@addtoapi("notify")
|
@addtoapi("notify")
|
||||||
def send_notification(self, agent_id=None, subject='PlexPy', body='Test notification', notify_action=None, **kwargs):
|
def send_notification(self, notifier_id=None, subject='PlexPy', body='Test notification', notify_action='', **kwargs):
|
||||||
""" Send a notification using PlexPy.
|
""" Send a notification using PlexPy.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -2921,33 +3058,31 @@ class WebInterface(object):
|
||||||
|
|
||||||
test = 'test ' if notify_action == 'test' else ''
|
test = 'test ' if notify_action == 'test' else ''
|
||||||
|
|
||||||
if agent_id.isdigit():
|
if notifier_id:
|
||||||
agents = notifiers.available_notification_agents()
|
notifier = notifiers.get_notifier_config(notifier_id=notifier_id)
|
||||||
for agent in agents:
|
|
||||||
if int(agent_id) == agent['id']:
|
|
||||||
this_agent = agent
|
|
||||||
break
|
|
||||||
else:
|
|
||||||
this_agent = None
|
|
||||||
|
|
||||||
if this_agent:
|
if notifier:
|
||||||
logger.debug(u"Sending %s%s notification." % (test, this_agent['name']))
|
logger.debug(u"Sending %s%s notification." % (test, notifier['agent_name']))
|
||||||
if notifiers.send_notification(this_agent['id'], subject, body, notify_action, **kwargs):
|
if notifiers.send_notification(notifier_id=notifier_id,
|
||||||
|
subject=subject,
|
||||||
|
body=body,
|
||||||
|
notify_action=notify_action,
|
||||||
|
**kwargs):
|
||||||
return "Notification sent."
|
return "Notification sent."
|
||||||
else:
|
else:
|
||||||
return "Notification failed."
|
return "Notification failed."
|
||||||
else:
|
else:
|
||||||
logger.debug(u"Unable to send %snotification, invalid notification agent id %s." % (test, agent_id))
|
logger.debug(u"Unable to send %snotification, invalid notifier_id %s." % (test, notifier_id))
|
||||||
return "Invalid notification agent id %s." % agent_id
|
return "Invalid notifier id %s." % notifier_id
|
||||||
else:
|
else:
|
||||||
logger.debug(u"Unable to send %snotification, no notification agent id received." % test)
|
logger.debug(u"Unable to send %snotification, no notifier_id received." % test)
|
||||||
return "No notification agent id received."
|
return "No notifier id received."
|
||||||
|
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
@cherrypy.tools.json_out()
|
@cherrypy.tools.json_out()
|
||||||
@requireAuth(member_of("admin"))
|
@requireAuth(member_of("admin"))
|
||||||
def get_browser_notifications(self, **kwargs):
|
def get_browser_notifications(self, **kwargs):
|
||||||
browser = notifiers.Browser()
|
browser = notifiers.BROWSER()
|
||||||
result = browser.get_notifications()
|
result = browser.get_notifications()
|
||||||
|
|
||||||
if result:
|
if result:
|
||||||
|
@ -2964,14 +3099,14 @@ class WebInterface(object):
|
||||||
@requireAuth(member_of("admin"))
|
@requireAuth(member_of("admin"))
|
||||||
def facebookStep1(self, **kwargs):
|
def facebookStep1(self, **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.FacebookNotifier()
|
facebook = notifiers.FACEBOOK()
|
||||||
return facebook._get_authorization()
|
return facebook._get_authorization()
|
||||||
|
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
@requireAuth(member_of("admin"))
|
@requireAuth(member_of("admin"))
|
||||||
def facebookStep2(self, code, **kwargs):
|
def facebookStep2(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.FacebookNotifier()
|
facebook = notifiers.FACEBOOK()
|
||||||
result = facebook._get_credentials(code)
|
result = facebook._get_credentials(code)
|
||||||
# logger.info(u"result: " + str(result))
|
# logger.info(u"result: " + str(result))
|
||||||
if result:
|
if result:
|
||||||
|
@ -2987,8 +3122,8 @@ class WebInterface(object):
|
||||||
|
|
||||||
result, msg = osxnotify.registerapp(app)
|
result, msg = osxnotify.registerapp(app)
|
||||||
if result:
|
if result:
|
||||||
osx_notify = notifiers.OSX_NOTIFY()
|
osx_notify = notifiers.OSX()
|
||||||
osx_notify.notify('Registered', result, 'Success :-)')
|
osx_notify.notify(subject='Registered', body='Success :-)', subtitle=result)
|
||||||
# logger.info(u"Registered %s, to re-register a different app, delete this app first" % result)
|
# logger.info(u"Registered %s, to re-register a different app, delete this app first" % result)
|
||||||
else:
|
else:
|
||||||
logger.warn(msg)
|
logger.warn(msg)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue