From ec6d8f194349f6429bf453d21c407c3de286520f Mon Sep 17 00:00:00 2001 From: Phil Borman Date: Tue, 31 Oct 2017 23:17:15 +0100 Subject: [PATCH 1/3] Include config.ini in debug.zip --- lazylibrarian/common.py | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/lazylibrarian/common.py b/lazylibrarian/common.py index bee634a08..e59122930 100644 --- a/lazylibrarian/common.py +++ b/lazylibrarian/common.py @@ -585,7 +585,7 @@ def logHeader(): header += 'OpenSSL missing module/attribute: %s\n' % e try: - # get_extention_for_class method added in `cryptography==1.1`; not available in older versions + # get_extension_for_class method added in `cryptography==1.1`; not available in older versions # but need cryptography >= 1.3.4 for access from pyopenssl >= 0.14 import cryptography from cryptography.x509.extensions import Extensions @@ -603,9 +603,9 @@ def saveLog(): basename = os.path.join(lazylibrarian.CONFIG['LOGDIR'], 'lazylibrarian.log') outfile = os.path.join(lazylibrarian.CONFIG['LOGDIR'], 'debug') - passchars = string.ascii_letters + string.digits + '_/' # _/ used by slack and googlebooks - redactlist = ['api -> ', 'apikey -> ', 'pass -> ', 'password -> ', 'token -> ', 'using api [', - 'apikey=', 'key=', 'apikey%3D', "apikey': u'", "apikey': ', 'keys ->'"] + passchars = string.ascii_letters + string.digits + ':_/' # _/ used by slack, telegram and googlebooks + redactlist = ['api -> ', 'key -> ', 'secret -> ', 'pass -> ', 'password -> ', 'token -> ', 'keys ->', + '&r=', 'using api [', 'apikey=', 'key=', 'apikey%3D', "apikey': u'", "apikey': ',"] with open(outfile + '.tmp', 'w') as out: nextfile = True extn = 0 @@ -642,6 +642,25 @@ def saveLog(): linecount += 1 extn += 1 + if os.path.exists(lazylibrarian.CONFIGFILE): + out.write('---END-CONFIG---------------------------------\n') + for line in reverse_readline(lazylibrarian.CONFIGFILE): + for item in redactlist: + item = item.replace('->', '=') + startpos = line.find(item) + if startpos >= 0: + startpos += len(item) + endpos = startpos + while endpos < len(line) and not line[endpos] in passchars: + endpos += 1 + while endpos < len(line) and line[endpos] in passchars: + endpos += 1 + if endpos != startpos: + line = line[:startpos] + '' + line[endpos:] + redacts += 1 + out.write("%s\n" % line) + out.write('---CONFIG-------------------------------------\n') + with open(outfile + '.log', 'w') as logfile: logfile.write(logHeader()) lines = 0 From 91b56f91722ceb9e03428bac4ad6c3b86dbcba1b Mon Sep 17 00:00:00 2001 From: Phil Borman Date: Tue, 31 Oct 2017 23:18:05 +0100 Subject: [PATCH 2/3] Ampersand changes for page titles --- lazylibrarian/webServe.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lazylibrarian/webServe.py b/lazylibrarian/webServe.py index b174c6761..e168ed870 100644 --- a/lazylibrarian/webServe.py +++ b/lazylibrarian/webServe.py @@ -642,6 +642,9 @@ def series(self, AuthorID=None, whichStatus=None): match = myDB.match('SELECT AuthorName from authors WHERE AuthorID=?', (AuthorID,)) if match: title = "%s Series" % match['AuthorName'] + if '&' in title and '&' not in title: + title = title.replace('&', '&') + return serve_template(templatename="series.html", title=title, authorid=AuthorID, series=[], whichStatus=whichStatus) @@ -2120,6 +2123,9 @@ def issuePage(self, title): if not lazylibrarian.CONFIG['MAG_IMG'] or lazylibrarian.CONFIG['IMP_CONVERT'] == 'None': covercount = 0 + if '&' in title and '&' not in title: # could use htmlparser but seems overkill for just '&' + title = title.replace('&', '&') + return serve_template(templatename="issues.html", title=title, issues=mod_issues, covercount=covercount) @cherrypy.expose From 3f2228b48fa068778fd99e16d1ee1f7d029056d1 Mon Sep 17 00:00:00 2001 From: Phil Borman Date: Tue, 31 Oct 2017 23:18:37 +0100 Subject: [PATCH 3/3] Message changes --- lazylibrarian/postprocess.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lazylibrarian/postprocess.py b/lazylibrarian/postprocess.py index ee53291d5..7511683f1 100644 --- a/lazylibrarian/postprocess.py +++ b/lazylibrarian/postprocess.py @@ -1121,6 +1121,7 @@ def processDestination(pp_path=None, dest_path=None, authorname=None, bookname=N return False, 'calibredb import failed, %s %s' % (type(e).__name__, str(e)) else: # we are copying the files ourselves, either it's audiobook, magazine or we don't want to use calibre + logger.debug("BookType: %s, calibredb: [%s]" % (booktype, lazylibrarian.CONFIG['IMP_CALIBREDB'])) if not os.path.exists(dest_path): logger.debug('%s does not exist, so it\'s safe to create it' % dest_path) elif not os.path.isdir(dest_path):