|
|
|
@ -2,10 +2,23 @@
|
|
|
|
|
|
|
|
|
|
{% block title %}General - Bazarr{% endblock %}
|
|
|
|
|
|
|
|
|
|
{% block page_head %}
|
|
|
|
|
<style>
|
|
|
|
|
.restart {
|
|
|
|
|
color: orange;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
{% endblock page_head %}
|
|
|
|
|
|
|
|
|
|
{% block bcleft %}
|
|
|
|
|
<div class="">
|
|
|
|
|
<button class="btn btn-outline" id="save_button">
|
|
|
|
|
<div><i class="fas fa-save align-top text-themecolor text-center font-20" aria-hidden="true"></i></div>
|
|
|
|
|
<div>
|
|
|
|
|
<span class="fa-stack">
|
|
|
|
|
<i class="fas fa-save fa-stack-2x align-top text-themecolor text-center font-20" aria-hidden="true"></i>
|
|
|
|
|
<i id="save_button_checkmark" class="fas fa-check fa-stack-2x" style="color:green;"></i>
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="align-bottom text-themecolor small text-center">Save</div>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
@ -17,32 +30,38 @@
|
|
|
|
|
|
|
|
|
|
{% block body %}
|
|
|
|
|
<div class="container-fluid" style="padding-top: 3em;">
|
|
|
|
|
<form class="form" name="settings_form" id="settings_form">
|
|
|
|
|
<h4>Host</h4>
|
|
|
|
|
<hr/>
|
|
|
|
|
<div class="row">
|
|
|
|
|
<div class="col-sm-2 text-right">
|
|
|
|
|
<b>Listening IP Address</b>
|
|
|
|
|
<b>Bind Address</b>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-sm-4">
|
|
|
|
|
<input type="text" class="form-control" id="settings-general-ip" name="settings-general-ip" value="{{settings.general.ip}}">
|
|
|
|
|
<label for="settings-general-ip">Valid IP4 address or '0.0.0.0' for all interfaces</label><br>
|
|
|
|
|
<label class="restart">Requires restart to take effect</label>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<br>
|
|
|
|
|
<div class="row">
|
|
|
|
|
<div class="col-sm-2 text-right">
|
|
|
|
|
<b>Listening Port</b>
|
|
|
|
|
<b>Port Number</b>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-sm-4">
|
|
|
|
|
<input type="text" class="form-control" id="settings-general-port" name="settings-general-port" value="{{settings.general.port}}">
|
|
|
|
|
<input type="text" class="form-control" id="settings-general-port" name="settings-general-port" value="{{settings.general.port}}"><br>
|
|
|
|
|
<label class="restart">Requires restart to take effect</label>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<br>
|
|
|
|
|
<div class="row">
|
|
|
|
|
<div class="col-sm-2 text-right">
|
|
|
|
|
<b>Base URL</b>
|
|
|
|
|
<b>URL Base</b>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-sm-4">
|
|
|
|
|
<input type="text" class="form-control" id="settings-general-base_url" name="settings-general-base_url" value="{{settings.general.base_url}}">
|
|
|
|
|
<label for="settings-general-base_url">For reverse proxy support, default is '/'</label><br>
|
|
|
|
|
<label class="restart">Requires restart to take effect</label>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<br>
|
|
|
|
@ -59,6 +78,8 @@
|
|
|
|
|
<option value="Basic">Basic</option>
|
|
|
|
|
<option value="Form">Form</option>
|
|
|
|
|
</select>
|
|
|
|
|
<label for="settings-auth-type">Require Username and Password to access Bazarr</label><br>
|
|
|
|
|
<label class="restart">Requires restart to take effect</label>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div id="authentication_div">
|
|
|
|
@ -85,8 +106,11 @@
|
|
|
|
|
<div class="col-sm-2 text-right">
|
|
|
|
|
<b>API Key</b>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-sm-4">
|
|
|
|
|
<input type="text" class="form-control" id="settings-auth-apikey" name="settings-auth-apikey" value="{{settings.auth.apikey}}">
|
|
|
|
|
<div class="input-group col-sm-4">
|
|
|
|
|
<input type="text" class="form-control" id="settings-auth-apikey" name="settings-auth-apikey" readonly value="{{settings.auth.apikey}}">
|
|
|
|
|
<div class="input-group-append">
|
|
|
|
|
<button class="btn btn-danger" type="button" onclick="generate_apikey()"><i class="fas fa-sync"></i></button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<br>
|
|
|
|
@ -103,7 +127,8 @@
|
|
|
|
|
<option value="http">HTTP(S)</option>
|
|
|
|
|
<option value="socks4">Socks4</option>
|
|
|
|
|
<option value="socks5">Socks5</option>
|
|
|
|
|
</select>
|
|
|
|
|
</select><br>
|
|
|
|
|
<label class="restart">Requires restart to take effect</label>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div id="proxy_div">
|
|
|
|
@ -204,6 +229,7 @@
|
|
|
|
|
</div>
|
|
|
|
|
<br>
|
|
|
|
|
|
|
|
|
|
<div id="update_div">
|
|
|
|
|
<h4>Updates</h4>
|
|
|
|
|
<hr/>
|
|
|
|
|
<div class="row">
|
|
|
|
@ -240,12 +266,84 @@
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</form>
|
|
|
|
|
</div>
|
|
|
|
|
{% endblock body %}
|
|
|
|
|
|
|
|
|
|
{% block tail %}
|
|
|
|
|
<script>
|
|
|
|
|
$(document).ready(function () {
|
|
|
|
|
// Hide checkmark over save button
|
|
|
|
|
$('#save_button_checkmark').hide();
|
|
|
|
|
|
|
|
|
|
// Hide update_div if args.no-update
|
|
|
|
|
{% if args.no_update %}
|
|
|
|
|
$('#update_div').hide()
|
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
|
|
// Hide *_div on Select input changed to None
|
|
|
|
|
$('#settings-auth-type').on('change', function() {
|
|
|
|
|
if ($(this).val() === 'None') {
|
|
|
|
|
$('#authentication_div').hide();
|
|
|
|
|
} else {
|
|
|
|
|
$('#authentication_div').show();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$('#settings-proxy-type').on('change', function() {
|
|
|
|
|
if ($(this).val() === 'None') {
|
|
|
|
|
$('#proxy_div').hide();
|
|
|
|
|
} else {
|
|
|
|
|
$('#proxy_div').show();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Set Select input values
|
|
|
|
|
$('#settings-auth-type').val('{{settings.auth.type}}').trigger('change');
|
|
|
|
|
$('#settings-proxy-type').val('{{settings.proxy.type}}').trigger('change');
|
|
|
|
|
$('#settings-general-page_size').val('{{settings.general.page_size}}');
|
|
|
|
|
$('#settings-general-branch').val('{{settings.general.branch}}');
|
|
|
|
|
|
|
|
|
|
// Set Checkbox input values
|
|
|
|
|
$('#settings-general-debug').prop('checked', {{'true' if settings.general.getboolean('debug')}});
|
|
|
|
|
$('#settings-analytics-enabled').prop('checked', {{'true' if settings.analytics.getboolean('enabled')}});
|
|
|
|
|
$('#settings-general-auto_update').prop('checked', {{'true' if settings.general.getboolean('auto_update')}});
|
|
|
|
|
$('#settings-general-update_restart').prop('checked', {{'true' if settings.general.getboolean('update_restart')}});
|
|
|
|
|
|
|
|
|
|
$('#save_button').on('click', function() {
|
|
|
|
|
var formdata = new FormData(document.getElementById("settings_form"));
|
|
|
|
|
|
|
|
|
|
// Make sure all checkbox input are sent with true/false value
|
|
|
|
|
$('input[type=checkbox]').each(function () {
|
|
|
|
|
formdata.set($(this).prop('id'), $(this).prop('checked'));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: "{{ url_for('api.savesettings') }}",
|
|
|
|
|
data: formdata,
|
|
|
|
|
processData: false,
|
|
|
|
|
contentType: false,
|
|
|
|
|
type: 'POST',
|
|
|
|
|
complete: function () {
|
|
|
|
|
$('#save_button_checkmark').show();
|
|
|
|
|
setTimeout(
|
|
|
|
|
function()
|
|
|
|
|
{
|
|
|
|
|
$('#save_button_checkmark').hide();
|
|
|
|
|
}, 2000);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
function generate_apikey() {
|
|
|
|
|
var result = '';
|
|
|
|
|
var characters = 'abcdef0123456789';
|
|
|
|
|
var charactersLength = characters.length;
|
|
|
|
|
for ( var i = 0; i < 32; i++ ) {
|
|
|
|
|
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
|
|
|
|
}
|
|
|
|
|
$( "#settings-auth-apikey" ).val( result );
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
{% endblock tail %}
|
|
|
|
|