Skip to content

Commit

Permalink
1.26.4
Browse files Browse the repository at this point in the history
bugfix: 漫画书籍推送失败,1.26.2引入的bug。
  • Loading branch information
cdhigh committed Sep 19, 2019
1 parent 3bc5a74 commit f8f8cfe
Show file tree
Hide file tree
Showing 16 changed files with 45 additions and 31 deletions.
7 changes: 6 additions & 1 deletion apps/View/Login.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def POST(self):
elif len(name) > 25:
tips = _("The len of username reached the limit of 25 chars!")
return self.render('login.html', "Login", nickname='', tips=tips, username=name)
elif '<' in name or '>' in name or '&' in name:
elif '<' in name or '>' in name or '&' in name or '\\' in name or '/' in name:
tips = _("The username includes unsafe chars!")
return self.render('login.html', "Login", nickname='', tips=tips)

Expand Down Expand Up @@ -153,6 +153,11 @@ def POST(self):
import time
time.sleep(5)
tips = _("The username not exist or password is wrong!")
lang = main.session.get('lang')
if lang and lang.startswith('zh'):
tips += '&nbsp;&nbsp;&nbsp;&nbsp;<a href="/static/faq.html#forgotpwd" target="_blank">' + _('Forgot password?') + '</a>'
else:
tips += '&nbsp;&nbsp;&nbsp;&nbsp;<a href="/static/faq_en.html#forgotpwd" target="_blank">' + _('Forgot password?') + '</a>'
main.session.login = 0
main.session.username = ''
main.session.kill()
Expand Down
12 changes: 9 additions & 3 deletions apps/Work/Worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@
from calibre.utils.bytestringio import byteStringIO
from books import BookClasses, BookClass
from books.base import BaseFeedBook, BaseComicBook
from books.comic import ComicBaseClasses, comic_domains

try:
from books.comic import ComicBaseClasses, comic_domains
except ImportError:
default_log.warn('Failed to import comic base classes.')
ComicBaseClasses = []
comic_domains = tuple()

# 实际下载文章和生成电子书并且发送邮件
class Worker(BaseHandler):
Expand Down Expand Up @@ -477,11 +483,11 @@ def push_comic_book(self, username, user, book, opts=None):
def ProcessComicRSS(self, username, user, feed):
opts = getOpts(user.device, "comic")
for comicClass in ComicBaseClasses:
if feed.url.startswith(ComicBaseClass.accept_domains):
if feed.url.startswith(comicClass.accept_domains):
book = comicClass(opts=opts, user=user)
break
else:
msg = u"No base class for {}".format(feed.title)
msg = u"No base class for %s" % feed.title
main.log.error(msg)
return

Expand Down
2 changes: 1 addition & 1 deletion apps/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import __builtin__, sys
from google.appengine.ext import vendor

__Version__ = '1.26.3'
__Version__ = '1.26.4'

__builtin__.__dict__['__Version__'] = __Version__

Expand Down
3 changes: 2 additions & 1 deletion books/comic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
try:
moduleComic = __import__('books.comic.' + comicName, fromlist='*')
memberList = [getattr(moduleComic, member) for member in dir(moduleComic) if not member.startswith('_')]
typeofBase = type(BaseComicBook)
for member in memberList:
if issubclass(member, BaseComicBook) and (member is not BaseComicBook):
if type(member) == typeofBase and issubclass(member, BaseComicBook) and (member is not BaseComicBook):
ComicBaseClasses.append(member)
except Exception as e:
default_log.warn("Comic base book '%s' import failed : %s" % (comicName, e))
Expand Down
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog for KindleEar

## 1.26.4
1. bugfix: 漫画书籍推送失败,1.26.2引入的bug。

## 1.26.3
1. 不在用户上传的CSS样式表里面添加命名空间。

Expand Down
4 changes: 4 additions & 0 deletions changelog_en.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog for KindleEar


