You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
bazarr/views/settingsgeneral.html

406 lines
18 KiB

5 years ago
{% extends '_main.html' %}
{% block title %}General - Bazarr{% endblock %}
5 years ago
{% block page_head %}
5 years ago
5 years ago
{% endblock page_head %}
5 years ago
{% block bcleft %}
<div class="">
<button class="btn btn-outline" id="save_button">
5 years ago
<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>
5 years ago
<div class="align-bottom text-themecolor small text-center">Save</div>
</button>
</div>
{% endblock bcleft %}
{% block bcright %}
{% endblock bcright %}
{% block body %}
<div class="container-fluid" style="padding-top: 3em;">
5 years ago
<form class="form" name="settings_form" id="settings_form">
<h4>Host</h4>
<hr/>
5 years ago
<div class="row">
5 years ago
<div class="col-sm-3 text-right">
5 years ago
<b>Bind Address</b>
5 years ago
</div>
<div class="col-sm-4">
5 years ago
<input type="text" class="form-control restart-required" id="settings-general-ip" name="settings-general-ip" value="{{settings.general.ip}}">
5 years ago
<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>
5 years ago
</div>
</div>
<br>
<div class="row">
5 years ago
<div class="col-sm-3 text-right">
5 years ago
<b>Port Number</b>
5 years ago
</div>
<div class="col-sm-4">
5 years ago
<input type="text" class="form-control restart-required" id="settings-general-port" name="settings-general-port" value="{{settings.general.port}}"><br>
5 years ago
<label class="restart">Requires restart to take effect</label>
5 years ago
</div>
</div>
<br>
5 years ago
<div class="row">
5 years ago
<div class="col-sm-3 text-right">
5 years ago
<b>URL Base</b>
</div>
<div class="col-sm-4">
5 years ago
<input type="text" class="form-control restart-required" id="settings-general-base_url" name="settings-general-base_url" value="{{settings.general.base_url}}">
5 years ago
<label for="settings-general-base_url">For reverse proxy support, default is '/'</label><br>
<label class="restart">Requires restart to take effect</label>
</div>
5 years ago
</div>
5 years ago
<br>
<h4>Security</h4>
<hr/>
<div class="row">
5 years ago
<div class="col-sm-3 text-right">
5 years ago
<b>Authentication</b>
</div>
<div class="form-group col-sm-4">
5 years ago
<select class="form-control selectpicker" id="settings-auth-type" name="settings-auth-type">
5 years ago
<option value="None">None</option>
5 years ago
<option value="basic">Basic</option>
<option value="form">Form</option>
5 years ago
</select>
<label for="settings-auth-type">Require Username and Password to access Bazarr</label><br>
</div>
5 years ago
</div>
5 years ago
<div id="authentication_div">
<div class="row">
5 years ago
<div class="col-sm-3 text-right">
5 years ago
<b>Username</b>
</div>
<div class="col-sm-4">
<input type="text" class="form-control" id="settings-auth-username" name="settings-auth-username" value="{{settings.auth.username}}">
</div>
</div>
<br>
<div class="row">
5 years ago
<div class="col-sm-3 text-right">
5 years ago
<b>Password</b>
</div>
<div class="col-sm-4">
<input type="password" class="form-control" id="settings-auth-password" name="settings-auth-password" value="{{settings.auth.password}}">
</div>
</div>
<br>
5 years ago
</div>
<div class="row">
5 years ago
<div class="col-sm-3 text-right">
5 years ago
<b>API Key</b>
5 years ago
</div>
5 years ago
<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>
5 years ago
</div>
</div>
<br>
5 years ago
<h4>Proxy</h4>
<hr/>
5 years ago
<div class="row">
5 years ago
<div class="col-sm-3 text-right">
5 years ago
<b>Type</b>
5 years ago
</div>
5 years ago
<div class="form-group col-sm-4">
5 years ago
<select class="form-control selectpicker" id="settings-proxy-type" name="settings-proxy-type">
5 years ago
<option value="None">None</option>
<option value="http">HTTP(S)</option>
<option value="socks4">Socks4</option>
<option value="socks5">Socks5</option>
</select><br>
5 years ago
</div>
</div>
5 years ago
<div id="proxy_div">
<div class="row">
5 years ago
<div class="col-sm-3 text-right">
5 years ago
<b>Hostname</b>
</div>
<div class="col-sm-4">
<input type="text" class="form-control" id="settings-proxy-url" name="settings-proxy-url" value="{{settings.proxy.url}}">
</div>
</div>
<br>
<div class="row">
5 years ago
<div class="col-sm-3 text-right">
5 years ago
<b>Port</b>
</div>
<div class="col-sm-4">
<input type="text" class="form-control" id="settings-proxy-port" name="settings-proxy-port" value="{{settings.proxy.port}}">
</div>
</div>
<br>
<div class="row">
5 years ago
<div class="col-sm-3 text-right">
5 years ago
<b>Username</b>
</div>
<div class="col-sm-4">
<input type="text" class="form-control" id="settings-proxy-username" name="settings-proxy-username" value="{{settings.proxy.username}}">
5 years ago
<label for="settings-proxy-username">You only need to enter a username and password if one is required. Leave them blank otherwise.</label>
5 years ago
</div>
</div>
<br>
<div class="row">
5 years ago
<div class="col-sm-3 text-right">
5 years ago
<b>Password</b>
</div>
<div class="col-sm-4">
<input type="password" class="form-control" id="settings-proxy-password" name="settings-proxy-password" value="{{settings.proxy.password}}">
5 years ago
<label for="settings-proxy-password">You only need to enter a username and password if one is required. Leave them blank otherwise.</label>
5 years ago
</div>
</div>
<br>
<div class="row">
5 years ago
<div class="col-sm-3 text-right">
5 years ago
<b>Ignored Addresses</b>
</div>
<div class="col-sm-4">
<input type="text" class="form-control" id="settings-proxy-exclude" name="settings-proxy-exclude" value="{{settings.proxy.exclude}}">
5 years ago
<label for="settings-proxy-exclude">Use ',' as a separator, and '*.' as a wildcard for subdomains</label>
5 years ago
</div>
</div>
<br>
</div>
<h4>UI</h4>
<hr/>
5 years ago
<div class="row">
5 years ago
<div class="col-sm-3 text-right">
5 years ago
<b>Page Size</b>
5 years ago
</div>
5 years ago
<div class="form-group col-sm-4">
5 years ago
<select class="form-control selectpicker" id="settings-general-page_size" name="settings-general-page_size">
5 years ago
<option value="-1">Unlimited</option>
<option value="25">25</option>
<option value="50">50</option>
<option value="100">100</option>
<option value="250">250</option>
<option value="500">500</option>
<option value="1000">1000</option>
</select>
5 years ago
</div>
</div>
<div class="row">
5 years ago
<div class="col-sm-3 text-right">
<b>Page Size Manual Search</b>
</div>
<div class="form-group col-sm-4">
<select class="form-control selectpicker" id="settings-general-page_size_manual_search" name="settings-general-page_size_manual_search">
<option value="5">5</option>
<option value="10">10</option>
<option value="15">15</option>
<option value="20">20</option>
<option value="25">25</option>
</select>
</div>
</div>
5 years ago
<br>
5 years ago
<h4>Logging</h4>
<hr/>
5 years ago
<div class="row">
5 years ago
<div class="col-sm-3 text-right">
5 years ago
<b>Debug</b>
5 years ago
</div>
5 years ago
<div class="form-group col-sm-8">
5 years ago
<label class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="settings-general-debug" name="settings-general-debug">
<span class="custom-control-label" for="settings-general-debug"></span>
</label>
5 years ago
<label>Debug logging should only be enabled temporarily</label>
5 years ago
</div>
</div>
<br>
5 years ago
<h4>Analytics</h4>
<hr/>
5 years ago
<div class="row">
5 years ago
<div class="col-sm-3 text-right">
5 years ago
<b>Enabled</b>
5 years ago
</div>
5 years ago
<div class="form-group col-sm-8">
5 years ago
<label class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="settings-analytics-enabled" name="settings-analytics-enabled">
<span class="custom-control-label" for="settings-analytics-enabled"></span>
</label>
5 years ago
<label>Send anonymous usage information, nothing that can identify you. This includes information on which providers you use, what languages you search for, Bazarr, Python, Sonarr, Radarr and what OS version you are using. We will use this information to prioritize features and bug fixes. Please, keep this enabled as this is the only way we have to better understand how you use Bazarr.</label>
5 years ago
</div>
</div>
<br>
5 years ago
<div id="update_div">
<h4>Updates</h4>
<hr/>
<div class="row">
5 years ago
<div class="col-sm-3 text-right">
5 years ago
<b>Branch</b>
</div>
<div class="form-group col-sm-4">
5 years ago
<select class="form-control selectpicker" id="settings-general-branch" name="settings-general-branch">
5 years ago
<option value="master">master</option>
<option value="development">development</option>
</select>
5 years ago
<label>Branch used by external update mechanism</label>
5 years ago
</div>
</div>
<div class="row">
5 years ago
<div class="col-sm-3 text-right">
5 years ago
<b>Automatic</b>
</div>
5 years ago
<div class="form-group col-sm-8">
5 years ago
<label class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="settings-general-auto_update" name="settings-general-auto_update">
<span class="custom-control-label" for="settings-general-auto_update"></span>
</label>
5 years ago
<label>Automatically download and install updates. You will still be able to install from System: Tasks</label>
5 years ago
</div>
</div>
5 years ago
</div>
5 years ago
</form>
5 years ago
</div>
5 years ago
<div id="restart_modal" class="modal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Restart Bazarr</h5><br>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
Bazarr requires a restart to apply changes, do you want to restart now?
</div>
<div class="modal-footer">
<button type="submit" id="restart_button" class="btn btn-info">Restart Now</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">I'll restart later</button>
</div>
</div>
</div>
</div>
5 years ago
{% endblock body %}
{% block tail %}
<script>
$(document).ready(function () {
5 years ago
var restart_required = false;
5 years ago
// Show warning if there's unsaved changes in the settings_form
var form_changed = false;
$(window).on('beforeunload', function() {
if (form_changed) {
return "";
}
});
5 years ago
// Hide checkmark over save button
$('#save_button_checkmark').hide();
5 years ago
$('#save_button').prop('disabled', true).css('cursor', 'not-allowed');
5 years ago
// Hide update_div if args.no-update
{% if args.no_update %}
5 years ago
$('#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-page_size_manual_search').val('{{settings.general.page_size_manual_search}}');
5 years ago
$('#settings-general-branch').val('{{settings.general.branch}}');
$('.selectpicker').selectpicker('refresh')
5 years ago
// Set Checkbox input values
5 years ago
$('#settings-general-debug').prop('checked', {{'true' if settings.general.getboolean('debug') else 'false'}});
$('#settings-analytics-enabled').prop('checked', {{'true' if settings.analytics.getboolean('enabled') else 'false'}});
$('#settings-general-auto_update').prop('checked', {{'true' if settings.general.getboolean('auto_update') else 'false'}});
5 years ago
$('#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();
5 years ago
form_changed = false;
5 years ago
$('#save_button').prop('disabled', true).css('cursor', 'not-allowed');
5 years ago
if (restart_required) {
$('#restart_modal').modal('show');
}
5 years ago
setTimeout(
function()
{
$('#save_button_checkmark').hide();
}, 2000);
}
});
});
5 years ago
5 years ago
$('#restart_button').on('click', function() {
$('#restart').trigger('click');
});
5 years ago
// monitor changes to the settings_form
$('#settings_form').on('change', function() {
form_changed = true;
$('#save_button').prop('disabled', false).css('cursor', 'auto');
})
5 years ago
// monitor changes to the fields that require restart to be effective.
$('.restart-required').on('change', function() {
restart_required = true;
})
5 years ago
});
5 years ago
5 years ago
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 );
}
5 years ago
</script>
{% endblock tail %}