1
0
Fork 0
mirror of https://github.com/morpheus65535/bazarr synced 2024-12-26 01:27:07 +00:00
bazarr/views/settingsgeneral.html

351 lines
15 KiB
HTML
Raw Normal View History

2020-02-27 02:08:52 +00:00
{% extends '_main.html' %}
{% block title %}General - Bazarr{% endblock %}
2020-03-11 10:58:45 +00:00
{% block page_head %}
<style>
.restart {
color: orange;
}
</style>
{% endblock page_head %}
2020-02-27 02:08:52 +00:00
{% block bcleft %}
<div class="">
<button class="btn btn-outline" id="save_button">
2020-03-11 10:58:45 +00:00
<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>
2020-02-27 02:08:52 +00:00
<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;">
2020-03-11 10:58:45 +00:00
<form class="form" name="settings_form" id="settings_form">
<h4>Host</h4>
<hr/>
2020-02-27 02:08:52 +00:00
<div class="row">
<div class="col-sm-2 text-right">
2020-03-11 10:58:45 +00:00
<b>Bind Address</b>
2020-02-27 02:08:52 +00:00
</div>
<div class="col-sm-4">
2020-03-11 10:58:45 +00:00
<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>
2020-02-27 02:08:52 +00:00
</div>
</div>
<br>
<div class="row">
<div class="col-sm-2 text-right">
2020-03-11 10:58:45 +00:00
<b>Port Number</b>
2020-02-27 02:08:52 +00:00
</div>
<div class="col-sm-4">
2020-03-11 10:58:45 +00:00
<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>
2020-02-27 02:08:52 +00:00
</div>
</div>
<br>
2020-03-11 10:58:45 +00:00
<div class="row">
<div class="col-sm-2 text-right">
<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>
2020-02-27 02:08:52 +00:00
</div>
2020-03-11 10:58:45 +00:00
<br>
<h4>Security</h4>
<hr/>
<div class="row">
<div class="col-sm-2 text-right">
<b>Authentication</b>
</div>
<div class="form-group col-sm-4">
2020-03-26 19:37:17 +00:00
<select class="form-control selectpicker" id="settings-auth-type" name="settings-auth-type">
2020-03-11 10:58:45 +00:00
<option value="None">None</option>
2020-03-26 19:37:17 +00:00
<option value="basic">Basic</option>
<option value="form">Form</option>
2020-03-11 10:58:45 +00:00
</select>
<label for="settings-auth-type">Require Username and Password to access Bazarr</label><br>
2020-03-26 19:37:17 +00:00
{# <label class="restart">Requires restart to take effect</label>#}
2020-03-11 10:58:45 +00:00
</div>
2020-02-27 02:08:52 +00:00
</div>
2020-03-11 10:58:45 +00:00
<div id="authentication_div">
<div class="row">
<div class="col-sm-2 text-right">
<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">
<div class="col-sm-2 text-right">
<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>
2020-02-27 02:08:52 +00:00
</div>
<div class="row">
<div class="col-sm-2 text-right">
2020-03-11 10:58:45 +00:00
<b>API Key</b>
2020-02-27 02:08:52 +00:00
</div>
2020-03-11 10:58:45 +00:00
<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>
2020-02-27 02:08:52 +00:00
</div>
</div>
<br>
2020-03-11 10:58:45 +00:00
<h4>Proxy</h4>
<hr/>
2020-02-27 02:08:52 +00:00
<div class="row">
<div class="col-sm-2 text-right">
2020-03-11 10:58:45 +00:00
<b>Type</b>
2020-02-27 02:08:52 +00:00
</div>
2020-03-11 10:58:45 +00:00
<div class="form-group col-sm-4">
2020-03-26 19:37:17 +00:00
<select class="form-control selectpicker" id="settings-proxy-type" name="settings-proxy-type">
2020-03-11 10:58:45 +00:00
<option value="None">None</option>
<option value="http">HTTP(S)</option>
<option value="socks4">Socks4</option>
<option value="socks5">Socks5</option>
</select><br>
<label class="restart">Requires restart to take effect</label>
2020-02-27 02:08:52 +00:00
</div>
</div>
2020-03-11 10:58:45 +00:00
<div id="proxy_div">
<div class="row">
<div class="col-sm-2 text-right">
<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">
<div class="col-sm-2 text-right">
<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">
<div class="col-sm-2 text-right">
<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}}">
</div>
</div>
<br>
<div class="row">
<div class="col-sm-2 text-right">
<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}}">
</div>
</div>
<br>
<div class="row">
<div class="col-sm-2 text-right">
<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}}">
</div>
</div>
<br>
</div>
<h4>UI</h4>
<hr/>
2020-02-27 02:08:52 +00:00
<div class="row">
<div class="col-sm-2 text-right">
2020-03-11 10:58:45 +00:00
<b>Page Size</b>
2020-02-27 02:08:52 +00:00
</div>
2020-03-11 10:58:45 +00:00
<div class="form-group col-sm-4">
2020-03-26 19:37:17 +00:00
<select class="form-control selectpicker" id="settings-general-page_size" name="settings-general-page_size">
2020-03-11 10:58:45 +00:00
<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>
2020-02-27 02:08:52 +00:00
</div>
</div>
<br>
2020-03-11 10:58:45 +00:00
<h4>Logging</h4>
<hr/>
2020-02-27 02:08:52 +00:00
<div class="row">
<div class="col-sm-2 text-right">
2020-03-11 10:58:45 +00:00
<b>Debug</b>
2020-02-27 02:08:52 +00:00
</div>
2020-03-11 10:58:45 +00:00
<div class="form-group col-sm-1">
<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>
2020-02-27 02:08:52 +00:00
</div>
</div>
<br>
2020-03-11 10:58:45 +00:00
<h4>Analytics</h4>
<hr/>
2020-02-27 02:08:52 +00:00
<div class="row">
<div class="col-sm-2 text-right">
2020-03-11 10:58:45 +00:00
<b>Enabled</b>
2020-02-27 02:08:52 +00:00
</div>
2020-03-11 10:58:45 +00:00
<div class="form-group col-sm-1">
<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>
2020-02-27 02:08:52 +00:00
</div>
</div>
<br>
2020-03-11 10:58:45 +00:00
<div id="update_div">
<h4>Updates</h4>
<hr/>
<div class="row">
<div class="col-sm-2 text-right">
<b>Branch</b>
</div>
<div class="form-group col-sm-4">
2020-03-26 19:37:17 +00:00
<select class="form-control selectpicker" id="settings-general-branch" name="settings-general-branch">
2020-03-11 10:58:45 +00:00
<option value="master">master</option>
<option value="development">development</option>
</select>
</div>
</div>
<div class="row">
<div class="col-sm-2 text-right">
<b>Automatic</b>
</div>
<div class="form-group col-sm-1">
<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>
</div>
</div>
<div class="row">
<div class="col-sm-2 text-right">
<b>Restart After Update</b>
</div>
<div class="form-group col-sm-1">
<label class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="settings-general-update_restart" name="settings-general-update_restart">
<span class="custom-control-label" for="settings-general-update_restart"></span>
</label>
</div>
</div>
2020-02-27 02:08:52 +00:00
</div>
2020-03-11 10:58:45 +00:00
</form>
2020-02-27 02:08:52 +00:00
</div>
{% endblock body %}
{% block tail %}
<script>
$(document).ready(function () {
2020-03-11 10:58:45 +00:00
// 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}}');
$('.selectpicker').selectpicker('refresh')
2020-03-11 10:58:45 +00:00
// 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);
}
});
});
});
2020-02-27 02:08:52 +00:00
2020-03-11 10:58:45 +00:00
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 );
}
2020-02-27 02:08:52 +00:00
</script>
{% endblock tail %}