Commit c73698e8 authored by Radosław Kierznowski's avatar Radosław Kierznowski
parents 43ad7d6e 7e530618
......@@ -35,6 +35,13 @@ try:
from flask_login import __version__ as flask_loginVersion
except ImportError:
from flask_login.__about__ import __version__ as flask_loginVersion
try:
import unidecode
unidecode_version = _(u'installed')
except ImportError:
unidecode_version = _(u'not installed')
from . import services
about = flask.Blueprint('about', __name__)
......@@ -54,6 +61,9 @@ _VERSIONS = OrderedDict(
SQLite=sqlite3.sqlite_version,
iso639=isoLanguages.__version__,
pytz=pytz.__version__,
Unidecode = unidecode_version,
Flask_SimpleLDAP = _(u'installed') if bool(services.ldap) else _(u'not installed'),
Goodreads = _(u'installed') if bool(services.goodreads) else _(u'not installed'),
)
_VERSIONS.update(uploader.get_versions())
......
......@@ -41,11 +41,13 @@ def extractCover(tmp_file_name, original_file_extension):
if use_comic_meta:
archive = ComicArchive(tmp_file_name)
cover_data = None
ext = os.path.splitext(archive.getPageName(0))
if len(ext) > 1:
extension = ext[1].lower()
if extension == '.jpg' or extension == '.jpeg':
cover_data = archive.getPage(0)
for index, name in enumerate(archive.getPageNameList()):
ext = os.path.splitext(name)
if len(ext) > 1:
extension = ext[1].lower()
if extension == '.jpg' or extension == '.jpeg':
cover_data = archive.getPage(index)
break
else:
if original_file_extension.upper() == '.CBZ':
cf = zipfile.ZipFile(tmp_file_name)
......@@ -53,7 +55,7 @@ def extractCover(tmp_file_name, original_file_extension):
ext = os.path.splitext(name)
if len(ext) > 1:
extension = ext[1].lower()
if extension == '.jpg':
if extension == '.jpg' or extension == '.jpeg':
cover_data = cf.read(name)
break
elif original_file_extension.upper() == '.CBT':
......@@ -62,7 +64,7 @@ def extractCover(tmp_file_name, original_file_extension):
ext = os.path.splitext(name)
if len(ext) > 1:
extension = ext[1].lower()
if extension == '.jpg':
if extension == '.jpg' or extension == '.jpeg':
cover_data = cf.extractfile(name).read()
break
prefix = os.path.dirname(tmp_file_name)
......@@ -87,16 +89,17 @@ def get_comic_info(tmp_file_path, original_file_name, original_file_extension):
else:
style = None
if style is not None:
loadedMetadata = archive.readMetadata(style)
# if style is not None:
loadedMetadata = archive.readMetadata(style)
lang = loadedMetadata.language
if len(lang) == 2:
loadedMetadata.language = isoLanguages.get(part1=lang).name
elif len(lang) == 3:
loadedMetadata.language = isoLanguages.get(part3=lang).name
else:
loadedMetadata.language = ""
lang = loadedMetadata.language
if lang:
if len(lang) == 2:
loadedMetadata.language = isoLanguages.get(part1=lang).name
elif len(lang) == 3:
loadedMetadata.language = isoLanguages.get(part3=lang).name
else:
loadedMetadata.language = ""
return BookMeta(
file_path=tmp_file_path,
......
......@@ -785,4 +785,4 @@ def get_download_link(book_id, book_format):
############### Database Helper functions
def lcase(s):
return unidecode.unidecode(s.lower())
return unidecode.unidecode(s.lower()) if use_unidecode else s.lower()
......@@ -95,13 +95,6 @@ def setup(log_file, log_level=None):
Configure the logging output.
May be called multiple times.
'''
# if debugging, start logging to stderr immediately
if os.environ.get('FLASK_DEBUG', None):
log_file = LOG_TO_STDERR
log_level = logging.DEBUG
log_file = _absolute_log_file(log_file, DEFAULT_LOG_FILE)
log_level = log_level or DEFAULT_LOG_LEVEL
logging.getLogger(__package__).setLevel(log_level)
......@@ -110,6 +103,8 @@ def setup(log_file, log_level=None):
# avoid spamming the log with debug messages from libraries
r.setLevel(log_level)
log_file = _absolute_log_file(log_file, DEFAULT_LOG_FILE)
previous_handler = r.handlers[0] if r.handlers else None
if previous_handler:
# if the log_file has not changed, don't create a new handler
......@@ -167,3 +162,7 @@ class StderrLogger(object):
self.buffer += message
except Exception:
self.log.debug("Logging Error")
# default configuration, before application settngs are applied
setup(LOG_TO_STDERR, logging.DEBUG if os.environ.get('FLASK_DEBUG') else DEFAULT_LOG_LEVEL)
......@@ -56,6 +56,7 @@ def requires_basic_auth_if_no_ano(f):
@opds.route("/opds/")
@opds.route("/opds")
@requires_basic_auth_if_no_ano
def feed_index():
return render_xml_template('index.xml')
......@@ -288,7 +289,7 @@ def check_auth(username, password):
username=username.encode('windows-1252')
user = ub.session.query(ub.User).filter(func.lower(ub.User.nickname) ==
username.decode('utf-8').lower()).first()
return bool(user and check_password_hash(user.password, password))
return bool(user and check_password_hash(str(user.password), password))
def authenticate():
......
......@@ -26,11 +26,13 @@ log = logger.create()
try: from . import goodreads
except ImportError as err:
log.warning("goodreads: %s", err)
log.debug("cannot import goodreads, showing authors-metadata will not work: %s", err)
goodreads = None
try: from . import simpleldap as ldap
except ImportError as err:
log.warning("simpleldap: %s", err)
log.debug("cannot import simpleldap, logging in with ldap will not work: %s", err)
ldap = None
......@@ -268,7 +268,6 @@ def delete_shelf(shelf_id):
# @shelf.route("/shelfdown/<int:shelf_id>")
@shelf.route("/shelf/<int:shelf_id>", defaults={'shelf_type': 1})
@shelf.route("/shelf/<int:shelf_id>/<int:shelf_type>")
@login_required
def show_shelf(shelf_type, shelf_id):
if current_user.is_anonymous:
shelf = ub.session.query(ub.Shelf).filter(ub.Shelf.is_public == 1, ub.Shelf.id == shelf_id).first()
......
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
......@@ -52,7 +52,7 @@
<div class="navbar-collapse collapse">
{% if g.user.is_authenticated or g.allow_anonymous %}
<ul class="nav navbar-nav ">
<li><a href="{{url_for('web.advanced_search')}}"><span class="glyphicon glyphicon-search"></span><span class="hidden-sm"> {{_('Advanced Search')}}</span></a></li>
<li><a href="{{url_for('web.advanced_search')}}"><span class="glyphicon glyphicon-search"></span><span class="hidden-sm">{{_('Advanced Search')}}</span></a></li>
</ul>
{% endif %}
<ul class="nav navbar-nav navbar-right" id="main-nav">
......@@ -128,7 +128,7 @@
{% endif %}
{% endfor %}
{% if g.user.is_authenticated or allow_anonymous %}
{% if g.user.is_authenticated or g.allow_anonymous %}
<li class="nav-head hidden-xs public-shelves">{{_('Public Shelves')}}</li>
{% for shelf in g.public_shelfes %}
<li><a href="{{url_for('shelf.show_shelf', shelf_id=shelf.id)}}"><span class="glyphicon glyphicon-list public_shelf"></span>{{shelf.name|shortentitle(40)}}</a></li>
......
......@@ -5,20 +5,30 @@
# FIRST AUTHOR OzzieIsaacs, 2016.
msgid ""
msgstr ""
"Project-Id-Version: Calibre-Web\n"
"Project-Id-Version: Calibre-Web\n"
"Report-Msgid-Bugs-To: https://github.com/janeczku/Calibre-Web\n"
"POT-Creation-Date: 2019-07-26 17:19+0200\n"
"PO-Revision-Date: 2019-06-22 19:54+0200\n"
"POT-Creation-Date: 2019-08-06 18:35+0200\n"
"PO-Revision-Date: 2019-08-06 18:36+0200\n"
"Last-Translator: Ozzie Isaacs\n"
"Language: de\n"
"Language-Team: \n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.7.0\n"
"X-Generator: Poedit 2.2.3\n"
#: cps/about.py:70
#: cps/about.py:40
msgid "installed"
msgstr "Installiert"
#: cps/about.py:42 cps/uploader.py:213 cps/uploader.py:214 cps/uploader.py:218
#: cps/uploader.py:222 cps/uploader.py:226
msgid "not installed"
msgstr "Nicht installiert"
#: cps/about.py:76
msgid "Statistics"
msgstr "Statistiken"
......@@ -276,125 +286,133 @@ msgstr "Google Drive Setup is nicht komplett, bitte versuche Google Drive zu dea
msgid "Callback domain is not verified, please follow steps to verify domain in google developer console"
msgstr "Callback Domain ist nicht verifiziert, bitte Domain in der Google Developer Console verifizieren"
#: cps/helper.py:79
#: cps/helper.py:53
msgid "Installed"
msgstr ""
#: cps/helper.py:56
msgid "Not installed"
msgstr ""
#: cps/helper.py:81
#, python-format
msgid "%(format)s format not found for book id: %(book)d"
msgstr "%(format)s Format für Buch-ID %(book)d nicht gefunden "
#: cps/helper.py:91
#: cps/helper.py:93
#, python-format
msgid "%(format)s not found on Google Drive: %(fn)s"
msgstr "%(format)s von Buch %(fn)s nicht auf Google Drive gefunden"
#: cps/helper.py:98 cps/helper.py:206 cps/templates/detail.html:41
#: cps/helper.py:100 cps/helper.py:208 cps/templates/detail.html:41
#: cps/templates/detail.html:45
msgid "Send to Kindle"
msgstr "An Kindle senden"
#: cps/helper.py:99 cps/helper.py:117 cps/helper.py:208
#: cps/helper.py:101 cps/helper.py:119 cps/helper.py:210
msgid "This e-mail has been sent via Calibre-Web."
msgstr "Diese E-Mail wurde durch Calibre-Web versendet."
#: cps/helper.py:110
#: cps/helper.py:112
#, python-format
msgid "%(format)s not found: %(fn)s"
msgstr "%(format)s nicht gefunden: %(fn)s"
#: cps/helper.py:115
#: cps/helper.py:117
msgid "Calibre-Web test e-mail"
msgstr "Calibre-Web Test-E-Mail"
#: cps/helper.py:117
#: cps/helper.py:119
msgid "Test e-mail"
msgstr "Test-E-Mail"
#: cps/helper.py:132
#: cps/helper.py:134
msgid "Get Started with Calibre-Web"
msgstr "Loslegen mit Calibre-Web"
#: cps/helper.py:134
#: cps/helper.py:136
#, python-format
msgid "Registration e-mail for user: %(name)s"
msgstr "Registrierungs-E-Mail für Benutzer %(name)s"
#: cps/helper.py:148 cps/helper.py:150 cps/helper.py:152 cps/helper.py:160
#: cps/helper.py:162 cps/helper.py:164
#: cps/helper.py:150 cps/helper.py:152 cps/helper.py:154 cps/helper.py:162
#: cps/helper.py:164 cps/helper.py:166
#, python-format
msgid "Send %(format)s to Kindle"
msgstr "Sende %(format)s an Kindle"
#: cps/helper.py:168
#: cps/helper.py:170
#, python-format
msgid "Convert %(orig)s to %(format)s and send to Kindle"
msgstr "Konvertiere %(orig)s nach %(format)s und sende an Kindle"
#: cps/helper.py:208
#: cps/helper.py:210
#, python-format
msgid "E-mail: %(book)s"
msgstr "E-Mail: %(book)s"
#: cps/helper.py:210
#: cps/helper.py:212
msgid "The requested file could not be read. Maybe wrong permissions?"
msgstr "Die angeforderte Datei konnte nicht gelesen werden. Evtl. falsche Zugriffsrechte?"
#: cps/helper.py:317
#: cps/helper.py:319
#, python-format
msgid "Rename title from: '%(src)s' to '%(dest)s' failed with error: %(error)s"
msgstr "Umbenennen des Titels '%(src)s' zu '%(dest)s' schlug fehl: %(error)s"
#: cps/helper.py:327
#: cps/helper.py:329
#, python-format
msgid "Rename author from: '%(src)s' to '%(dest)s' failed with error: %(error)s"
msgstr "Umbenennen des Authors '%(src)s' zu '%(dest)s' schlug fehl: %(error)s"
#: cps/helper.py:341
#: cps/helper.py:343
#, python-format
msgid "Rename file in path '%(src)s' to '%(dest)s' failed with error: %(error)s"
msgstr "Umbenennen der Datei im Pfad '%(src)s' nach '%(dest)s' ist fehlgeschlagen: %(error)s"
#: cps/helper.py:367 cps/helper.py:377 cps/helper.py:385
#: cps/helper.py:369 cps/helper.py:379 cps/helper.py:387
#, python-format
msgid "File %(file)s not found on Google Drive"
msgstr "Datei %(file)s wurde nicht auf Google Drive gefunden"
#: cps/helper.py:406
#: cps/helper.py:408
#, python-format
msgid "Book path %(path)s not found on Google Drive"
msgstr "Buchpfad %(path)s wurde nicht auf Google Drive gefunden"
#: cps/helper.py:623
#: cps/helper.py:625
msgid "Waiting"
msgstr "Wartend"
#: cps/helper.py:625
#: cps/helper.py:627
msgid "Failed"
msgstr "Fehlgeschlagen"
#: cps/helper.py:627
#: cps/helper.py:629
msgid "Started"
msgstr "Gestartet"
#: cps/helper.py:629
#: cps/helper.py:631
msgid "Finished"
msgstr "Beendet"
#: cps/helper.py:631
#: cps/helper.py:633
msgid "Unknown Status"
msgstr "Unbekannter Status"
#: cps/helper.py:636
#: cps/helper.py:638
msgid "E-mail: "
msgstr "E-Mail: "
#: cps/helper.py:638 cps/helper.py:642
#: cps/helper.py:640 cps/helper.py:644
msgid "Convert: "
msgstr "Konvertiere: "
#: cps/helper.py:640
#: cps/helper.py:642
msgid "Upload: "
msgstr "Upload: "
#: cps/helper.py:644
#: cps/helper.py:646
msgid "Unknown Task: "
msgstr "Unbekannte Aufgabe: "
......@@ -676,11 +694,6 @@ msgstr "Ein neues Update ist verfügbar. Klicke auf den Button unten, um auf Ver
msgid "Click on the button below to update to the latest stable version."
msgstr "Klicke auf den Button unten, um auf die letzte stabile Version zu aktualisieren."
#: cps/uploader.py:213 cps/uploader.py:214 cps/uploader.py:218
#: cps/uploader.py:222 cps/uploader.py:226
msgid "not installed"
msgstr "Nicht installiert"
#: cps/web.py:460
msgid "Recently Added Books"
msgstr "Kürzlich hinzugefügte Bücher"
......@@ -2301,4 +2314,3 @@ msgstr "Letzte Downloads"
#~ msgid "Google OAuth Client Secret"
#~ msgstr "Google OAuth Client-Secret"
This diff is collapsed.
......@@ -224,11 +224,16 @@ def get_versions():
PILVersion = 'v' + PILversion
else:
PILVersion = _(u'not installed')
if comic.use_comic_meta:
ComicVersion = _(u'installed')
else:
ComicVersion = _(u'not installed')
return {'Image Magick': IVersion,
'PyPdf': PVersion,
'lxml':XVersion,
'Wand': WVersion,
'Pillow': PILVersion}
'Pillow': PILVersion,
'Comic_API': ComicVersion}
def upload(uploadfile):
......
......@@ -133,7 +133,7 @@ def load_user_from_header(header_val):
except TypeError:
pass
user = ub.session.query(ub.User).filter(func.lower(ub.User.nickname) == basic_username.lower()).first()
if user and check_password_hash(user.password, basic_password):
if user and check_password_hash(str(user.password), basic_password):
return user
return
......@@ -1115,7 +1115,7 @@ def login():
log.info('LDAP Login failed for user "%s" IP-adress: %s', form['username'], ipAdress)
flash(_(u"Wrong Username or Password"), category="error")
else:
if user and check_password_hash(user.password, form['password']) and user.nickname != "Guest":
if user and check_password_hash(str(user.password), form['password']) and user.nickname != "Guest":
login_user(user, remember=True)
flash(_(u"You are now logged in as: '%(nickname)s'", nickname=user.nickname), category="success")
return redirect_back(url_for("web.index"))
......
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2019-07-26 16:41+0200\n"
"POT-Creation-Date: 2019-08-06 18:35+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
......@@ -17,7 +17,16 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.7.0\n"
#: cps/about.py:70
#: cps/about.py:40
msgid "installed"
msgstr ""
#: cps/about.py:42 cps/uploader.py:213 cps/uploader.py:214 cps/uploader.py:218
#: cps/uploader.py:222 cps/uploader.py:226
msgid "not installed"
msgstr ""
#: cps/about.py:76
msgid "Statistics"
msgstr ""
......@@ -275,125 +284,133 @@ msgstr ""
msgid "Callback domain is not verified, please follow steps to verify domain in google developer console"
msgstr ""
#: cps/helper.py:79
#: cps/helper.py:53
msgid "Installed"
msgstr ""
#: cps/helper.py:56
msgid "Not installed"
msgstr ""
#: cps/helper.py:81
#, python-format
msgid "%(format)s format not found for book id: %(book)d"
msgstr ""
#: cps/helper.py:91
#: cps/helper.py:93
#, python-format
msgid "%(format)s not found on Google Drive: %(fn)s"
msgstr ""
#: cps/helper.py:98 cps/helper.py:206 cps/templates/detail.html:41
#: cps/helper.py:100 cps/helper.py:208 cps/templates/detail.html:41
#: cps/templates/detail.html:45
msgid "Send to Kindle"
msgstr ""
#: cps/helper.py:99 cps/helper.py:117 cps/helper.py:208
#: cps/helper.py:101 cps/helper.py:119 cps/helper.py:210
msgid "This e-mail has been sent via Calibre-Web."
msgstr ""
#: cps/helper.py:110
#: cps/helper.py:112
#, python-format
msgid "%(format)s not found: %(fn)s"
msgstr ""
#: cps/helper.py:115
#: cps/helper.py:117
msgid "Calibre-Web test e-mail"
msgstr ""
#: cps/helper.py:117
#: cps/helper.py:119
msgid "Test e-mail"
msgstr ""
#: cps/helper.py:132
#: cps/helper.py:134
msgid "Get Started with Calibre-Web"
msgstr ""
#: cps/helper.py:134
#: cps/helper.py:136
#, python-format
msgid "Registration e-mail for user: %(name)s"
msgstr ""
#: cps/helper.py:148 cps/helper.py:150 cps/helper.py:152 cps/helper.py:160
#: cps/helper.py:162 cps/helper.py:164
#: cps/helper.py:150 cps/helper.py:152 cps/helper.py:154 cps/helper.py:162
#: cps/helper.py:164 cps/helper.py:166
#, python-format
msgid "Send %(format)s to Kindle"
msgstr ""
#: cps/helper.py:168
#: cps/helper.py:170
#, python-format
msgid "Convert %(orig)s to %(format)s and send to Kindle"
msgstr ""
#: cps/helper.py:208
#: cps/helper.py:210
#, python-format
msgid "E-mail: %(book)s"
msgstr ""
#: cps/helper.py:210
#: cps/helper.py:212
msgid "The requested file could not be read. Maybe wrong permissions?"
msgstr ""
#: cps/helper.py:317
#: cps/helper.py:319
#, python-format
msgid "Rename title from: '%(src)s' to '%(dest)s' failed with error: %(error)s"
msgstr ""
#: cps/helper.py:327
#: cps/helper.py:329
#, python-format
msgid "Rename author from: '%(src)s' to '%(dest)s' failed with error: %(error)s"
msgstr ""
#: cps/helper.py:341
#: cps/helper.py:343
#, python-format
msgid "Rename file in path '%(src)s' to '%(dest)s' failed with error: %(error)s"
msgstr ""
#: cps/helper.py:367 cps/helper.py:377 cps/helper.py:385
#: cps/helper.py:369 cps/helper.py:379 cps/helper.py:387
#, python-format
msgid "File %(file)s not found on Google Drive"
msgstr ""
#: cps/helper.py:406
#: cps/helper.py:408
#, python-format
msgid "Book path %(path)s not found on Google Drive"
msgstr ""
#: cps/helper.py:623
#: cps/helper.py:625
msgid "Waiting"
msgstr ""
#: cps/helper.py:625
#: cps/helper.py:627
msgid "Failed"
msgstr ""
#: cps/helper.py:627
#: cps/helper.py:629
msgid "Started"
msgstr ""
#: cps/helper.py:629
#: cps/helper.py:631
msgid "Finished"
msgstr ""
#: cps/helper.py:631
#: cps/helper.py:633
msgid "Unknown Status"
msgstr ""
#: cps/helper.py:636
#: cps/helper.py:638
msgid "E-mail: "
msgstr ""
#: cps/helper.py:638 cps/helper.py:642
#: cps/helper.py:640 cps/helper.py:644
msgid "Convert: "
msgstr ""
#: cps/helper.py:640
#: cps/helper.py:642
msgid "Upload: "
msgstr ""
#: cps/helper.py:644
#: cps/helper.py:646
msgid "Unknown Task: "
msgstr ""
......@@ -675,11 +692,6 @@ msgstr ""
msgid "Click on the button below to update to the latest stable version."
msgstr ""
#: cps/uploader.py:213 cps/uploader.py:214 cps/uploader.py:218
#: cps/uploader.py:222 cps/uploader.py:226
msgid "not installed"
msgstr ""
#: cps/web.py:460
msgid "Recently Added Books"
msgstr ""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment