pull/884/head
Louis Vézina 5 years ago
parent 362691220c
commit d3aa8d4c80

@ -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"

@ -1,9 +1,9 @@
<!doctype html> <!doctype html>
<html lang="en"> <html lang="en">
<head> <head>
<title>{% block title %}Bazarr{% endblock %}</title> <title>{% block title %}Bazarr{% endblock %}</title>
{% block head_meta %} {% block head_meta %}
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta name="mobile-web-app-capable" content="yes"/> <meta name="mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-capable" content="yes"/> <meta name="apple-mobile-web-app-capable" content="yes"/>
@ -17,9 +17,9 @@
<meta name="msapplication-config" content="{{ url_for('static',filename='browserconfig.xml') }}"> <meta name="msapplication-config" content="{{ url_for('static',filename='browserconfig.xml') }}">
<meta name="theme-color" content="#ffffff"> <meta name="theme-color" content="#ffffff">
{% endblock head_meta %} {% endblock head_meta %}
{% block head_css %} {% block head_css %}
<link href="{{ url_for('static',filename='plugins/bootstrap/css/bootstrap.min.css') }}" rel="stylesheet"> <link href="{{ url_for('static',filename='plugins/bootstrap/css/bootstrap.min.css') }}" rel="stylesheet">
<!-- Custom CSS --> <!-- Custom CSS -->
<link href="{{ url_for('static',filename='css/style.css') }}" rel="stylesheet"> <link href="{{ url_for('static',filename='css/style.css') }}" rel="stylesheet">
@ -39,296 +39,304 @@
href="{{ url_for('static',filename='plugins/datatables.net-bs4/css/dataTables.bootstrap4.min.css') }}"> href="{{ url_for('static',filename='plugins/datatables.net-bs4/css/dataTables.bootstrap4.min.css') }}">
<link rel="stylesheet" href="{{ url_for('static',filename='css/bootstrap-select.css') }}" /> <link rel="stylesheet" href="{{ url_for('static',filename='css/bootstrap-select.css') }}" />
{% endblock head_css %} {% endblock head_css %}
{% block head %} {% block head %}
{% endblock head %} <style>
.table td, .table th {
padding: .4rem !important;
}
</style>
{% endblock head %}
{% block page_head %}
{% endblock page_head %}
{% block head_tail %} {% block head_tail %}
{% endblock head_tail %} {% endblock head_tail %}
</head> </head>
<body class="fix-header fix-sidebar card-no-border"> <body class="fix-header fix-sidebar card-no-border">
<!-- ============================================================== -->
<!-- Preloader - style you can find in spinners.css -->
<!-- ============================================================== -->
<div class="preloader">
<svg class="circular" viewBox="25 25 50 50">
<circle class="path" cx="50" cy="50" r="20" fill="none" stroke-width="2" stroke-miterlimit="10"></circle>
</svg>
</div>
{% block page_body %}
<!-- ============================================================== -->
<!-- Main wrapper - style you can find in pages.scss -->
<!-- ============================================================== -->
<div id="main-wrapper">
<!-- ============================================================== --> <!-- ============================================================== -->
<!-- Topbar header - style you can find in pages.scss --> <!-- Preloader - style you can find in spinners.css -->
<!-- ============================================================== --> <!-- ============================================================== -->
<header class="topbar"> <div class="preloader">
<nav class="navbar top-navbar navbar-expand-md navbar-light"> <svg class="circular" viewBox="25 25 50 50">
<!-- ============================================================== --> <circle class="path" cx="50" cy="50" r="20" fill="none" stroke-width="2" stroke-miterlimit="10"></circle>
<!-- Logo --> </svg>
<!-- ============================================================== --> </div>
<div class="navbar-header"> {% block page_body %}
<a class="navbar-brand" href="{{ url_for('redirect_root') }}"> <!-- ============================================================== -->
<!-- Logo icon --> <!-- Main wrapper - style you can find in pages.scss -->
<b> <!-- ============================================================== -->
<img src="{{ url_for('static',filename='logo128.png') }}" alt="homepage" width="40" <div id="main-wrapper">
class="dark-logo"/> <!-- ============================================================== -->
</b></a> <!-- Topbar header - style you can find in pages.scss -->
<!--End Logo icon --> <!-- ============================================================== -->
<!-- Logo text --> <header class="topbar">
</div> <nav class="navbar top-navbar navbar-expand-md navbar-light">
<!-- ============================================================== -->
<!-- End Logo -->
<!-- ============================================================== -->
<div class="navbar-collapse">
<!-- ============================================================== --> <!-- ============================================================== -->
<!-- toggle and nav items --> <!-- Logo -->
<!-- ============================================================== --> <!-- ============================================================== -->
<ul class="navbar-nav mr-auto mt-md-0"> <div class="navbar-header">
<!-- This is --> <a class="navbar-brand" href="{{ url_for('redirect_root') }}">
<li class="nav-item"><a <!-- Logo icon -->
class="nav-link nav-toggler d-block d-md-none text-muted hidden-xl-up" <b>
href="javascript:void(0)"><i class="mdi mdi-menu"></i></a></li> <img src="{{ url_for('static',filename='logo128.png') }}" alt="homepage" width="40"
<li class="nav-item"><a class="dark-logo"/>
class="nav-link sidebartoggler d-none d-md-block text-muted hidden-xl-up" </b></a>
href="javascript:void(0)"><i class="ti-menu"></i></a></li> <!--End Logo icon -->
<!-- ============================================================== --> <!-- Logo text -->
<!-- Search --> </div>
<!-- ============================================================== -->
<li class="nav-item hidden-sm-down search-box">
<form class="form-material"><input type="text" class="form-control text-white"
placeholder="Search...">
</form>
</li>
</ul>
<!-- ============================================================== --> <!-- ============================================================== -->
<!-- User profile and search --> <!-- End Logo -->
<!-- ============================================================== --> <!-- ============================================================== -->
<ul class="navbar-nav my-lg-0"> <div class="navbar-collapse">
<!-- ============================================================== --> <!-- ============================================================== -->
<!-- Profile --> <!-- toggle and nav items -->
<!-- ============================================================== --> <!-- ============================================================== -->
<li class="nav-item dropdown"> <ul class="navbar-nav mr-auto mt-md-0">
<a class="nav-link dropdown-toggle text-muted fas fa-user" href="" <!-- This is -->
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></a> <li class="nav-item"><a
<div class="dropdown-menu dropdown-menu-right scale-up"> class="nav-link nav-toggler d-block d-md-none text-muted hidden-xl-up"
<ul class="dropdown-user"> href="javascript:void(0)"><i class="mdi mdi-menu"></i></a></li>
<li><a href="{{ url_for('restart') }}"><i class="fas fa-redo"></i> Restart</a></li> <li class="nav-item"><a
<li><a href="{{ url_for('shutdown') }}"><i class="fas fa-power-off"></i> class="nav-link sidebartoggler d-none d-md-block text-muted hidden-xl-up"
Shutdown</a></li> href="javascript:void(0)"><i class="ti-menu"></i></a></li>
<li><a href="{{ url_for('logout') }}"><i class="fas fa-sign-out-alt"></i> Logout</a> <!-- ============================================================== -->
</li> <!-- Search -->
</ul> <!-- ============================================================== -->
</div> <li class="nav-item hidden-sm-down search-box">
</li> <form class="form-material"><input type="text" class="form-control text-white"
</ul> placeholder="Search...">
</div> </form>
</nav> </li>
</header> </ul>
<!-- ============================================================== --> <!-- ============================================================== -->
<!-- End Topbar header --> <!-- User profile and search -->
<!-- ============================================================== --> <!-- ============================================================== -->
<!-- ============================================================== --> <ul class="navbar-nav my-lg-0">
<!-- Left Sidebar - style you can find in sidebar.scss --> <!-- ============================================================== -->
<!-- ============================================================== --> <!-- Profile -->
<aside class="left-sidebar"> <!-- ============================================================== -->
<!-- Sidebar scroll--> <li class="nav-item dropdown">
<div class="scroll-sidebar"> <a class="nav-link dropdown-toggle text-muted fas fa-user" href=""
<!-- Sidebar navigation--> data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></a>
<nav class="sidebar-nav"> <div class="dropdown-menu dropdown-menu-right scale-up">
<ul id="sidebarnav"> <ul class="dropdown-user">
{% if settings.general.getboolean('use_sonarr') %} <li><a href="{{ url_for('restart') }}"><i class="fas fa-redo"></i> Restart</a></li>
<li id="series_nav"><a href="{{ url_for('series') }}"><i class="fas fa-play"></i><span <li><a href="{{ url_for('shutdown') }}"><i class="fas fa-power-off"></i>
class="hide-menu"> Series</span></a> Shutdown</a></li>
</li> <li><a href="{{ url_for('logout') }}"><i class="fas fa-sign-out-alt"></i> Logout</a>
{% endif %} </li>
</ul>
</div>
</li>
</ul>
</div>
</nav>
</header>
<!-- ============================================================== -->
<!-- End Topbar header -->
<!-- ============================================================== -->
<!-- ============================================================== -->
<!-- Left Sidebar - style you can find in sidebar.scss -->
<!-- ============================================================== -->
<aside class="left-sidebar">
<!-- Sidebar scroll-->
<div class="scroll-sidebar">
<!-- Sidebar navigation-->
<nav class="sidebar-nav">
<ul id="sidebarnav">
{% if settings.general.getboolean('use_sonarr') %}
<li id="series_nav"><a href="{{ url_for('series') }}"><i class="fas fa-play"></i><span
class="hide-menu"> Series</span></a>
</li>
{% endif %}
{% if settings.general.getboolean('use_radarr') %} {% if settings.general.getboolean('use_radarr') %}
<li id="movies_nav"><a href="{{ url_for('movies') }}"><i class="fas fa-film"></i><span <li id="movies_nav"><a href="{{ url_for('movies') }}"><i class="fas fa-film"></i><span
class="hide-menu"> Movies</span></a> class="hide-menu"> Movies</span></a>
</li> </li>
{% endif %} {% endif %}
<li><a href="#"><i class="fas fa-clock"></i><span class="hide-menu"> History</span></a> <li><a href="#"><i class="fas fa-clock"></i><span class="hide-menu"> History</span></a>
<ul aria-expanded="false" class="collapse"> <ul aria-expanded="false" class="collapse">
{% if settings.general.getboolean('use_sonarr') %} {% if settings.general.getboolean('use_sonarr') %}
<li><a href="{{ url_for('historyseries') }}"> Series</a></li> <li><a href="{{ url_for('historyseries') }}"> Series</a></li>
{% endif %} {% endif %}
{% if settings.general.getboolean('use_radarr') %} {% if settings.general.getboolean('use_radarr') %}
<li><a href="{{ url_for('historymovies') }}"> Movies</a></li> <li><a href="{{ url_for('historymovies') }}"> Movies</a></li>
{% endif %} {% endif %}
</ul> </ul>
</li> </li>
<li><a href="#"><i class="fas fa-exclamation-triangle"></i><span class="hide-menu"> Wanted</span></a> <li><a href="#"><i class="fas fa-exclamation-triangle"></i><span class="hide-menu"> Wanted</span></a>
<ul aria-expanded="false" class="collapse"> <ul aria-expanded="false" class="collapse">
{% if settings.general.getboolean('use_sonarr') %} {% if settings.general.getboolean('use_sonarr') %}
<li><a href="{{ url_for('wantedseries') }}"> Series</a></li> <li><a href="{{ url_for('wantedseries') }}"> Series</a></li>
{% endif %} {% endif %}
{% if settings.general.getboolean('use_radarr') %} {% if settings.general.getboolean('use_radarr') %}
<li><a href="{{ url_for('wantedmovies') }}"> Movies</a></li> <li><a href="{{ url_for('wantedmovies') }}"> Movies</a></li>
{% endif %} {% endif %}
</ul> </ul>
</li> </li>
<li><a href="#"><i <li><a href="#"><i
class="fas fa-cogs"></i><span class="hide-menu"> Settings</span></a> class="fas fa-cogs"></i><span class="hide-menu"> Settings</span></a>
<ul aria-expanded="false" class="collapse"> <ul aria-expanded="false" class="collapse">
<li><a href="{{ url_for('settingsgeneral') }}"> General</a></li> <li><a href="{{ url_for('settingsgeneral') }}"> General</a></li>
<li><a href="/"> Sonarr</a></li> <li><a href="/"> Sonarr</a></li>
<li><a href="/"> Radarr</a></li> <li><a href="/"> Radarr</a></li>
<li><a href="/"> Subtitles</a></li> <li><a href="/"> Subtitles</a></li>
<li><a href="/"> Notifications</a></li> <li><a href="/"> Notifications</a></li>
</ul> </ul>
</li> </li>
<li><a href="#"><i <li><a href="#"><i
class="fas fa-laptop"></i><span class="hide-menu"> System</span></a> class="fas fa-laptop"></i><span class="hide-menu"> System</span></a>
<ul aria-expanded="false" class="collapse"> <ul aria-expanded="false" class="collapse">
<li><a href="{{ url_for('systemtasks') }}"> Tasks</a></li> <li><a href="{{ url_for('systemtasks') }}"> Tasks</a></li>
<li><a href="{{ url_for('systemlogs') }}"> Logs</a></li> <li><a href="{{ url_for('systemlogs') }}"> Logs</a></li>
<li><a href="{{ url_for('systemproviders') }}"> Providers</a></li> <li><a href="{{ url_for('systemproviders') }}"> Providers</a></li>
<li><a href="{{ url_for('systemstatus') }}"> Status</a></li> <li><a href="{{ url_for('systemstatus') }}"> Status</a></li>
<li><a href="{{ url_for('systemreleases') }}"> Releases</a></li> <li><a href="{{ url_for('systemreleases') }}"> Releases</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
</nav> </nav>
<!-- End Sidebar navigation --> <!-- End Sidebar navigation -->
</div> </div>
<!-- End Sidebar scroll--> <!-- End Sidebar scroll-->
</aside> </aside>
<!-- ============================================================== --> <!-- ============================================================== -->
<!-- End Left Sidebar - style you can find in sidebar.scss --> <!-- End Left Sidebar - style you can find in sidebar.scss -->
<!-- ============================================================== --> <!-- ============================================================== -->
<div class="page-wrapper"> <div class="page-wrapper">
<div class="container-fluid"> <div class="container-fluid">
{% block breadcrumb %} {% block breadcrumb %}
<!-- ============================================================== --> <!-- ============================================================== -->
<!-- Bread crumb and right sidebar toggle --> <!-- Bread crumb and right sidebar toggle -->
<!-- ============================================================== --> <!-- ============================================================== -->
<div id="buttons_bars" class="row page-titles"> <div id="buttons_bars" class="row page-titles">
<div id="buttons_bar_left" class="col-md-5 col-8 align-self-center"> <div id="buttons_bar_left" class="col-md-5 col-8 align-self-center">
{% block bcleft %} {% block bcleft %}
{% endblock bcleft %} {% endblock bcleft %}
</div> </div>
<div id="buttons_bar_right" class="col-md-7 col-4 align-self-center"> <div id="buttons_bar_right" class="col-md-7 col-4 align-self-center">
{% block bcright %} {% block bcright %}
{% endblock bcright %} {% endblock bcright %}
</div>
</div> </div>
</div> {% endblock breadcrumb %}
{% endblock breadcrumb %} {% block body %}
{% block body %}
{% endblock body %} {% endblock body %}
</div>
</div> </div>
<!-- ============================================================== -->
<!-- footer -->
<!-- ============================================================== -->
</div> </div>
<!-- ============================================================== --> <!-- ============================================================== -->
<!-- footer --> <!-- End footer -->
<!-- ============================================================== --> <!-- ============================================================== -->
</div>
<!-- ============================================================== -->
<!-- End footer -->
<!-- ============================================================== -->
<div id="reconnect_overlay" class="overlay"> <div id="reconnect_overlay" class="overlay">
<div class="overlay-content"> <div class="overlay-content">
<p style="color: white;">Connection to Backend Lost.</p> <p style="color: white;">Connection to Backend Lost.</p>
<button class="btn btn-info" onclick="window.location.reload()">Reload</button> <button class="btn btn-info" onclick="window.location.reload()">Reload</button>
</div>
</div> </div>
</div> {% endblock page_body %}
{% endblock page_body %}
{% block tail_js %} {% block tail_js %}
<!-- ============================================================== --> <!-- ============================================================== -->
<!-- All Jquery --> <!-- All Jquery -->
<!-- ============================================================== --> <!-- ============================================================== -->
<script src="{{ url_for('static',filename='plugins/jquery/jquery.min.js') }}"></script> <script src="{{ url_for('static',filename='plugins/jquery/jquery.min.js') }}"></script>
<!-- Bootstrap tether Core JavaScript --> <!-- Bootstrap tether Core JavaScript -->
<script src="{{ url_for('static',filename='plugins/popper/popper.min.js') }}"></script> <script src="{{ url_for('static',filename='plugins/popper/popper.min.js') }}"></script>
<script src="{{ url_for('static',filename='plugins/bootstrap/js/bootstrap.min.js') }}"></script> <script src="{{ url_for('static',filename='plugins/bootstrap/js/bootstrap.min.js') }}"></script>
<!-- slimscrollbar scrollbar JavaScript --> <!-- slimscrollbar scrollbar JavaScript -->
<script src="{{ url_for('static',filename='js/jquery.slimscroll.js') }}"></script> <script src="{{ url_for('static',filename='js/jquery.slimscroll.js') }}"></script>
<!--Menu sidebar --> <!--Menu sidebar -->
<script src="{{ url_for('static',filename='js/sidebarmenu.js') }}"></script> <script src="{{ url_for('static',filename='js/sidebarmenu.js') }}"></script>
<!--stickey kit --> <!--stickey kit -->
<script src="{{ url_for('static',filename='plugins/sticky-kit-master/dist/sticky-kit.min.js') }}"></script> <script src="{{ url_for('static',filename='plugins/sticky-kit-master/dist/sticky-kit.min.js') }}"></script>
<!--Custom JavaScript --> <!--Custom JavaScript -->
<script src="{{ url_for('static',filename='datatables/jquery.dataTables.min.js') }}"></script> <script src="{{ url_for('static',filename='datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ url_for('static',filename='datatables/dataTables.rowGroup.min.js') }}"></script> <script src="{{ url_for('static',filename='datatables/dataTables.rowGroup.min.js') }}"></script>
<script src="{{ url_for('static',filename='datatables/dataTables.responsive.min.js') }}"></script> <script src="{{ url_for('static',filename='datatables/dataTables.responsive.min.js') }}"></script>
<script src="{{ url_for('static',filename='datatables/dataTables.select.min.js') }}"></script> <script src="{{ url_for('static',filename='datatables/dataTables.select.min.js') }}"></script>
<script src="{{ url_for('static',filename='datatables/dataTables.buttons.min.js') }}"></script> <script src="{{ url_for('static',filename='datatables/dataTables.buttons.min.js') }}"></script>
<script src="{{ url_for('static',filename='plugins/datatables.net-bs4/js/dataTables.bootstrap4.min.js') }}"></script> <script src="{{ url_for('static',filename='plugins/datatables.net-bs4/js/dataTables.bootstrap4.min.js') }}"></script>
<script src="{{ url_for('static',filename='js/custom.js') }}"></script> <script src="{{ url_for('static',filename='js/custom.js') }}"></script>
<script src="{{ url_for('static',filename='js/socket.io.js') }}"></script> <script src="{{ url_for('static',filename='js/socket.io.js') }}"></script>
<script src="{{ url_for('static',filename='js/bootstrap-select.min.js') }}"></script> <script src="{{ url_for('static',filename='js/bootstrap-select.min.js') }}"></script>
<script src="{{ url_for('static',filename='moment/moment.js') }}"></script> <script src="{{ url_for('static',filename='moment/moment.js') }}"></script>
<script> <script>
$(document).ready(function () { $(document).ready(function () {
BadgesAjax(); BadgesAjax();
$('.table').on('draw.dt', function () { $('.table').on('draw.dt', function () {
$('[data-toggle="tooltip"]').tooltip({html: true}); $('[data-toggle="tooltip"]').tooltip({html: true});
}); });
events = io.connect({ events = io.connect({
path: '{{ settings.general.base_url.rstrip('/') }}/socket.io', path: '{{ settings.general.base_url.rstrip('/') }}/socket.io',
upgrade: false, upgrade: false,
reconnection: true, reconnection: true,
reconnectionDelay: 1000, reconnectionDelay: 1000,
reconnectionDelayMax : 3000, reconnectionDelayMax : 3000,
reconnectionAttempts: 3 reconnectionAttempts: 3
}); });
events.on('reconnect_failed', (reason) => { events.on('reconnect_failed', (reason) => {
$('#reconnect_overlay').show(); $('#reconnect_overlay').show();
}); });
function BadgesAjax() { function BadgesAjax() {
$.ajax({ $.ajax({
url: "{{url_for('api.badges')}}", url: "{{url_for('api.badges')}}",
async: true, async: true,
success: function (data) { success: function (data) {
if (data['throttled_providers']) { if (data['throttled_providers']) {
$('#throttled_providers_count').append('<div class="floating ui tiny yellow label" style="left:90% !important;top:0.5em !important;">' + data['throttled_providers'] + '</div>'); $('#throttled_providers_count').append('<div class="floating ui tiny yellow label" style="left:90% !important;top:0.5em !important;">' + data['throttled_providers'] + '</div>');
} }
if (data['missing_episodes']) { if (data['missing_episodes']) {
$('#wanted').append('<div class="floating ui tiny yellow label" style="left:90% !important;top:0.5em !important;">' + data['missing_episodes'] + '</div>'); $('#wanted').append('<div class="floating ui tiny yellow label" style="left:90% !important;top:0.5em !important;">' + data['missing_episodes'] + '</div>');
} }
if (data['missing_movies']) { if (data['missing_movies']) {
$('#wanted').append('<div id="wanted_movies" class="floating ui tiny green label" style="left:90% !important;top:3em !important;">' + data['missing_movies'] + '</div>'); $('#wanted').append('<div id="wanted_movies" class="floating ui tiny green label" style="left:90% !important;top:3em !important;">' + data['missing_movies'] + '</div>');
} }
}, },
error: (function () { error: (function () {
setTimeout(function () { setTimeout(function () {
setInterval(ping, 2000); setInterval(ping, 2000);
}, 8000); }, 8000);
})
}) })
}) }
}
if ( $('#buttons_bar_left').children().length > 0 || $('#buttons_bar_right').children().length > 0 ) { if ( $('#buttons_bar_left').children().length > 0 || $('#buttons_bar_right').children().length > 0 ) {
$('#buttons_bars').show(); $('#buttons_bars').show();
} else { } else {
$('#buttons_bars').hide(); $('#buttons_bars').hide();
} }
}); });
$(window).on('beforeunload', function() { $(window).on('beforeunload', function() {
events.close(); events.close();
}); });
</script> </script>
{% endblock tail_js %} {% endblock tail_js %}
{% block tail %} {% block tail %}
{% endblock tail %} {% endblock tail %}
</body> </body>
</html> </html>