## 1.26.4
1. bugfix: failed to push comic book, bug from 1.26.2.

## 1.26.3
1. Do not add namespace in custom stylesheet.

Expand Down
2 changes: 1 addition & 1 deletion config.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
DEFAULT_COVER_BV = DEFAULT_COVER #default cover for merged-book, None indicates paste all covers into one, =DEFAULT_COVER enable the using of uploaded image.

MY_FEEDS_TITLE = u'KindleEar'
MY_FEEDS_DESC = u'RSS delivering from KindleEar'
MY_FEEDS_DESC = u'RSS from KindleEar'

#default timeout for network connection
CONNECTION_TIMEOUT = 60
Expand Down
Binary file modified i18n/tr-tr/LC_MESSAGES/lang.mo
Binary file not shown.
3 changes: 3 additions & 0 deletions i18n/tr-tr/LC_MESSAGES/lang.po
Original file line number Diff line number Diff line change
Expand Up @@ -785,3 +785,6 @@ msgstr "Failed to upload the stylesheet file. Error:"

msgid "Failed to delete the stylesheet. Error:"
msgstr "Failed to delete the stylesheet. Error:"

msgid "Forgot password?"
msgstr "Forgot password?"
Binary file modified i18n/zh-cn/LC_MESSAGES/lang.mo
Binary file not shown.
3 changes: 3 additions & 0 deletions i18n/zh-cn/LC_MESSAGES/lang.po
Original file line number Diff line number Diff line change
Expand Up @@ -814,3 +814,6 @@ msgstr "上传样式表文件失败,错误信息:"

msgid "Failed to delete the stylesheet. Error:"
msgstr "删除样式表文件失败,错误信息:"

