Merge with develop:

- No. of unread books correct calculated
- logviewer handles stream output correct
- Id for testablility in email server setup
This commit is contained in:
Ozzieisaacs 2020-01-13 18:37:29 +01:00
parent 1b42dd1043
commit 1d7e52c198
5 changed files with 18 additions and 13 deletions

4
.gitignore vendored
View File

@ -7,9 +7,11 @@ __pycache__/
# Distribution / packaging # Distribution / packaging
.Python .Python
env/ env/
venv/
eggs/ eggs/
dist/ dist/
build/ build/
vendor/
.eggs/ .eggs/
*.egg-info/ *.egg-info/
.installed.cfg .installed.cfg
@ -29,6 +31,4 @@ tags
settings.yaml settings.yaml
gdrive_credentials gdrive_credentials
vendor
client_secrets.json client_secrets.json

View File

@ -17,7 +17,11 @@
// Upon loading load the logfile for the first option (event log) // Upon loading load the logfile for the first option (event log)
$(function() { $(function() {
init(0); if ($("#log_group input").length)
{
var element = $("#log_group input[type='radio']:checked").val();
init(element);
}
}); });
// After change the radio option load the corresponding log file // After change the radio option load the corresponding log file

View File

@ -89,7 +89,7 @@
<div class="modal-body text-center"> <div class="modal-body text-center">
<p>{{_('Do you really want to delete this domain rule?')}}</p> <p>{{_('Do you really want to delete this domain rule?')}}</p>
<button type="button" class="btn btn-danger" id="btndeletedomain" >{{_('Delete')}}</button> <button type="button" class="btn btn-danger" id="btndeletedomain" >{{_('Delete')}}</button>
<button type="button" class="btn btn-default" data-dismiss="modal">{{_('Back')}}</button> <button type="button" class="btn btn-default" id="btncancel" data-dismiss="modal">{{_('Back')}}</button>
</div> </div>
</div> </div>
</div> </div>

View File

@ -1,11 +1,15 @@
{% extends "layout.html" %} {% extends "layout.html" %}
{% block body %} {% block body %}
<div id="log_group" class="inputs"> <div id="log_group" class="inputs">
{% if log_enable %}
<div><input type="radio" name="log_radio" id="log1" value="0" checked> <div><input type="radio" name="log_radio" id="log1" value="0" checked>
<label for="log0">{{_('Show Calibre-Web log')}}</label> {{logfiles[0]}}</div> <label for="log1">{{_('Show Calibre-Web log: ')}}</label>{{logfiles[0]}}</div>
{% else %}
<div><label for="log1">{{_('Calibre-Web log: ')}}</label> {{_("Stream output, can't be displayed")}}</div>
{% endif %}
{% if accesslog_enable %} {% if accesslog_enable %}
<div><input type="radio" name="log_radio" id="log0" value="1"> <div><input type="radio" name="log_radio" id="log0" value="1" {% if not log_enable %}checked{% endif %}>
<label for="log1">{{_('Show access log')}}</label> {{logfiles[1]}}</div> <label for="log0">{{_('Show access log: ')}}</label>{{logfiles[1]}}</div>
{% endif %} {% endif %}
</div> </div>
<div id="renderer" class="log"></div> <div id="renderer" class="log"></div>

View File

@ -811,9 +811,7 @@ def get_tasks_status():
@app.route("/reconnect") @app.route("/reconnect")
def reconnect(): def reconnect():
db.session.close() db.reconnect_db(config)
db.engine.dispose()
db.setup_db(config)
return json.dumps({}) return json.dumps({})
@web.route("/search", methods=["GET"]) @web.route("/search", methods=["GET"])
@ -982,7 +980,7 @@ def advanced_search():
series=series, title=_(u"search"), cc=cc, page="advsearch") series=series, title=_(u"search"), cc=cc, page="advsearch")
def render_read_books(page, are_read, as_xml=False, order=None): def render_read_books(page, are_read, as_xml=False, order=None, *args, **kwargs):
order = order or [] order = order or []
if not config.config_read_column: if not config.config_read_column:
readBooks = ub.session.query(ub.ReadBook).filter(ub.ReadBook.user_id == int(current_user.id))\ readBooks = ub.session.query(ub.ReadBook).filter(ub.ReadBook.user_id == int(current_user.id))\
@ -1011,7 +1009,7 @@ def render_read_books(page, are_read, as_xml=False, order=None):
name = _(u'Read Books') + ' (' + str(len(readBookIds)) + ')' name = _(u'Read Books') + ' (' + str(len(readBookIds)) + ')'
pagename = "read" pagename = "read"
else: else:
total_books = db.session.query(func.count(db.Books.id)).scalar() total_books = db.session.query(func.count(db.Books.id)).filter(common_filters()).scalar()
name = _(u'Unread Books') + ' (' + str(total_books - len(readBookIds)) + ')' name = _(u'Unread Books') + ' (' + str(total_books - len(readBookIds)) + ')'
pagename = "unread" pagename = "unread"
return render_title_template('index.html', random=random, entries=entries, pagination=pagination, return render_title_template('index.html', random=random, entries=entries, pagination=pagination,
@ -1046,7 +1044,6 @@ def serve_book(book_id, book_format, anyname):
return send_from_directory(os.path.join(config.config_calibre_dir, book.path), data.name + "." + book_format) return send_from_directory(os.path.join(config.config_calibre_dir, book.path), data.name + "." + book_format)
# @web.route("/download/<int:book_id>/<book_format>", defaults={'anyname': 'None'})
@web.route("/download/<int:book_id>/<book_format>") @web.route("/download/<int:book_id>/<book_format>")
@login_required_if_no_ano @login_required_if_no_ano
@download_required @download_required