1
0
Fork 0
mirror of https://github.com/morpheus65535/bazarr synced 2024-12-24 08:43:01 +00:00
This commit is contained in:
Louis Vézina 2020-05-08 22:23:01 -04:00
parent 7490e73a10
commit da7addac4e
2 changed files with 21 additions and 2 deletions

View file

@ -83,7 +83,6 @@ def check_credentials(user, pw):
def login_required(f):
@wraps(f)
def wrap(*args, **kwargs):
test = request
if settings.auth.type == 'basic':
auth = request.authorization
if not (auth and check_credentials(request.authorization.username, request.authorization.password)):
@ -151,7 +150,6 @@ def post_get(name, default=''):
@app.route("/logout/")
@login_required
def logout():
test = settings.auth.type
if settings.auth.type == 'basic':
return abort(401)
elif settings.auth.type == 'form':
@ -484,6 +482,7 @@ def test_url(protocol, url):
return dict(status=False, error=result.raise_for_status())
@app.route('/test_notification', methods=['GET'])
@app.route('/test_notification/<protocol>/<path:provider>', methods=['GET'])
@login_required
def test_notification(protocol, provider):
@ -497,6 +496,8 @@ def test_notification(protocol, provider):
body='Test notification'
)
return '', 200
# Mute DeprecationWarning
warnings.simplefilter("ignore", DeprecationWarning)

View file

@ -95,6 +95,7 @@
</div>
</div>
<div class="modal-footer">
<button type="button" id="test_button" class="btn btn-secondary">Test</button>
<button type="submit" id="edit_save_button" class="btn btn-info">Ok</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
</div>
@ -212,6 +213,23 @@
});
});
$('#test_button').on('click', function() {
const url_field = $('#notification_provider_url').val();
const url_protocol = url_field.split(':')[0];
const url_string = url_field.split('://')[1];
$.ajax({
url: "{{ url_for('test_notification') }}/" + url_protocol + "/" + encodeURIComponent(url_string),
beforeSend: function () {
$('#loader').addClass('active');
},
complete: function () {
$('#loader').removeClass('active');
},
cache: false
});
});
// monitor changes to the settings_form
$('#settings_form').on('change', function() {
form_changed = true;