msgid "Forgot password?"
msgstr "忘记密码?"
Binary file modified images/cv_default.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion lib/calibre/ebooks/mobi/mobiml.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ def mobimlize_elem(self, elem, stylizer, bstate, istates,
if valign in ('top', 'bottom', 'middle'):
istate.attrib['align'] = valign
for prop in ('width', 'height'):
if cssdict[prop] != 'auto':
if cssdict.get(prop, None) != 'auto':
value = style[prop]
if value == getattr(self.profile, prop):
result = '100%'
Expand Down
3 changes: 1 addition & 2 deletions static/faq.html
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,7 @@ <h2>有部分文章乱码?</h2>

<span id="forgotpwd"></span>
<h2>忘记密码了怎么办?</h2>
<p class="answer">如果是忘记非管理员账号的密码,则可以通知管理员改密码。如果是管理员密码,则可以登陆appengine.google.com,在左边选择"Datastore Admin",删除KeUser的所有数据,则所有账号的信息都会被删除,或者建议将所有数据库都删除,然后重新使用admin/admin登陆你的应用即可。没有找到"Datastore Admin"?则可以先在"Application Settings"里面打开。
<br />如果你会编程,则你会有其他方法,不用我说。</p>
<p class="answer">如果是忘记非管理员账号的密码,则可以通知管理员改密码。<br />如果是管理员密码,则可以登陆 <a href="https://console.cloud.google.com/appengine" target="_blank">App Engine</a>,在左边选择 "Datastore | 实体",在种类里面选择 "KeUser",选中 name 为 admin 的行,记下 "secret_key" 的值,比如为 "abcdefgh",在前面加随便几个字符,比如 "123abcdefgh",然后随便搜索一个在线的MD5计算网站,将其转换为MD5摘要字符串,比如 "8b920d97ca5fceff6c5835223c541bf4",再点击修改上面选择的数据行,将最后的MD5字符串填写到passwd域,然后点击页面下方的保存,重新使用密码 "123" 登录。

<span id="mailservice"></span>
<h2>xxx@appid.appspotmail.com邮件地址怎么用?</h2>
Expand Down
9 changes: 4 additions & 5 deletions static/faq_en.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ <h1><a href="/">KindleEar</a></h1>
<li><a href="#imagesfolder">How to put the cover or the masthead images in the same directory when I add a customize book?</a></li>
<li><a href="#sslerror">How to deal with the SSL error problem when I upload KindleEar?</a></li>
<li><a href="#garbled">Why some articles have garbled characters?</a></li>
<li><a href="#forgotpwd">What can I do if I forget the password?</a></li>
<li><a href="#forgotpwd">What can I do if I forgot the password?</a></li>
<li><a href="#mailservice">How to use mail service xxx@appid.appspotmail.com?</a></li>
<li><a href="#mergebooks">Why I can't lookup words in the delivery books after I chosen 'Merge books into one'?</a></li>
<li><a href="#needlogin">How to deal with those websites that need login before I can view the articles?</a></li>
Expand Down Expand Up @@ -185,10 +185,9 @@ <h2>Why some articles have garbled characters?</h2>
</p>

<span id="forgotpwd"></span>
<h2>What can I do if I forget the password?</h2>
<p class="answer">If you are a non-administrator user, and you forget the password, you can ask the administrator to change your password. If the administrator password was forgot, you can login appengine.google.com, select "Datastore Admin" on the left, delete all KeUser data, all the account information will be deleted. And then re-use admin/admin to login in your application . Did not find "Datastore Admin"? You can activate it in the "Application Settings".
<br />If you know python, I'm sure that you can find other solutions.</p>

<h2>What can I do if I forgot the password?</h2>
<p class="answer">If you are an non-administrator user, you can ask the administrator to change your password. <br />If forgot the administrator's password, you can login <a href="https://console.cloud.google.com/appengine" target="_blank">App Engine</a>, select "Datastore | Entries" on the left menu, select "KeUser" in the "Kind" Combobox, write down the value of field "secret_key" of database line "admin", let's assume that is "abcdefgh", add some characters at the beginning, become "123abcdefgh", find a website to calculate the MD5 hash of string "123abcdefgh", will be "8b920d97ca5fceff6c5835223c541bf4", fill it in field "passwd" of database line "admin". and then use admin/123 to login.

<span id="mailservice"></span>
<h2>How to use mail service xxx@appid.appspotmail.com?</h2>
<p class="answer">
Expand Down
23 changes: 7 additions & 16 deletions templates/logs.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,10 @@
<tbody>
{% for log in mylogs -%}
<tr>
<td>{{ log.time }}</td>
<td class="logbook">
{% if log.book|length>20 -%}
{{log.book[:20]}}...<span>{{log.book}}</span>
{% else %}
{{log.book}}
{% endif %}
</td>
<td>{{log.time}}</td>
<td>{{log.book}}</td>
<td>{%if log.size %} {{ log.size|filesizeformat }} {% else %} 0 {% endif %}</td>
<td>{{ log.to }}</td>
<td>{{log.to}}</td>
<td>
<span class="status {% if 'ok' in log.status -%} success {%- else -%} error {%- endif %}">
{{ log.status }}
Expand Down Expand Up @@ -98,14 +92,11 @@
{% for u in logs -%}
{% for log in logs[u] -%}
<tr>
<td>{{ u }}</td>
<td>{{ log.time }}</td>
<td class="logbook">
{% if log.book|length>20 -%}
{{log.book[:20]}}...<span>{{log.book}}</span>
{% else %}{{log.book}}{% endif %}</td>
<td>{{u}}</td>
<td>{{log.time}}</td>
<td>{{log.book}}</td>
<td>{%if log.size %} {{ log.size|filesizeformat }} {% else %} 0 {% endif %}</td>
<td>{{ log.to }}</td>
<td>{{log.to}}</td>
<td>
<span class="status {% if 'ok' in log.status -%} success {%- else -%} error {%- endif %}">
{{ log.status }}
Expand Down

0 comments on commit f8f8cfe

Please sign in to comment.