Merge branch 'master' into Develop

# Conflicts:
#	cps/helper.py
This commit is contained in:
Ozzieisaacs 2020-05-10 19:04:29 +02:00
commit 16a3deec2c
12 changed files with 412 additions and 391 deletions

View File

@ -56,10 +56,17 @@ mimetypes.add_type('application/ogg', '.ogg')
mimetypes.add_type('application/ogg', '.oga') mimetypes.add_type('application/ogg', '.oga')
app = Flask(__name__) app = Flask(__name__)
app.config.update(
SESSION_COOKIE_HTTPONLY=True,
SESSION_COOKIE_SAMESITE='Lax',
REMEMBER_COOKIE_SAMESITE='Lax', # will be available in flask-login 0.5.1 earliest
)
lm = LoginManager() lm = LoginManager()
lm.login_view = 'web.login' lm.login_view = 'web.login'
lm.anonymous_user = ub.Anonymous lm.anonymous_user = ub.Anonymous
lm.session_protection = 'strong'
ub.init_db(cli.settingspath) ub.init_db(cli.settingspath)
# pylint: disable=no-member # pylint: disable=no-member

View File

@ -104,11 +104,11 @@ class Identifiers(Base):
if self.type == "amazon": if self.type == "amazon":
return u"https://amzn.com/{0}".format(self.val) return u"https://amzn.com/{0}".format(self.val)
elif self.type == "isbn": elif self.type == "isbn":
return u"http://www.worldcat.org/isbn/{0}".format(self.val) return u"https://www.worldcat.org/isbn/{0}".format(self.val)
elif self.type == "doi": elif self.type == "doi":
return u"http://dx.doi.org/{0}".format(self.val) return u"https://dx.doi.org/{0}".format(self.val)
elif self.type == "goodreads": elif self.type == "goodreads":
return u"http://www.goodreads.com/book/show/{0}".format(self.val) return u"https://www.goodreads.com/book/show/{0}".format(self.val)
elif self.type == "douban": elif self.type == "douban":
return u"https://book.douban.com/subject/{0}".format(self.val) return u"https://book.douban.com/subject/{0}".format(self.val)
elif self.type == "google": elif self.type == "google":
@ -116,7 +116,7 @@ class Identifiers(Base):
elif self.type == "kobo": elif self.type == "kobo":
return u"https://www.kobo.com/ebook/{0}".format(self.val) return u"https://www.kobo.com/ebook/{0}".format(self.val)
elif self.type == "lubimyczytac": elif self.type == "lubimyczytac":
return u" http://lubimyczytac.pl/ksiazka/{0}".format(self.val) return u" https://lubimyczytac.pl/ksiazka/{0}".format(self.val)
elif self.type == "url": elif self.type == "url":
return u"{0}".format(self.val) return u"{0}".format(self.val)
else: else:

View File

@ -467,7 +467,7 @@ def reset_password(user_id):
def generate_random_password(): def generate_random_password():
s = "abcdefghijklmnopqrstuvwxyz01234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%&*()?" s = "abcdefghijklmnopqrstuvwxyz01234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%&*()?"
passlen = 8 passlen = 8
return "".join(random.sample(s, passlen)) return "".join(s[c % len(s)] for c in os.urandom(passlen))
################################## External interface ################################## External interface
@ -615,8 +615,9 @@ def do_download_file(book, book_format, client, data, headers):
headers["Content-Disposition"] = headers["Content-Disposition"].replace(".kepub", ".kepub.epub") headers["Content-Disposition"] = headers["Content-Disposition"].replace(".kepub", ".kepub.epub")
response = make_response(send_from_directory(filename, data.name + "." + book_format)) response = make_response(send_from_directory(filename, data.name + "." + book_format))
# ToDo Check headers parameter
response.headers = headers for element in headers:
response.headers[element[0]] = element[1]
return response return response
################################## ##################################

View File

