mirror of
https://github.com/morpheus65535/bazarr.git
synced 2025-04-25 07:07:44 -04:00
WIP
This commit is contained in:
parent
362691220c
commit
d3aa8d4c80
9 changed files with 612 additions and 482 deletions
|
@ -9,9 +9,10 @@ from operator import itemgetter
|
||||||
import platform
|
import platform
|
||||||
import io
|
import io
|
||||||
from calendar import day_name
|
from calendar import day_name
|
||||||
|
import importlib
|
||||||
|
|
||||||
from get_args import args
|
from get_args import args
|
||||||
from config import settings, base_url
|
from config import settings, base_url, save_settings
|
||||||
|
|
||||||
from init import *
|
from init import *
|
||||||
import logging
|
import logging
|
||||||
|
@ -64,6 +65,13 @@ class Languages(Resource):
|
||||||
return jsonify(result)
|
return jsonify(result)
|
||||||
|
|
||||||
|
|
||||||
|
class SaveSettings(Resource):
|
||||||
|
def post(self):
|
||||||
|
save_settings(request.form.items())
|
||||||
|
|
||||||
|
return '', 200
|
||||||
|
|
||||||
|
|
||||||
class SystemTasks(Resource):
|
class SystemTasks(Resource):
|
||||||
def get(self):
|
def get(self):
|
||||||
taskid = request.args.get('taskid')
|
taskid = request.args.get('taskid')
|
||||||
|
@ -1128,6 +1136,8 @@ class SearchWantedMovies(Resource):
|
||||||
api.add_resource(Badges, '/badges')
|
api.add_resource(Badges, '/badges')
|
||||||
api.add_resource(Languages, '/languages')
|
api.add_resource(Languages, '/languages')
|
||||||
|
|
||||||
|
api.add_resource(SaveSettings, '/savesettings')
|
||||||
|
|
||||||
api.add_resource(SystemTasks, '/systemtasks')
|
api.add_resource(SystemTasks, '/systemtasks')
|
||||||
api.add_resource(SystemLogs, '/systemlogs')
|
api.add_resource(SystemLogs, '/systemlogs')
|
||||||
api.add_resource(SystemProviders, '/systemproviders')
|
api.add_resource(SystemProviders, '/systemproviders')
|
||||||
|
|
|
@ -148,6 +148,23 @@ settings.read(os.path.join(args.config_dir, 'config', 'config.ini'))
|
||||||
base_url = settings.general.base_url
|
base_url = settings.general.base_url
|
||||||
|
|
||||||
|
|
||||||
|
def save_settings(settings_items):
|
||||||
|
for key, value in settings_items:
|
||||||
|
settings_keys = key.split('-')
|
||||||
|
|
||||||
|
if value == 'true':
|
||||||
|
value = 'True'
|
||||||
|
elif value == 'false':
|
||||||
|
value = 'False'
|
||||||
|
|
||||||
|
if settings_keys[0] == 'settings':
|
||||||
|
settings[settings_keys[1]][settings_keys[2]] = str(value)
|
||||||
|
|
||||||
|
with open(os.path.join(args.config_dir, 'config', 'config.ini'), 'w+') as handle:
|
||||||
|
settings.write(handle)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def url_sonarr():
|
def url_sonarr():
|
||||||
if settings.sonarr.getboolean('ssl'):
|
if settings.sonarr.getboolean('ssl'):
|
||||||
protocol_sonarr = "https"
|
protocol_sonarr = "https"
|
||||||
|
|
|
@ -42,8 +42,16 @@
|
||||||
{% endblock head_css %}
|
{% endblock head_css %}
|
||||||
|
|
||||||
{% block head %}
|
{% block head %}
|
||||||
|
<style>
|
||||||
|
.table td, .table th {
|
||||||
|
padding: .4rem !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
{% endblock head %}
|
{% endblock head %}
|
||||||
|
|
||||||
|
{% block page_head %}
|
||||||
|
{% endblock page_head %}
|
||||||
|
|
||||||
{% block head_tail %}
|
{% block head_tail %}
|
||||||
{% endblock head_tail %}
|
{% endblock head_tail %}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
{% block title %}Series - Bazarr{% endblock %}
|
{% block title %}Series - Bazarr{% endblock %}
|
||||||
|
|
||||||
{% block head %}
|
{% block page_head %}
|
||||||
<style>
|
<style>
|
||||||
#seriesFanart {
|
#seriesFanart {
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
|
@ -42,7 +42,7 @@
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
{% endblock head %}
|
{% endblock page_head %}
|
||||||
|
|
||||||
{% block bcleft %}
|
{% block bcleft %}
|
||||||
<div class="">
|
<div class="">
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
{% block title %}Movie - Bazarr{% endblock %}
|
{% block title %}Movie - Bazarr{% endblock %}
|
||||||
|
|
||||||
{% block head %}
|
{% block page_head %}
|
||||||
<style>
|
<style>
|
||||||
#movieFanart {
|
#movieFanart {
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
|
@ -42,7 +42,7 @@
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
{% endblock head %}
|
{% endblock page_head %}
|
||||||
|
|
||||||
{% block bcleft %}
|
{% block bcleft %}
|
||||||
<div class="">
|
<div class="">
|
||||||
|
|
|
@ -2,10 +2,23 @@
|
||||||
|
|
||||||
{% block title %}General - Bazarr{% endblock %}
|
{% block title %}General - Bazarr{% endblock %}
|
||||||
|
|
||||||
|
{% block page_head %}
|
||||||
|
<style>
|
||||||
|
.restart {
|
||||||
|
color: orange;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
{% endblock page_head %}
|
||||||
|
|
||||||
{% block bcleft %}
|
{% block bcleft %}
|
||||||
<div class="">
|
<div class="">
|
||||||
<button class="btn btn-outline" id="save_button">
|
<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>
|
<div class="align-bottom text-themecolor small text-center">Save</div>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -17,32 +30,38 @@
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<div class="container-fluid" style="padding-top: 3em;">
|
<div class="container-fluid" style="padding-top: 3em;">
|
||||||
|
<form class="form" name="settings_form" id="settings_form">
|
||||||
<h4>Host</h4>
|
<h4>Host</h4>
|
||||||
<hr/>
|
<hr/>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-2 text-right">
|
<div class="col-sm-2 text-right">
|
||||||
<b>Listening IP Address</b>
|
<b>Bind Address</b>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
<input type="text" class="form-control" id="settings-general-ip" name="settings-general-ip" value="{{settings.general.ip}}">
|
<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>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-2 text-right">
|
<div class="col-sm-2 text-right">
|
||||||
<b>Listening Port</b>
|
<b>Port Number</b>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-4">
|
<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>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-2 text-right">
|
<div class="col-sm-2 text-right">
|
||||||
<b>Base URL</b>
|
<b>URL Base</b>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-4">
|
<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}}">
|
<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>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
|
@ -59,6 +78,8 @@
|
||||||
<option value="Basic">Basic</option>
|
<option value="Basic">Basic</option>
|
||||||
<option value="Form">Form</option>
|
<option value="Form">Form</option>
|
||||||
</select>
|
</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>
|
</div>
|
||||||
<div id="authentication_div">
|
<div id="authentication_div">
|
||||||
|
@ -85,8 +106,11 @@
|
||||||
<div class="col-sm-2 text-right">
|
<div class="col-sm-2 text-right">
|
||||||
<b>API Key</b>
|
<b>API Key</b>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-4">
|
<div class="input-group col-sm-4">
|
||||||
<input type="text" class="form-control" id="settings-auth-apikey" name="settings-auth-apikey" value="{{settings.auth.apikey}}">
|
<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>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
|
@ -103,7 +127,8 @@
|
||||||
<option value="http">HTTP(S)</option>
|
<option value="http">HTTP(S)</option>
|
||||||
<option value="socks4">Socks4</option>
|
<option value="socks4">Socks4</option>
|
||||||
<option value="socks5">Socks5</option>
|
<option value="socks5">Socks5</option>
|
||||||
</select>
|
</select><br>
|
||||||
|
<label class="restart">Requires restart to take effect</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="proxy_div">
|
<div id="proxy_div">
|
||||||
|
@ -204,6 +229,7 @@
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
<div id="update_div">
|
||||||
<h4>Updates</h4>
|
<h4>Updates</h4>
|
||||||
<hr/>
|
<hr/>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
@ -240,12 +266,84 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
{% endblock body %}
|
{% endblock body %}
|
||||||
|
|
||||||
{% block tail %}
|
{% block tail %}
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function () {
|
$(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>
|
</script>
|
||||||
{% endblock tail %}
|
{% endblock tail %}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
{% block title %}Logs - Bazarr{% endblock %}
|
{% block title %}Logs - Bazarr{% endblock %}
|
||||||
|
|
||||||
{% block head %}
|
{% block page_head %}
|
||||||
<style>
|
<style>
|
||||||
.dropdown-item-checked::before {
|
.dropdown-item-checked::before {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
@ -11,7 +11,7 @@
|
||||||
font-weight: 900;
|
font-weight: 900;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
{% endblock head %}
|
{% endblock page_head %}
|
||||||
|
|
||||||
{% block bcleft %}
|
{% block bcleft %}
|
||||||
<div class="">
|
<div class="">
|
||||||
|
|
|
@ -2,10 +2,6 @@
|
||||||
|
|
||||||
{% block title %}Logs - Bazarr{% endblock %}
|
{% block title %}Logs - Bazarr{% endblock %}
|
||||||
|
|
||||||
{% block head %}
|
|
||||||
|
|
||||||
{% endblock head %}
|
|
||||||
|
|
||||||
{% block bcleft %}
|
{% block bcleft %}
|
||||||
|
|
||||||
{% endblock bcleft %}
|
{% endblock bcleft %}
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
<title>Settings - Bazarr</title>
|
<title>Settings - Bazarr</title>
|
||||||
|
|
||||||
|
{{ super() }}
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
background-color: #272727;
|
background-color: #272727;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue