Skip to content

Commit

Permalink
Merge pull request #1 from janeczku/master
Browse files Browse the repository at this point in the history
update from base fork
  • Loading branch information
vigri committed Sep 29, 2018
2 parents e08eccb + ffe3dd3 commit 2b9ab96
Show file tree
Hide file tree
Showing 34 changed files with 19,811 additions and 2,787 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
web.py ident export-subst
helper.py ident export-subst
cps/static/css/libs/* linguist-vendored
cps/static/js/libs/* linguist-vendored
4 changes: 4 additions & 0 deletions cps/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,9 @@
print("Keyfilepath is invalid. Exiting...")
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 "":
keyfilepath = ""
19 changes: 7 additions & 12 deletions cps/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,16 +559,11 @@ def is_sha1(sha1):


def get_current_version_info():
try:
with open('version', 'r') as f:
content = f.readlines()
content = [x.strip() for x in content]

if len(content) != 2:
return False

if is_sha1(content[0]) and len(content[1]) > 0:
return {'hash': content[0], 'datetime': content[1]}
except FileNotFoundError:
return False
content = {}
content[0] = '$Format:%H$'
content[1] = '$Format:%cI$'
# content[0] = 'bb7d2c6273ae4560e83950d36d64533343623a57'
# content[1] = '2018-09-09T10:13:08+02:00'
if is_sha1(content[0]) and len(content[1]) > 0:
return {'hash': content[0], 'datetime': content[1]}
return False
8 changes: 7 additions & 1 deletion cps/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from socket import error as SocketError
import sys
import os
import signal

try:
from gevent.pywsgi import WSGIServer
from gevent.pool import Pool
Expand All @@ -26,7 +28,8 @@ class server:
restart= False

def __init__(self):
pass
signal.signal(signal.SIGINT, self.killServer)
signal.signal(signal.SIGTERM, self.killServer)

def start_gevent(self):
try:
Expand Down Expand Up @@ -86,6 +89,9 @@ def startServer(self):
def setRestartTyp(self,starttyp):
self.restart=starttyp

def killServer(self, signum, frame):
self.stopServer()

def stopServer(self):
if gevent_present:
self.wsgiserver.close()
Expand Down
12 changes: 6 additions & 6 deletions cps/templates/admin.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,17 @@ <h2>{{_('Configuration')}}</h2>
<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 class="btn btn-default"><a 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="basic_config" href="{{url_for('configuration')}}">{{_('Basic Configuration')}}</a></div>
<div class="btn btn-default"><a id="view_config" href="{{url_for('view_configuration')}}">{{_('UI Configuration')}}</a></div>
</div>
</div>

<div class="row">
<div class="col">
<h2>{{_('Administration')}}</h2>
<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" data-toggle="modal" data-target="#ShutdownDialog">{{_('Stop 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" id="admin_stop" data-toggle="modal" data-target="#ShutdownDialog">{{_('Stop Calibre-Web')}}</div>
</div>
</div>

Expand All @@ -122,8 +122,8 @@ <h2>{{_('Update')}}</h2>
</thead>
<tbody>
<tr id="current_version">
<td>{{commit}} <i>({{_('current version')}})</i></td>
<td>/</td>
<td>{{commit}} </td>
<td><i>{{_('Current version')}}</i></td>
</tr>
</tbody>
</table>
Expand Down
6 changes: 3 additions & 3 deletions cps/templates/book_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@
{% endif %}
{% endif %}

{% if display_convertbtn and conversion_formats|length > 0 %}
{% if source_formats|length > 0 and conversion_formats|length > 0 %}
<div class="text-center more-stuff"><h4>{{_('Convert book format:')}}</h4>
<form class="padded-bottom" action="{{ url_for('convert_bookformat', book_id=book.id) }}" method="post" id="book_convert_frm">
<div class="form-group">
<div class="text-left">
<label class="control-label" for="book_format_from">{{_('Convert from:')}}</label>
<select class="form-control" name="book_format_from" id="book_format_from">
<option disabled selected value> -- {{_('select an option')}} -- </option>
{% for file in book.data %}
<option>{{file.format}} </option>
{% for format in source_formats %}
<option>{{format|upper}} </option>
{% endfor %}
</select>
<label class="control-label" for="book_format_to">{{_('Convert to:')}}</label>
Expand Down
4 changes: 2 additions & 2 deletions cps/templates/config_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,12 @@ <h4 class="panel-title">


<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 %}
<a href="{{ url_for('admin') }}" class="btn btn-default">{{_('Back')}}</a>
{% endif %}
{% 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 %}
</div>
</form>
Expand Down
2 changes: 1 addition & 1 deletion cps/templates/config_view_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ <h4 class="panel-title">
</div>
</div>
<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>
<a href="{{ url_for('admin') }}" class="btn btn-default">{{_('Back')}}</a>
</div>
</form>
Expand Down
6 changes: 4 additions & 2 deletions cps/templates/detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,10 @@ <h2>{{entry.title|shortentitle(40)}}</h2>


{% if entry.comments|length > 0 and entry.comments[0].text|length > 0%}
<h3>{{_('Description:')}}</h3>
{{entry.comments[0].text|safe}}
<div class="comments">
<h3>{{_('Description:')}}</h3>
{{entry.comments[0].text|safe}}
</div>
{% endif %}


Expand Down
20 changes: 10 additions & 10 deletions cps/templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -122,30 +122,30 @@ <h3>{{_('Uploading...')}}</h3>
<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%}
{% 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">
<span class="glyphicon glyphicon-sort-by-attributes"></span>{{_('Sorted Books')}}
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li {% 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 {% 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_old" {% if page == 'newest' %}class="active"{% endif %}><a href="{{url_for('newest_books')}}">{{_('Sort By')}} {{_('Newest')}}</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 id="nav_sort_asc" {% if page == 'a-z' %}class="active"{% endif %}><a href="{{url_for('titles_ascending')}}">{{_('Sort By')}} {{_('Title')}} ({{_('Ascending')}})</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>
</li>
{%endif%}
{% if g.user.show_hot_books() %}
<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%}
{% 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%}
{% if g.user.show_read_and_unread() %}
{% 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%}
<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%}
{% 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>
Expand All @@ -165,11 +165,11 @@ <h3>{{_('Uploading...')}}</h3>
{% if g.user.is_authenticated or g.user.is_anonymous %}
<li class="nav-head hidden-xs">{{_('Public Shelves')}}</li>
{% for shelf in g.public_shelfes %}
<li><a href="{{url_for('show_shelf', shelf_id=shelf.id)}}"><span class="glyphicon glyphicon-list"></span>{{shelf.name}}</a></li>
<li><a href="{{url_for('show_shelf', shelf_id=shelf.id)}}"><span class="glyphicon glyphicon-list public_shelf"></span>{{shelf.name|shortentitle(40)}}</a></li>
{% endfor %}
<li class="nav-head hidden-xs">{{_('Your Shelves')}}</li>
{% for shelf in g.user.shelf %}
<li><a href="{{url_for('show_shelf', shelf_id=shelf.id)}}"><span class="glyphicon glyphicon-list"></span>{{shelf.name}}</a></li>
<li><a href="{{url_for('show_shelf', shelf_id=shelf.id)}}"><span class="glyphicon glyphicon-list private_shelf"></span>{{shelf.name|shortentitle(40)}}</a></li>
{% endfor %}
{% if not g.user.is_anonymous %}
<li id="nav_createshelf" class="create-shelf"><a href="{{url_for('create_shelf')}}">{{_('Create a Shelf')}}</a></li>
Expand Down
6 changes: 1 addition & 5 deletions cps/templates/register.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,11 @@ <h2 style="margin-top: 0">{{_('Register a new account')}}</h2>
<label for="nickname">{{_('Username')}}</label>
<input type="text" class="form-control" id="nickname" name="nickname" placeholder="{{_('Choose a username')}}" required>
</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">
<label for="email">{{_('E-mail address')}}</label>
<input type="email" class="form-control" id="email" name="email" placeholder="{{_('Your email address')}}" required>
</div>
<button type="submit" class="btn btn-primary">{{_('Register')}}</button>
<button type="submit" id="submit" class="btn btn-primary">{{_('Register')}}</button>
</form>
</div>
{% if error %}
Expand Down
20 changes: 11 additions & 9 deletions cps/templates/shelf.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,23 @@
<h2>{{title}}</h2>
{% if g.user.is_authenticated %}
{% if (g.user.role_edit_shelfs() and shelf.is_public ) or not shelf.is_public %}
<div data-toggle="modal" data-target="#DeleteShelfDialog" class="btn btn-danger">{{ _('Delete this Shelf') }} </div>
<a href="{{ url_for('edit_shelf', shelf_id=shelf.id) }}" class="btn btn-primary">{{ _('Edit Shelf') }} </a>
<a href="{{ url_for('order_shelf', shelf_id=shelf.id) }}" class="btn btn-primary">{{ _('Change order') }} </a>
<div id="delete_shelf" data-toggle="modal" data-target="#DeleteShelfDialog" class="btn btn-danger">{{ _('Delete this Shelf') }} </div>
<a id="edit_shelf" href="{{ url_for('edit_shelf', shelf_id=shelf.id) }}" class="btn btn-primary">{{ _('Edit Shelf') }} </a>
<a id="order_shelf" href="{{ url_for('order_shelf', shelf_id=shelf.id) }}" class="btn btn-primary">{{ _('Change order') }} </a>
{% endif %}
{% endif %}
<div class="row">

{% for entry in entries %}
<div class="col-sm-3 col-lg-2 col-xs-6 book">
<div class="cover">
{% if entry.has_cover is defined %}
<a href="{{ url_for('show_book', book_id=entry.id) }}" data-toggle="modal" data-target="#bookDetailsModal" data-remote="false">
<img src="{{ url_for('get_cover', cover_path=entry.path.replace('\\','/')) }}" />
</a>
{% endif %}
<a href="{{ url_for('show_book', book_id=entry.id) }}" data-toggle="modal" data-target="#bookDetailsModal" data-remote="false">
{% if entry.has_cover %}
<img src="{{ url_for('get_cover', cover_path=entry.path.replace('\\','/')) }}" alt="{{ entry.title }}" />
{% else %}
<img src="{{ url_for('static', filename='generic_cover.jpg') }}" alt="{{ entry.title }}" />
{% endif %}
</a>
</div>
<div class="meta">
<p class="title">{{entry.title|shortentitle}}</p>
Expand Down Expand Up @@ -56,7 +58,7 @@ <h2>{{title}}</h2>
<div class="modal-body text-center">
<span>{{_('Shelf will be lost for everybody and forever!')}}</span>
<p></p>
<a href="{{ url_for('delete_shelf', shelf_id=shelf.id) }}" class="btn btn-danger">{{_('Ok')}}</a>
<a id="confirm" href="{{ url_for('delete_shelf', shelf_id=shelf.id) }}" class="btn btn-danger">{{_('Ok')}}</a>
<button type="button" class="btn btn-default" data-dismiss="modal">{{_('Back')}}</button>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion cps/templates/shelf_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ <h1>{{title}}</h1>
</label>
</div>
{% 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 %}
<a href="{{ url_for('show_shelf', shelf_id=shelf.id) }}" class="btn btn-default">{{_('Back')}}</a>
{% endif %}
Expand Down
6 changes: 2 additions & 4 deletions cps/templates/user_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ <h1>{{title}}</h1>
<input type="password" class="form-control" name="password" id="password" value="" autocomplete="off">
</div>
{% endif %}


{% endif %}
<div class="form-group">
<label for="kindle_mail">{{_('Kindle E-Mail')}}</label>
Expand Down Expand Up @@ -142,7 +140,7 @@ <h1>{{title}}</h1>
{% if g.user and g.user.role_admin() and not profile and not new_user and not content.role_anonymous() %}
<div class="checkbox">
<label>
<input type="checkbox" name="delete"> {{_('Delete this user')}}
<input type="checkbox" id="delete" name="delete"> {{_('Delete this user')}}
</label>
</div>
{% endif %}
Expand All @@ -151,8 +149,8 @@ <h1>{{title}}</h1>
<button type="submit" id="submit" class="btn btn-default">{{_('Submit')}}</button>
{% if not profile %}
<a href="{{ url_for('admin') }}" id="back" class="btn btn-default">{{_('Back')}}</a>
</div>
{% endif %}
</div>
</form>

{% if downloads %}
Expand Down
Binary file modified cps/translations/de/LC_MESSAGES/messages.mo
Binary file not shown.
Loading

0 comments on commit 2b9ab96

Please sign in to comment.