mirror of
https://github.com/morpheus65535/bazarr
synced 2024-12-25 01:02:19 +00:00
WIP
This commit is contained in:
parent
7490e73a10
commit
da7addac4e
2 changed files with 21 additions and 2 deletions
|
@ -83,7 +83,6 @@ def check_credentials(user, pw):
|
||||||
def login_required(f):
|
def login_required(f):
|
||||||
@wraps(f)
|
@wraps(f)
|
||||||
def wrap(*args, **kwargs):
|
def wrap(*args, **kwargs):
|
||||||
test = request
|
|
||||||
if settings.auth.type == 'basic':
|
if settings.auth.type == 'basic':
|
||||||
auth = request.authorization
|
auth = request.authorization
|
||||||
if not (auth and check_credentials(request.authorization.username, request.authorization.password)):
|
if not (auth and check_credentials(request.authorization.username, request.authorization.password)):
|
||||||
|
@ -151,7 +150,6 @@ def post_get(name, default=''):
|
||||||
@app.route("/logout/")
|
@app.route("/logout/")
|
||||||
@login_required
|
@login_required
|
||||||
def logout():
|
def logout():
|
||||||
test = settings.auth.type
|
|
||||||
if settings.auth.type == 'basic':
|
if settings.auth.type == 'basic':
|
||||||
return abort(401)
|
return abort(401)
|
||||||
elif settings.auth.type == 'form':
|
elif settings.auth.type == 'form':
|
||||||
|
@ -484,6 +482,7 @@ def test_url(protocol, url):
|
||||||
return dict(status=False, error=result.raise_for_status())
|
return dict(status=False, error=result.raise_for_status())
|
||||||
|
|
||||||
|
|
||||||
|
@app.route('/test_notification', methods=['GET'])
|
||||||
@app.route('/test_notification/<protocol>/<path:provider>', methods=['GET'])
|
@app.route('/test_notification/<protocol>/<path:provider>', methods=['GET'])
|
||||||
@login_required
|
@login_required
|
||||||
def test_notification(protocol, provider):
|
def test_notification(protocol, provider):
|
||||||
|
@ -497,6 +496,8 @@ def test_notification(protocol, provider):
|
||||||
body='Test notification'
|
body='Test notification'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
return '', 200
|
||||||
|
|
||||||
|
|
||||||
# Mute DeprecationWarning
|
# Mute DeprecationWarning
|
||||||
warnings.simplefilter("ignore", DeprecationWarning)
|
warnings.simplefilter("ignore", DeprecationWarning)
|
||||||
|
|
|
@ -95,6 +95,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<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="submit" id="edit_save_button" class="btn btn-info">Ok</button>
|
||||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||||
</div>
|
</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
|
// monitor changes to the settings_form
|
||||||
$('#settings_form').on('change', function() {
|
$('#settings_form').on('change', function() {
|
||||||
form_changed = true;
|
form_changed = true;
|
||||||
|
|
Loading…
Reference in a new issue