mirror of
https://github.com/janeczku/calibre-web
synced 2024-11-24 18:47:23 +00:00
Fixes from testing:
Certificate files are rejected if not both files are provided Server shuts down controlled after pressing crtl+c Logfile location is better checked improvements for better testing (added ids and name in templates)
This commit is contained in:
parent
cab98a9165
commit
ba7c734657
@ -44,5 +44,9 @@ if args.k:
|
|||||||
print("Keyfilepath is invalid. Exiting...")
|
print("Keyfilepath is invalid. Exiting...")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
if (args.k and not args.c) or (not args.k and args.c):
|
||||||
|
print("Certfile and Keyfile have to be used together. Exiting...")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
if args.k is "":
|
if args.k is "":
|
||||||
keyfilepath = ""
|
keyfilepath = ""
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
from socket import error as SocketError
|
from socket import error as SocketError
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
import signal
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from gevent.pywsgi import WSGIServer
|
from gevent.pywsgi import WSGIServer
|
||||||
from gevent.pool import Pool
|
from gevent.pool import Pool
|
||||||
@ -26,7 +28,8 @@ class server:
|
|||||||
restart= False
|
restart= False
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
signal.signal(signal.SIGINT, self.killServer)
|
||||||
|
signal.signal(signal.SIGTERM, self.killServer)
|
||||||
|
|
||||||
def start_gevent(self):
|
def start_gevent(self):
|
||||||
try:
|
try:
|
||||||
@ -86,6 +89,9 @@ class server:
|
|||||||
def setRestartTyp(self,starttyp):
|
def setRestartTyp(self,starttyp):
|
||||||
self.restart=starttyp
|
self.restart=starttyp
|
||||||
|
|
||||||
|
def killServer(self, signum, frame):
|
||||||
|
self.stopServer()
|
||||||
|
|
||||||
def stopServer(self):
|
def stopServer(self):
|
||||||
if gevent_present:
|
if gevent_present:
|
||||||
self.wsgiserver.close()
|
self.wsgiserver.close()
|
||||||
|
@ -96,8 +96,8 @@
|
|||||||
<div class="col-xs-6 col-sm-5">{% if config.config_remote_login %}<span class="glyphicon glyphicon-ok"></span>{% else %}<span class="glyphicon glyphicon-remove"></span>{% endif %}</div>
|
<div class="col-xs-6 col-sm-5">{% if config.config_remote_login %}<span class="glyphicon glyphicon-ok"></span>{% else %}<span class="glyphicon glyphicon-remove"></span>{% endif %}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="btn btn-default"><a href="{{url_for('configuration')}}">{{_('Basic Configuration')}}</a></div>
|
<div class="btn btn-default"><a id="basic_config" href="{{url_for('configuration')}}">{{_('Basic Configuration')}}</a></div>
|
||||||
<div class="btn btn-default"><a href="{{url_for('view_configuration')}}">{{_('UI Configuration')}}</a></div>
|
<div class="btn btn-default"><a id="view_config" href="{{url_for('view_configuration')}}">{{_('UI Configuration')}}</a></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -105,8 +105,8 @@
|
|||||||
<div class="col">
|
<div class="col">
|
||||||
<h2>{{_('Administration')}}</h2>
|
<h2>{{_('Administration')}}</h2>
|
||||||
<div class="btn btn-default" id="restart_database">{{_('Reconnect to Calibre DB')}}</div>
|
<div class="btn btn-default" id="restart_database">{{_('Reconnect to Calibre DB')}}</div>
|
||||||
<div class="btn btn-default" data-toggle="modal" data-target="#RestartDialog">{{_('Restart Calibre-Web')}}</div>
|
<div class="btn btn-default" id="admin_restart"data-toggle="modal" data-target="#RestartDialog">{{_('Restart Calibre-Web')}}</div>
|
||||||
<div class="btn btn-default" data-toggle="modal" data-target="#ShutdownDialog">{{_('Stop Calibre-Web')}}</div>
|
<div class="btn btn-default" id="admin_stop" data-toggle="modal" data-target="#ShutdownDialog">{{_('Stop Calibre-Web')}}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -207,12 +207,12 @@
|
|||||||
|
|
||||||
|
|
||||||
<div class="col-sm-12">
|
<div class="col-sm-12">
|
||||||
<button type="submit" class="btn btn-default">{{_('Submit')}}</button>
|
<button type="submit" name="submit" class="btn btn-default">{{_('Submit')}}</button>
|
||||||
{% if not origin %}
|
{% if not origin %}
|
||||||
<a href="{{ url_for('admin') }}" class="btn btn-default">{{_('Back')}}</a>
|
<a href="{{ url_for('admin') }}" class="btn btn-default">{{_('Back')}}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if success %}
|
{% if success %}
|
||||||
<a href="{{ url_for('login') }}" class="btn btn-default">{{_('Login')}}</a>
|
<a href="{{ url_for('login') }}" name="login" class="btn btn-default">{{_('Login')}}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
@ -174,8 +174,10 @@
|
|||||||
|
|
||||||
|
|
||||||
{% if entry.comments|length > 0 and entry.comments[0].text|length > 0%}
|
{% if entry.comments|length > 0 and entry.comments[0].text|length > 0%}
|
||||||
<h3>{{_('Description:')}}</h3>
|
<div class="comments">
|
||||||
{{entry.comments[0].text|safe}}
|
<h3>{{_('Description:')}}</h3>
|
||||||
|
{{entry.comments[0].text|safe}}
|
||||||
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
|
@ -122,16 +122,16 @@
|
|||||||
<li id="nav_new" {% if page == 'root' %}class="active"{% endif %}><a href="{{url_for('index')}}"><span class="glyphicon glyphicon-book"></span> {{_('Recently Added')}}</a></li>
|
<li id="nav_new" {% if page == 'root' %}class="active"{% endif %}><a href="{{url_for('index')}}"><span class="glyphicon glyphicon-book"></span> {{_('Recently Added')}}</a></li>
|
||||||
{%endif%}
|
{%endif%}
|
||||||
{% if g.user.show_sorted() %}
|
{% if g.user.show_sorted() %}
|
||||||
<li class="dropdown">
|
<li id="nav_sort" class="dropdown">
|
||||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
|
||||||
<span class="glyphicon glyphicon-sort-by-attributes"></span>{{_('Sorted Books')}}
|
<span class="glyphicon glyphicon-sort-by-attributes"></span>{{_('Sorted Books')}}
|
||||||
<span class="caret"></span>
|
<span class="caret"></span>
|
||||||
</a>
|
</a>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li {% if page == 'newest' %}class="active"{% endif %}><a href="{{url_for('newest_books')}}">{{_('Sort By')}} {{_('Newest')}}</a></li>
|
<li id="nav_sort_old" {% if page == 'newest' %}class="active"{% endif %}><a href="{{url_for('newest_books')}}">{{_('Sort By')}} {{_('Newest')}}</a></li>
|
||||||
<li {% if page == 'oldest' %}class="active"{% endif %}><a href="{{url_for('oldest_books')}}">{{_('Sort By')}} {{_('Oldest')}}</a></li>
|
<li id="nav_sort_new" {% if page == 'oldest' %}class="active"{% endif %}><a href="{{url_for('oldest_books')}}">{{_('Sort By')}} {{_('Oldest')}}</a></li>
|
||||||
<li {% if page == 'a-z' %}class="active"{% endif %}><a href="{{url_for('titles_ascending')}}">{{_('Sort By')}} {{_('Title')}} ({{_('Ascending')}})</a></li>
|
<li id="nav_sort_asc" {% if page == 'a-z' %}class="active"{% endif %}><a href="{{url_for('titles_ascending')}}">{{_('Sort By')}} {{_('Title')}} ({{_('Ascending')}})</a></li>
|
||||||
<li {% if page == 'z-a' %}class="active"{% endif %}><a href="{{url_for('titles_descending')}}">{{_('Sort By')}} {{_('Title')}} ({{_('Descending')}})</a></li>
|
<li id="nav_sort_desc" {% if page == 'z-a' %}class="active"{% endif %}><a href="{{url_for('titles_descending')}}">{{_('Sort By')}} {{_('Title')}} ({{_('Descending')}})</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
{%endif%}
|
{%endif%}
|
||||||
@ -139,13 +139,13 @@
|
|||||||
<li id="nav_hot" {% if page == 'hot' %}class="active"{% endif %}><a href="{{url_for('hot_books')}}"><span class="glyphicon glyphicon-fire"></span>{{_('Hot Books')}}</a></li>
|
<li id="nav_hot" {% if page == 'hot' %}class="active"{% endif %}><a href="{{url_for('hot_books')}}"><span class="glyphicon glyphicon-fire"></span>{{_('Hot Books')}}</a></li>
|
||||||
{%endif%}
|
{%endif%}
|
||||||
{% if g.user.show_best_rated_books() %}
|
{% if g.user.show_best_rated_books() %}
|
||||||
<li {% if page == 'rated' %}class="active"{% endif %}><a href="{{url_for('best_rated_books')}}"><span class="glyphicon glyphicon-star"></span>{{_('Best rated Books')}}</a></li>
|
<li id="nav_rated" {% if page == 'rated' %}class="active"{% endif %}><a href="{{url_for('best_rated_books')}}"><span class="glyphicon glyphicon-star"></span>{{_('Best rated Books')}}</a></li>
|
||||||
{%endif%}
|
{%endif%}
|
||||||
{% if g.user.show_read_and_unread() %}
|
{% if g.user.show_read_and_unread() %}
|
||||||
{% if not g.user.is_anonymous %}
|
{% if not g.user.is_anonymous %}
|
||||||
<li {% if page == 'read' %}class="active"{% endif %}><a href="{{url_for('read_books')}}"><span class="glyphicon glyphicon-eye-open"></span>{{_('Read Books')}}</a></li>
|
<li id="nav_read" {% if page == 'read' %}class="active"{% endif %}><a href="{{url_for('read_books')}}"><span class="glyphicon glyphicon-eye-open"></span>{{_('Read Books')}}</a></li>
|
||||||
{%endif%}
|
{%endif%}
|
||||||
<li {% if page == 'read' %}class="active"{% endif %}><a href="{{url_for('unread_books')}}"><span class="glyphicon glyphicon-eye-close"></span>{{_('Unread Books')}}</a></li>
|
<li id="nav_unread" {% if page == 'read' %}class="active"{% endif %}><a href="{{url_for('unread_books')}}"><span class="glyphicon glyphicon-eye-close"></span>{{_('Unread Books')}}</a></li>
|
||||||
{%endif%}
|
{%endif%}
|
||||||
{% if g.user.show_random_books() %}
|
{% if g.user.show_random_books() %}
|
||||||
<li id="nav_rand" {% if page == 'discover' %}class="active"{% endif %}><a href="{{url_for('discover')}}"><span class="glyphicon glyphicon-random"></span>{{_('Discover')}}</a></li>
|
<li id="nav_rand" {% if page == 'discover' %}class="active"{% endif %}><a href="{{url_for('discover')}}"><span class="glyphicon glyphicon-random"></span>{{_('Discover')}}</a></li>
|
||||||
|
@ -7,15 +7,11 @@
|
|||||||
<label for="nickname">{{_('Username')}}</label>
|
<label for="nickname">{{_('Username')}}</label>
|
||||||
<input type="text" class="form-control" id="nickname" name="nickname" placeholder="{{_('Choose a username')}}" required>
|
<input type="text" class="form-control" id="nickname" name="nickname" placeholder="{{_('Choose a username')}}" required>
|
||||||
</div>
|
</div>
|
||||||
<!--div class="form-group required">
|
|
||||||
<label for="password">{{_('Password')}}</label>
|
|
||||||
<input type="password" class="form-control" id="password" name="password" placeholder="{{_('Choose a password')}}" required>
|
|
||||||
</div-->
|
|
||||||
<div class="form-group required">
|
<div class="form-group required">
|
||||||
<label for="email">{{_('E-mail address')}}</label>
|
<label for="email">{{_('E-mail address')}}</label>
|
||||||
<input type="email" class="form-control" id="email" name="email" placeholder="{{_('Your email address')}}" required>
|
<input type="email" class="form-control" id="email" name="email" placeholder="{{_('Your email address')}}" required>
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="btn btn-primary">{{_('Register')}}</button>
|
<button type="submit" id="submit" class="btn btn-primary">{{_('Register')}}</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
{% if error %}
|
{% if error %}
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<button type="submit" class="btn btn-default">{{_('Submit')}}</button>
|
<button type="submit" class="btn btn-default" id="submit">{{_('Submit')}}</button>
|
||||||
{% if shelf.id != None %}
|
{% if shelf.id != None %}
|
||||||
<a href="{{ url_for('show_shelf', shelf_id=shelf.id) }}" class="btn btn-default">{{_('Back')}}</a>
|
<a href="{{ url_for('show_shelf', shelf_id=shelf.id) }}" class="btn btn-default">{{_('Back')}}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -22,8 +22,6 @@
|
|||||||
<input type="password" class="form-control" name="password" id="password" value="" autocomplete="off">
|
<input type="password" class="form-control" name="password" id="password" value="" autocomplete="off">
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="kindle_mail">{{_('Kindle E-Mail')}}</label>
|
<label for="kindle_mail">{{_('Kindle E-Mail')}}</label>
|
||||||
|
@ -590,7 +590,7 @@ def modify_database_object(input_elements, db_book_object, db_object, db_session
|
|||||||
new_element = db_object(add_element, add_element)
|
new_element = db_object(add_element, add_element)
|
||||||
elif db_type == 'custom':
|
elif db_type == 'custom':
|
||||||
new_element = db_object(value=add_element)
|
new_element = db_object(value=add_element)
|
||||||
else: # db_type should be tag, languages, publisher
|
else: # db_type should be tag, language or publisher
|
||||||
new_element = db_object(add_element)
|
new_element = db_object(add_element)
|
||||||
db_session.add(new_element)
|
db_session.add(new_element)
|
||||||
# add element to book
|
# add element to book
|
||||||
@ -3011,7 +3011,8 @@ def configuration_helper(origin):
|
|||||||
if content.config_logfile != to_save["config_logfile"]:
|
if content.config_logfile != to_save["config_logfile"]:
|
||||||
# check valid path, only path or file
|
# check valid path, only path or file
|
||||||
if os.path.dirname(to_save["config_logfile"]):
|
if os.path.dirname(to_save["config_logfile"]):
|
||||||
if os.path.exists(os.path.dirname(to_save["config_logfile"])):
|
if os.path.exists(os.path.dirname(to_save["config_logfile"])) and \
|
||||||
|
os.path.basename(to_save["config_logfile"]) and not os.path.isdir(to_save["config_logfile"]):
|
||||||
content.config_logfile = to_save["config_logfile"]
|
content.config_logfile = to_save["config_logfile"]
|
||||||
else:
|
else:
|
||||||
ub.session.commit()
|
ub.session.commit()
|
||||||
@ -3059,8 +3060,6 @@ def configuration_helper(origin):
|
|||||||
gdriveError=gdriveError, goodreads=goodreads_support, rarfile_support=rar_support,
|
gdriveError=gdriveError, goodreads=goodreads_support, rarfile_support=rar_support,
|
||||||
title=_(u"Basic Configuration"), page="config")
|
title=_(u"Basic Configuration"), page="config")
|
||||||
if reboot_required:
|
if reboot_required:
|
||||||
# ub.session.close()
|
|
||||||
# ub.engine.dispose()
|
|
||||||
# stop Server
|
# stop Server
|
||||||
server.Server.setRestartTyp(True)
|
server.Server.setRestartTyp(True)
|
||||||
server.Server.stopServer()
|
server.Server.stopServer()
|
||||||
|
@ -487,6 +487,7 @@ class WorkerThread(threading.Thread):
|
|||||||
datetime.now() - self.queue[self.current]['starttime'])
|
datetime.now() - self.queue[self.current]['starttime'])
|
||||||
|
|
||||||
|
|
||||||
|
# Enable logging of smtp lib debug output
|
||||||
class StderrLogger(object):
|
class StderrLogger(object):
|
||||||
|
|
||||||
buffer = ''
|
buffer = ''
|
||||||
|
Loading…
Reference in New Issue
Block a user