@ -979,7 +979,7 @@ def NATIVE_KOBO_RESOURCES():
"blackstone_header": {"key": "x-amz-request-payer", "value": "requester"}, "blackstone_header": {"key": "x-amz-request-payer", "value": "requester"},
"book": "https://storeapi.kobo.com/v1/products/books/{ProductId}", "book": "https://storeapi.kobo.com/v1/products/books/{ProductId}",
"book_detail_page": "https://store.kobobooks.com/{culture}/ebook/{slug}", "book_detail_page": "https://store.kobobooks.com/{culture}/ebook/{slug}",
"book_detail_page_rakuten": "http://books.rakuten.co.jp/rk/{crossrevisionid}", "book_detail_page_rakuten": "https://books.rakuten.co.jp/rk/{crossrevisionid}",
"book_landing_page": "https://store.kobobooks.com/ebooks", "book_landing_page": "https://store.kobobooks.com/ebooks",
"book_subscription": "https://storeapi.kobo.com/v1/products/books/subscriptions", "book_subscription": "https://storeapi.kobo.com/v1/products/books/subscriptions",
"categories": "https://storeapi.kobo.com/v1/categories", "categories": "https://storeapi.kobo.com/v1/categories",
@ -1017,7 +1017,7 @@ def NATIVE_KOBO_RESOURCES():
"get_tests_request": "https://storeapi.kobo.com/v1/analytics/gettests", "get_tests_request": "https://storeapi.kobo.com/v1/analytics/gettests",
"giftcard_epd_redeem_url": "https://www.kobo.com/{storefront}/{language}/redeem-ereader", "giftcard_epd_redeem_url": "https://www.kobo.com/{storefront}/{language}/redeem-ereader",
"giftcard_redeem_url": "https://www.kobo.com/{storefront}/{language}/redeem", "giftcard_redeem_url": "https://www.kobo.com/{storefront}/{language}/redeem",
"help_page": "http://www.kobo.com/help", "help_page": "https://www.kobo.com/help",
"kobo_audiobooks_enabled": "False", "kobo_audiobooks_enabled": "False",
"kobo_audiobooks_orange_deal_enabled": "False", "kobo_audiobooks_orange_deal_enabled": "False",
"kobo_audiobooks_subscriptions_enabled": "False", "kobo_audiobooks_subscriptions_enabled": "False",

View File

