Notification test button

pull/292/head
Halali 6 years ago
parent bcf5650454
commit 18ea5442de

@ -62,6 +62,7 @@ import hashlib
import time import time
import urllib import urllib
from six import text_type from six import text_type
import apprise
from get_languages import load_language_in_db, language_from_alpha3 from get_languages import load_language_in_db, language_from_alpha3
from get_providers import load_providers, get_providers, get_providers_auth from get_providers import load_providers, get_providers, get_providers_auth
@ -1729,6 +1730,20 @@ def test_url(protocol, url):
else: else:
return dict(status=True, version=result) return dict(status=True, version=result)
@route(base_url + 'test_notification/<provider>', method='GET')
@custom_auth_basic(check_credentials)
def test_notification(provider):
print provider
apobj = apprise.Apprise()
apobj.add(provider)
apobj.notify(
title='Bazarr test notification',
body=('Test notification')
)
import warnings import warnings
# Mute DeprecationWarning # Mute DeprecationWarning
warnings.simplefilter("ignore", DeprecationWarning) warnings.simplefilter("ignore", DeprecationWarning)

@ -1348,6 +1348,7 @@
<div class='field'> <div class='field'>
<div id="settings_notifier_{{notifier[0]}}_url_div" class="ui fluid input"> <div id="settings_notifier_{{notifier[0]}}_url_div" class="ui fluid input">
<input name="settings_notifier_{{notifier[0]}}_url" type="text" value="{{notifier[1] if notifier[1] != None else ''}}"> <input name="settings_notifier_{{notifier[0]}}_url" type="text" value="{{notifier[1] if notifier[1] != None else ''}}">
<div id="test_notification" class="ui blue button" data-notification="{{notifier[1]}}">Test Notification</div>
</div> </div>
</div> </div>
</div> </div>
@ -1364,6 +1365,18 @@
<script> <script>
$('#test_notification').click(function() {
$.ajax({
url: "{{base_url}}test_notification/" + $(this).data("notification"),
beforeSend: function () {
$('#loader').addClass('active');
},
complete: function () {
$('#loader').removeClass('active');
},
cache: false
});
});
% from get_argv import no_update % from get_argv import no_update
% if no_update is True: % if no_update is True:

@ -380,7 +380,7 @@
.done(function(){ .done(function(){
setTimeout(function(){ setInterval(ping, 2000); },8000); setTimeout(function(){ setInterval(ping, 2000); },8000);
}); });
}) });
% from get_settings import get_general_settings % from get_settings import get_general_settings
% ip = get_general_settings()[0] % ip = get_general_settings()[0]

Loading…
Cancel
Save