From a1af1bcf0474e4438d85cb4b37ee3520baec864d Mon Sep 17 00:00:00 2001 From: eric Date: Tue, 3 Sep 2019 13:25:56 -0400 Subject: [PATCH 1/8] remove G+ --- Icons.py | 1 - templates/bibrec.html | 3 --- templates/social-functions.html | 18 ------------------ 3 files changed, 22 deletions(-) diff --git a/Icons.py b/Icons.py index a682ad8..2309586 100644 --- a/Icons.py +++ b/Icons.py @@ -60,7 +60,6 @@ THUMBS = { 'gdrive' : 'pics/gdrive-24x21.png', 'msdrive' : 'pics/msdrive-24x24.png', 'twitter' : 'pics/twitter_whiteonblue-20x20.png', - 'gplus' : 'pics/gplus-20x20.png', # 'hosted' : 'pics/ibiblio-hosted-110x32.png', # 'apache' : 'pics/apache-powered-118x41.gif', diff --git a/templates/bibrec.html b/templates/bibrec.html index c62cbd9..8b2a4b9 100644 --- a/templates/bibrec.html +++ b/templates/bibrec.html @@ -117,9 +117,6 @@ Gutenberg metadata much faster than by scraping. os.description.encode ('utf-8'), os.cover_thumb_url)} --> -
  • - ${gplus_share (os.canonical_url)} -
  • ${tw_share (os.canonical_url, os.twit)}
  • diff --git a/templates/social-functions.html b/templates/social-functions.html index b8a58fe..c5881ed 100644 --- a/templates/social-functions.html +++ b/templates/social-functions.html @@ -37,24 +37,6 @@ - - - - - - From 2d2698598c4954015b8a733bb7cc82371453ec16 Mon Sep 17 00:00:00 2001 From: eric Date: Tue, 3 Sep 2019 15:11:38 -0400 Subject: [PATCH 2/8] use relative urls and stop using protocol relative urls --- BaseSearcher.py | 26 +++++--------------------- BibrecPage.py | 2 +- HTMLFormatter.py | 8 ++++++++ templates/bibrec.html | 4 ++-- templates/site-layout.html | 4 ++-- 5 files changed, 18 insertions(+), 26 deletions(-) diff --git a/BaseSearcher.py b/BaseSearcher.py index 8bc6f99..31c113d 100644 --- a/BaseSearcher.py +++ b/BaseSearcher.py @@ -464,13 +464,7 @@ class OpenSearch (object): if self.protocol not in VALID_PROTOCOLS: self.protocol = 'https' - self.urlgen = routes.URLGenerator ( - cherrypy.routes_mapper, - { - 'HTTP_HOST': self.host, - 'HTTPS': 1 , - } - ) + self.urlgen = routes.URLGenerator ( cherrypy.routes_mapper, {'HTTP_HOST': self.host}) self.set_format (k.get ('format')) @@ -617,13 +611,13 @@ class OpenSearch (object): self.mobile_search = self.url ('search', format = 'mobile') self.json_search = self.url ('suggest', format = None) - self.base_url = self.protocol_relative (self.url (host = self.host)) + self.base_url = self.url (host = self.file_host) # for google, fb etc. self.canonical_url = self.url_carry (host = self.file_host, format = None) - self.desktop_url = self.protocol_relative (self.url_carry (host = self.desktop_host, format = None)) - self.mobile_url = self.protocol_relative (self.url_carry (host = self.mobile_host, format = 'mobile')) + self.desktop_url = self.url_carry (host = self.desktop_host, format = None) + self.mobile_url = self.url_carry (host = self.mobile_host, format = 'mobile') self.osd_url = self.qualify ('/catalog/osd-books.xml') @@ -696,14 +690,6 @@ class OpenSearch (object): return urllib.parse.urljoin (self.base_url, url) - def protocol_relative (self, url): - """ Make absolute url protocol relative. """ - offset = url.find ('//') - if offset > -1: - return url[offset:] - return url - - def set_format (self, format_): """ Sanity check and set the parameter we got from the user. Calc format and mediatype to send to the client. """ @@ -939,9 +925,7 @@ class OpenSearch (object): def format_thumb_url (self, row): """ Generate the thumb url in results. """ if row.coverpages: - return urllib.parse.urljoin ('//' + self.file_host, row.coverpages[0]) - # return self.url ('bibrec', host = self.file_host, id = row.pk, - # format = 'cover.small') + return row.coverpages[0] return None def format_icon (self, dummy_row): diff --git a/BibrecPage.py b/BibrecPage.py index 1ed1a47..bbfc3c4 100644 --- a/BibrecPage.py +++ b/BibrecPage.py @@ -57,7 +57,7 @@ class BibrecPage (Page.Page): dc.icon = 'audiobook' os.title_icon = dc.icon os.twit = os.title - os.qrcode_url = '//%s/cache/epub/%d/pg%d.qrcode.png' % (os.file_host, os.id, os.id) + os.qrcode_url = '/cache/epub/%d/pg%d.qrcode.png' % (os.id, os.id) os.entries.append (dc) diff --git a/HTMLFormatter.py b/HTMLFormatter.py index 81bacef..7b4e240 100644 --- a/HTMLFormatter.py +++ b/HTMLFormatter.py @@ -58,6 +58,7 @@ class XMLishFormatter (BaseFormatter.BaseFormatter): super (XMLishFormatter, self).fix_dc (dc, os) + # generated_files always [] AFAICT -esh for file_ in dc.generated_files: file_.help_topic = file_.hr_filetype file_.compression = 'none' @@ -78,6 +79,13 @@ class XMLishFormatter (BaseFormatter.BaseFormatter): file_.url = file_.url + '?' + urllib.parse.urlencode ( { 'session_id': str (cherrypy.session.id) } ) + # these are used as relative links + if file_.generated and not file_.filetype.startswith ('cover.'): + file_.filename = "ebooks/%d.%s" % (file_.id, file_.filetype) + if m in HANDOVER_TYPES: + file_.filename = file_.filename + '?' + urllib.parse.urlencode ( + { 'session_id': str (cherrypy.session.id) } ) + for file_ in dc.files: file_.honeypot_url = os.url ( 'honeypot_send', id = dc.project_gutenberg_id, filetype = file_.filetype) diff --git a/templates/bibrec.html b/templates/bibrec.html index 8b2a4b9..7f167f2 100644 --- a/templates/bibrec.html +++ b/templates/bibrec.html @@ -320,7 +320,7 @@ Gutenberg metadata much faster than by scraping. ${file_.hr_filetype} ${file_.url} @@ -352,7 +352,7 @@ Gutenberg metadata much faster than by scraping. More Files… - https:${os.qualify (e.base_dir)} + e.base_dir diff --git a/templates/site-layout.html b/templates/site-layout.html index 4f155be..bedb5e8 100644 --- a/templates/site-layout.html +++ b/templates/site-layout.html @@ -118,7 +118,7 @@
    @@ -244,7 +244,7 @@
    From f8a7e70c95339b6074395a1f9cdc3c3454a7d0d2 Mon Sep 17 00:00:00 2001 From: eric Date: Tue, 3 Sep 2019 15:30:36 -0400 Subject: [PATCH 3/8] stop handling qioo and plucker --- HTMLFormatter.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/HTMLFormatter.py b/HTMLFormatter.py index 7b4e240..3c8ce17 100644 --- a/HTMLFormatter.py +++ b/HTMLFormatter.py @@ -32,10 +32,10 @@ from i18n_tool import ugettext as _ NO_DESKTOP_FILETYPES = 'plucker qioo rdf rst rst.gen rst.master tei cover.medium cover.small'.split () # filetypes shown on mobile site -MOBILE_TYPES = (mt.epub, mt.plucker, mt.mobi, mt.pdf, 'text/html', mt.html, mt.qioo) +MOBILE_TYPES = (mt.epub, mt.mobi, mt.pdf, 'text/html', mt.html) # filetypes which are usually handed over to a separate app on mobile devices -HANDOVER_TYPES = (mt.epub, mt.plucker, mt.mobi, mt.pdf, mt.qioo) +HANDOVER_TYPES = (mt.epub, mt.mobi, mt.pdf) # self-contained files we can send to dropbox CLOUD_TYPES = (mt.epub, mt.mobi, mt.pdf) From 1b47ca8163b3a3c263c6ffbf6e83ecfc44ce9521 Mon Sep 17 00:00:00 2001 From: eric Date: Wed, 4 Sep 2019 15:10:07 -0400 Subject: [PATCH 4/8] remove session from display url also used in schema.org about attribute where sessions should not be --- HTMLFormatter.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/HTMLFormatter.py b/HTMLFormatter.py index 3c8ce17..01278db 100644 --- a/HTMLFormatter.py +++ b/HTMLFormatter.py @@ -75,10 +75,6 @@ class XMLishFormatter (BaseFormatter.BaseFormatter): file_.msdrive_url = os.url ( 'msdrive_send', id = dc.project_gutenberg_id, filetype = file_.filetype) - if m in HANDOVER_TYPES: - file_.url = file_.url + '?' + urllib.parse.urlencode ( - { 'session_id': str (cherrypy.session.id) } ) - # these are used as relative links if file_.generated and not file_.filetype.startswith ('cover.'): file_.filename = "ebooks/%d.%s" % (file_.id, file_.filetype) From 5234dfb062805360eedb6a4f095c291a40e9dc06 Mon Sep 17 00:00:00 2001 From: eric Date: Mon, 9 Sep 2019 12:47:24 -0400 Subject: [PATCH 5/8] mobile, too --- HTMLFormatter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HTMLFormatter.py b/HTMLFormatter.py index 01278db..4788fd8 100644 --- a/HTMLFormatter.py +++ b/HTMLFormatter.py @@ -212,7 +212,7 @@ class MobileFormatter (XMLishFormatter): cat.extra = file_.hr_extent cat.charset = file_.encoding - cat.url = file_.url + cat.url = '/' + file_.filename cat.icon = dc.icon cat.icon2 = 'download' cat.class_ += 'filelink' From 332d8210af6cec902ac15fc387c7a53ba27e6b32 Mon Sep 17 00:00:00 2001 From: eric Date: Mon, 9 Sep 2019 12:47:46 -0400 Subject: [PATCH 6/8] fix --- templates/bibrec.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/bibrec.html b/templates/bibrec.html index 7f167f2..48d7799 100644 --- a/templates/bibrec.html +++ b/templates/bibrec.html @@ -352,7 +352,7 @@ Gutenberg metadata much faster than by scraping. More Files… - e.base_dir + ${os.qualify (e.base_dir)} From bbd74875566fb8ed24e5edc6f5b3feeaebbd72d9 Mon Sep 17 00:00:00 2001 From: eric Date: Mon, 9 Sep 2019 12:49:02 -0400 Subject: [PATCH 7/8] update copyright date --- templates/site-layout.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/site-layout.html b/templates/site-layout.html index bedb5e8..f4fea0c 100644 --- a/templates/site-layout.html +++ b/templates/site-layout.html @@ -110,7 +110,7 @@ From cc50067f3b9d80401e48b19e5ee1e93c9fa21d76 Mon Sep 17 00:00:00 2001 From: eric Date: Mon, 9 Sep 2019 12:58:29 -0400 Subject: [PATCH 8/8] fix permissions --- diagnostics.py | 0 errors.py | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 diagnostics.py mode change 100755 => 100644 errors.py diff --git a/diagnostics.py b/diagnostics.py old mode 100755 new mode 100644 diff --git a/errors.py b/errors.py old mode 100755 new mode 100644