@ -40,7 +40,7 @@ try:
Stores and retrieves OAuth tokens using a relational database through Stores and retrieves OAuth tokens using a relational database through
the `SQLAlchemy`_ ORM. the `SQLAlchemy`_ ORM.
.. _SQLAlchemy: http://www.sqlalchemy.org/ .. _SQLAlchemy: https://www.sqlalchemy.org/
""" """
def __init__(self, model, session, provider_id, def __init__(self, model, session, provider_id,
user=None, user_id=None, user_required=None, anon_user=None, user=None, user_id=None, user_required=None, anon_user=None,

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1526,7 +1526,7 @@ def profile():
current_user.kindle_mail = to_save["kindle_mail"] current_user.kindle_mail = to_save["kindle_mail"]
if "allowed_tags" in to_save and to_save["allowed_tags"] != current_user.allowed_tags: if "allowed_tags" in to_save and to_save["allowed_tags"] != current_user.allowed_tags:
current_user.allowed_tags = to_save["allowed_tags"].strip() current_user.allowed_tags = to_save["allowed_tags"].strip()
if to_save["email"] and to_save["email"] != current_user.email: if "email" in to_save and to_save["email"] != current_user.email:
if config.config_public_reg and not check_valid_domain(to_save["email"]): if config.config_public_reg and not check_valid_domain(to_save["email"]):
flash(_(u"E-mail is not from valid domain"), category="error") flash(_(u"E-mail is not from valid domain"), category="error")
return render_title_template("user_edit.html", content=current_user, downloads=downloads, return render_title_template("user_edit.html", content=current_user, downloads=downloads,

View File

@ -36,17 +36,17 @@
<div class="col-xs-12 col-sm-6"> <div class="col-xs-12 col-sm-6">
<div class="row"> <div class="row">
<div class="col-xs-6 col-md-6 col-sm-offset-3" style="margin-top:50px;"> <div class="col-xs-6 col-md-6 col-sm-offset-3" style="margin-top:50px;">
<p class='text-justify attribute'><strong>Start Time: </strong>2020-05-05 19:02:03</p> <p class='text-justify attribute'><strong>Start Time: </strong>2020-05-10 13:45:56</p>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-xs-6 col-md-6 col-sm-offset-3"> <div class="col-xs-6 col-md-6 col-sm-offset-3">
<p class='text-justify attribute'><strong>Stop Time: </strong>2020-05-05 19:58:37</p> <p class='text-justify attribute'><strong>Stop Time: </strong>2020-05-10 14:42:12</p>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-xs-6 col-md-6 col-sm-offset-3"> <div class="col-xs-6 col-md-6 col-sm-offset-3">
<p class='text-justify attribute'><strong>Duration: </strong>47:42 min</p> <p class='text-justify attribute'><strong>Duration: </strong>47:37 min</p>
</div> </div>
</div> </div>
</div> </div>
@ -457,8 +457,8 @@
<tr class="result['header']['style']"> <tr class="result['header']['style']">
<td>test_edit_books.test_edit_books</td> <td>test_edit_books.test_edit_books</td>
<td class="text-center">30</td> <td class="text-center">30</td>
<td class="text-center">28</td> <td class="text-center">27</td>
<td class="text-center">0</td> <td class="text-center">1</td>
<td class="text-center">0</td> <td class="text-center">0</td>
<td class="text-center">2</td> <td class="text-center">2</td>
<td class="text-center"> <td class="text-center">
@ -763,11 +763,33 @@
<tr id='pt5.30' class='hiddenRow bg-success'> <tr id='ft5.30' class='none bg-danger'>
<td> <td>
<div class='testcase'>test_upload_cover_hdd</div> <div class='testcase'>test_upload_cover_hdd</div>
</td> </td>
<td colspan='6' align='center'>PASS</td> <td colspan='6'>
<div class="text-center">
<a class="popup_link text-center" onfocus='blur()' onclick="showTestDetail('div_ft5.30')">FAIL</a>
</div>
<!--css div popup start-->
<div id='div_ft5.30' class="popup_window test_output" style="display:none;">
<div class='close_button pull-right'>
<button type="button" class="close" aria-label="Close" onfocus='this.blur();'
onclick="document.getElementById('div_ft5.30').style.display='none'"><span
aria-hidden="true">&times;</span></button>
</div>
<div class="text-left pull-left">
<pre class="text-left">Traceback (most recent call last):
File "/home/matthias/Entwicklung/calibre-web-test/test/test_edit_books.py", line 654, in test_upload_cover_hdd
self.assertEqual('20317',resp.headers['Content-Length'])
AssertionError: '20317' != '5232'
- 20317
+ 5232</pre>
</div>
<div class="clearfix"></div>
</div>
<!--css div popup end-->
</td>
</tr> </tr>
@ -1829,8 +1851,8 @@ AssertionError: False is not true : logfile config value is not empty after rese
<tr class="result['header']['style']"> <tr class="result['header']['style']">
<td>test_updater.test_updater</td> <td>test_updater.test_updater</td>
<td class="text-center">7</td> <td class="text-center">7</td>
<td class="text-center">5</td> <td class="text-center">6</td>
<td class="text-center">1</td> <td class="text-center">0</td>
<td class="text-center">0</td> <td class="text-center">0</td>
<td class="text-center">1</td> <td class="text-center">1</td>
<td class="text-center"> <td class="text-center">
@ -1867,33 +1889,11 @@ AssertionError: False is not true : logfile config value is not empty after rese
<tr id='ft18.4' class='none bg-danger'> <tr id='pt18.4' class='hiddenRow bg-success'>
<td> <td>
<div class='testcase'>test_check_update_stable_versions</div> <div class='testcase'>test_check_update_stable_versions</div>
</td> </td>
<td colspan='6'> <td colspan='6' align='center'>PASS</td>
<div class="text-center">
<a class="popup_link text-center" onfocus='blur()' onclick="showTestDetail('div_ft18.4')">FAIL</a>
</div>
<!--css div popup start-->
<div id='div_ft18.4' class="popup_window test_output" style="display:none;">
<div class='close_button pull-right'>
<button type="button" class="close" aria-label="Close" onfocus='this.blur();'
onclick="document.getElementById('div_ft18.4').style.display='none'"><span
aria-hidden="true">&times;</span></button>
</div>
<div class="text-left pull-left">
<pre class="text-left">Traceback (most recent call last):
File "/home/matthias/Entwicklung/calibre-web-test/test/test_updater.py", line 150, in test_check_update_stable_versions
self.check_updater('latest version installed', "alert-warning")
File "/home/matthias/Entwicklung/calibre-web-test/test/test_updater.py", line 60, in check_updater
self.assertTrue(self.check_element_on_page((By.CLASS_NAME, className)))
AssertionError: False is not true</pre>
</div>
<div class="clearfix"></div>
</div>
<!--css div popup end-->
</td>
</tr> </tr>
@ -2520,6 +2520,12 @@ AssertionError: False is not true</pre>
<td>Basic</td> <td>Basic</td>
</tr> </tr>
<tr>
<th>comicapi</th>
<td>2.1</td>
<td>test_edit_additional_books</td>
</tr>
<tr> <tr>
<th>lxml</th> <th>lxml</th>
<td>4.5.0</td> <td>4.5.0</td>
@ -2550,6 +2556,12 @@ AssertionError: False is not true</pre>
<td>test_edit_books</td> <td>test_edit_books</td>
</tr> </tr>
<tr>
<th>goodreads</th>
<td>0.3.2</td>
<td>test_goodreads</td>
</tr>
<tr> <tr>
<th>jsonschema</th> <th>jsonschema</th>
<td>3.2.0</td> <td>3.2.0</td>