From b50add8aff27b240b55acb733f3b766e3aa603eb Mon Sep 17 00:00:00 2001 From: Phil Borman Date: Sat, 2 Jun 2018 23:19:04 +0200 Subject: [PATCH 1/3] RSS feed changes --- lazylibrarian/webServe.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lazylibrarian/webServe.py b/lazylibrarian/webServe.py index a795aac56..69132c7f0 100644 --- a/lazylibrarian/webServe.py +++ b/lazylibrarian/webServe.py @@ -1807,6 +1807,8 @@ def mimetype(filename): return 'application/pdf' elif name.endswith('.mp3'): return 'audio/mpeg3' + elif name.endswith('.xml'): + return 'application/rss+xml' return "application/x-download" @cherrypy.expose @@ -3437,10 +3439,12 @@ def rssFeed(self, **kwargs): netloc = cherrypy.request.headers['X-Forwarded-Host'] except KeyError: pass + filename = 'LazyLibrarian_' + ftype + '.xml' path = path.replace('rssFeed', '').rstrip('/') baseurl = urlunsplit((scheme, netloc, path, qs, anchor)) - remote_ip = cherrypy.request.remote.ip - logger.info("RSS Feed request %s %s%s for %s" % (limit, ftype, plural(limit), remote_ip)) + logger.info("RSS Feed request %s %s%s" % (limit, ftype, plural(limit))) + cherrypy.response.headers["Content-Type"] = 'application/rss+xml' + cherrypy.response.headers["Content-Disposition"] = 'attachment; filename="%s"' % filename return genFeed(ftype, limit=limit, user=userid, baseurl=baseurl) @cherrypy.expose From b77e03d769f6665198d2e30cc214d2cab1a42d2f Mon Sep 17 00:00:00 2001 From: Phil Borman Date: Sun, 3 Jun 2018 09:34:16 +0200 Subject: [PATCH 2/3] Ensure rss feed is bytes --- lazylibrarian/webServe.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lazylibrarian/webServe.py b/lazylibrarian/webServe.py index 69132c7f0..f1d5846b4 100644 --- a/lazylibrarian/webServe.py +++ b/lazylibrarian/webServe.py @@ -39,7 +39,8 @@ from lazylibrarian.csvfile import import_CSV, export_CSV, dump_table, restore_table from lazylibrarian.downloadmethods import NZBDownloadMethod, TORDownloadMethod, DirectDownloadMethod from lazylibrarian.formatter import unaccented, unaccented_str, plural, now, today, check_int, replace_all, \ - safe_unicode, cleanName, surnameFirst, sortDefinite, getList, makeUnicode, md5_utf8, dateFormat, check_year + safe_unicode, cleanName, surnameFirst, sortDefinite, getList, makeUnicode, makeBytestr, md5_utf8, dateFormat, \ + check_year from lazylibrarian.gb import GoogleBooks from lazylibrarian.gr import GoodReads from lazylibrarian.images import getBookCover @@ -3439,13 +3440,14 @@ def rssFeed(self, **kwargs): netloc = cherrypy.request.headers['X-Forwarded-Host'] except KeyError: pass - filename = 'LazyLibrarian_' + ftype + '.xml' + filename = 'LazyLibrarian_RSS_' + ftype + '.xml' path = path.replace('rssFeed', '').rstrip('/') baseurl = urlunsplit((scheme, netloc, path, qs, anchor)) logger.info("RSS Feed request %s %s%s" % (limit, ftype, plural(limit))) cherrypy.response.headers["Content-Type"] = 'application/rss+xml' cherrypy.response.headers["Content-Disposition"] = 'attachment; filename="%s"' % filename - return genFeed(ftype, limit=limit, user=userid, baseurl=baseurl) + res = genFeed(ftype, limit=limit, user=userid, baseurl=baseurl) + return makeBytestr(res) @cherrypy.expose def importCSV(self): From 55e19b81fb9636adb460ea3e930996553d71b905 Mon Sep 17 00:00:00 2001 From: Phil Borman Date: Sun, 3 Jun 2018 12:59:37 +0200 Subject: [PATCH 3/3] Add type rss+xml to rss buttons --- data/interfaces/bookstrap/audio.html | 2 +- data/interfaces/bookstrap/books.html | 2 +- data/interfaces/bookstrap/magazines.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/data/interfaces/bookstrap/audio.html b/data/interfaces/bookstrap/audio.html index 20a1c218f..a345d6fce 100644 --- a/data/interfaces/bookstrap/audio.html +++ b/data/interfaces/bookstrap/audio.html @@ -13,7 +13,7 @@ %endif Recent AudioBooks %if lazylibrarian.CONFIG['USER_ACCOUNTS'] == True: - + %endif
diff --git a/data/interfaces/bookstrap/books.html b/data/interfaces/bookstrap/books.html index 3adba92fb..8c8cc7ced 100644 --- a/data/interfaces/bookstrap/books.html +++ b/data/interfaces/bookstrap/books.html @@ -14,7 +14,7 @@ Additions Downloads %if lazylibrarian.CONFIG['USER_ACCOUNTS'] == True: - + %endif
%if len(languages) > 1: diff --git a/data/interfaces/bookstrap/magazines.html b/data/interfaces/bookstrap/magazines.html index 71e1d563d..1c2ce994f 100644 --- a/data/interfaces/bookstrap/magazines.html +++ b/data/interfaces/bookstrap/magazines.html @@ -14,7 +14,7 @@ %endif Recent Issues %if lazylibrarian.CONFIG['USER_ACCOUNTS'] == True: - + %endif