@ -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,235 +30,320 @@
{% block body %} {% block body %}
<div class="container-fluid" style="padding-top: 3em;"> <div class="container-fluid" style="padding-top: 3em;">
<h4>Host</h4> <form class="form" name="settings_form" id="settings_form">
<hr/> <h4>Host</h4>
<div class="row"> <hr/>
<div class="col-sm-2 text-right">
<b>Listening IP 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}}">
</div>
</div>
<br>
<div class="row">
<div class="col-sm-2 text-right">
<b>Listening Port</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}}">
</div>
</div>
<br>
<div class="row">
<div class="col-sm-2 text-right">
<b>Base URL</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}}">
</div>
</div>
<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">
<select class="selectpicker" id="settings-auth-type" name="settings-auth-type">
<option value="None">None</option>
<option value="Basic">Basic</option>
<option value="Form">Form</option>
</select>
</div>
</div>
<div id="authentication_div">
<div class="row"> <div class="row">
<div class="col-sm-2 text-right"> <div class="col-sm-2 text-right">
<b>Username</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-auth-username" name="settings-auth-username" value="{{settings.auth.username}}"> <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>Password</b> <b>Port Number</b>
</div> </div>
<div class="col-sm-4"> <div class="col-sm-4">
<input type="password" class="form-control" id="settings-auth-password" name="settings-auth-password" value="{{settings.auth.password}}"> <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> <div class="row">
<div class="row"> <div class="col-sm-2 text-right">
<div class="col-sm-2 text-right"> <b>URL Base</b>
<b>API Key</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-auth-apikey" name="settings-auth-apikey" value="{{settings.auth.apikey}}"> <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>
<h4>Security</h4>
<h4>Proxy</h4> <hr/>
<hr/> <div class="row">
<div class="row"> <div class="col-sm-2 text-right">
<div class="col-sm-2 text-right"> <b>Authentication</b>
<b>Type</b> </div>
<div class="form-group col-sm-4">
<select class="selectpicker" id="settings-auth-type" name="settings-auth-type">
<option value="None">None</option>
<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>
<div class="form-group col-sm-4"> <div id="authentication_div">
<select class="selectpicker" id="settings-proxy-type" name="settings-proxy-type"> <div class="row">
<option value="None">None</option> <div class="col-sm-2 text-right">
<option value="http">HTTP(S)</option> <b>Username</b>
<option value="socks4">Socks4</option> </div>
<option value="socks5">Socks5</option> <div class="col-sm-4">
</select> <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>
</div> </div>
</div>
<div id="proxy_div">
<div class="row"> <div class="row">
<div class="col-sm-2 text-right"> <div class="col-sm-2 text-right">
<b>Hostname</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-proxy-url" name="settings-proxy-url" value="{{settings.proxy.url}}"> <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>
<h4>Proxy</h4>
<hr/>
<div class="row"> <div class="row">
<div class="col-sm-2 text-right"> <div class="col-sm-2 text-right">
<b>Port</b> <b>Type</b>
</div> </div>
<div class="col-sm-4"> <div class="form-group col-sm-4">
<input type="text" class="form-control" id="settings-proxy-port" name="settings-proxy-port" value="{{settings.proxy.port}}"> <select class="selectpicker" id="settings-proxy-type" name="settings-proxy-type">
<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>
</div> </div>
</div> </div>
<br> <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/>
<div class="row"> <div class="row">
<div class="col-sm-2 text-right"> <div class="col-sm-2 text-right">
<b>Username</b> <b>Page Size</b>
</div> </div>
<div class="col-sm-4"> <div class="form-group col-sm-4">
<input type="text" class="form-control" id="settings-proxy-username" name="settings-proxy-username" value="{{settings.proxy.username}}"> <select class="selectpicker" id="settings-general-page_size" name="settings-general-page_size">
<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>
</div> </div>
</div> </div>
<br> <br>
<h4>Logging</h4>
<hr/>
<div class="row"> <div class="row">
<div class="col-sm-2 text-right"> <div class="col-sm-2 text-right">
<b>Password</b> <b>Debug</b>
</div> </div>
<div class="col-sm-4"> <div class="form-group col-sm-1">
<input type="password" class="form-control" id="settings-proxy-password" name="settings-proxy-password" value="{{settings.proxy.password}}"> <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>
</div> </div>
</div> </div>
<br> <br>
<h4>Analytics</h4>
<hr/>
<div class="row"> <div class="row">
<div class="col-sm-2 text-right"> <div class="col-sm-2 text-right">
<b>Ignored Addresses</b> <b>Enabled</b>
</div> </div>
<div class="col-sm-4"> <div class="form-group col-sm-1">
<input type="text" class="form-control" id="settings-proxy-exclude" name="settings-proxy-exclude" value="{{settings.proxy.exclude}}"> <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>
</div> </div>
</div> </div>
<br> <br>
</div>
<h4>UI</h4> <div id="update_div">
<hr/> <h4>Updates</h4>
<div class="row"> <hr/>
<div class="col-sm-2 text-right"> <div class="row">
<b>Page Size</b> <div class="col-sm-2 text-right">
</div> <b>Branch</b>
<div class="form-group col-sm-4"> </div>
<select class="selectpicker" id="settings-general-page_size" name="settings-general-page_size"> <div class="form-group col-sm-4">
<option value="-1">Unlimited</option> <select class="selectpicker" id="settings-general-branch" name="settings-general-branch">
<option value="25">25</option> <option value="master">master</option>
<option value="50">50</option> <option value="development">development</option>
<option value="100">100</option> </select>
<option value="250">250</option> </div>
<option value="500">500</option> </div>
<option value="1000">1000</option> <div class="row">
</select> <div class="col-sm-2 text-right">
</div> <b>Automatic</b>
</div> </div>
<br> <div class="form-group col-sm-1">
<label class="custom-control custom-checkbox">
<h4>Logging</h4> <input type="checkbox" class="custom-control-input" id="settings-general-auto_update" name="settings-general-auto_update">
<hr/> <span class="custom-control-label" for="settings-general-auto_update"></span>
<div class="row"> </label>
<div class="col-sm-2 text-right"> </div>
<b>Debug</b> </div>
</div> <div class="row">
<div class="form-group col-sm-1"> <div class="col-sm-2 text-right">
<label class="custom-control custom-checkbox"> <b>Restart After Update</b>
<input type="checkbox" class="custom-control-input" id="settings-general-debug" name="settings-general-debug"> </div>
<span class="custom-control-label" for="settings-general-debug"></span> <div class="form-group col-sm-1">
</label> <label class="custom-control custom-checkbox">
</div> <input type="checkbox" class="custom-control-input" id="settings-general-update_restart" name="settings-general-update_restart">
</div> <span class="custom-control-label" for="settings-general-update_restart"></span>
<br> </label>
</div>
<h4>Analytics</h4> </div>
<hr/>
<div class="row">
<div class="col-sm-2 text-right">
<b>Enabled</b>
</div>
<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>
</div>
</div>
<br>
<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">
<select class="selectpicker" id="settings-general-branch" name="settings-general-branch">
<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>
</div> </form>
</div> </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…
Cancel
Save