From 37830e173fe703176ac9f800ec04937ed6ee4bf5 Mon Sep 17 00:00:00 2001 From: Alex Cabal Date: Mon, 20 Jun 2022 11:31:58 -0500 Subject: [PATCH] Continue improving serving and display of RSS/OPDS --- config/apache/standardebooks.org.conf | 15 +++++++++++---- config/apache/standardebooks.test.conf | 15 +++++++++++---- scripts/generate-rss.php | 3 ++- www/opds/search.php | 1 - www/rss/style.php | 8 +++++--- 5 files changed, 29 insertions(+), 13 deletions(-) diff --git a/config/apache/standardebooks.org.conf b/config/apache/standardebooks.org.conf index 762fc9f4..9daadc5b 100644 --- a/config/apache/standardebooks.org.conf +++ b/config/apache/standardebooks.org.conf @@ -96,16 +96,23 @@ Define webroot /standardebooks.org/web Header set Content-Disposition "attachment; filename=%{FILENAME}e" - - DirectoryIndex index.xml - - # We explicitly set the content-type for items in the /vocab/ directory, because Apache doesn't set it for us, # and we need a content-type header when using the "nosniff" header. See https://bugzilla.mozilla.org/show_bug.cgi?id=1547076 Header set Content-Type "text/plain" + # text/xml allows the page to be displayed in a browser. application/atom+xml will cause it to be downloaded. + + DirectoryIndex index.xml + Header set Content-Type "text/xml" + + + # text/xml allows the page to be displayed in a browser. application/rss+xml will cause it to be downloaded. + + Header set Content-Type "text/xml" + + # Enable HTTP CORS so that browser-based readers like Readium can access opds and ebooks # Allow fonts for newsletter emails # See https://github.com/standardebooks/tools/issues/2 diff --git a/config/apache/standardebooks.test.conf b/config/apache/standardebooks.test.conf index 2f10b355..8b949fc4 100644 --- a/config/apache/standardebooks.test.conf +++ b/config/apache/standardebooks.test.conf @@ -95,16 +95,23 @@ Define webroot /standardebooks.org/web Header set Content-Disposition "attachment; filename=%{FILENAME}e" - - DirectoryIndex index.xml - - # We explicitly set the content-type for items in the /vocab/ directory, because Apache doesn't set it for us, # and we need a content-type header when using the "nosniff" header. See https://bugzilla.mozilla.org/show_bug.cgi?id=1547076 Header set Content-Type "text/plain" + # text/xml allows the page to be displayed in a browser. application/atom+xml will cause it to be downloaded. + + DirectoryIndex index.xml + Header set Content-Type "text/xml" + + + # text/xml allows the page to be displayed in a browser. application/rss+xml will cause it to be downloaded. + + Header set Content-Type "text/xml" + + # Enable HTTP CORS so that browser-based readers like Readium can access opds and ebooks # Allow fonts for newsletter emails # See https://github.com/standardebooks/tools/issues/2 diff --git a/scripts/generate-rss.php b/scripts/generate-rss.php index b20b65b4..53667858 100644 --- a/scripts/generate-rss.php +++ b/scripts/generate-rss.php @@ -35,7 +35,8 @@ krsort($sortedContentFiles); $sortedContentFiles = array_slice($sortedContentFiles, 0, $rssLength); -print("\n\n"); +// XSL stylesheet mime type must be `text/xsl` otherwise Chrome doesn't read it +print("\n\n"); ?> diff --git a/www/opds/search.php b/www/opds/search.php index dd6cb260..2985d020 100644 --- a/www/opds/search.php +++ b/www/opds/search.php @@ -17,7 +17,6 @@ catch(\Exception $ex){ include(WEB_ROOT . '/404.php'); exit(); } -header('Content-type: text/xml'); print("\n"); ?> diff --git a/www/rss/style.php b/www/rss/style.php index 92dcb972..544b8510 100644 --- a/www/rss/style.php +++ b/www/rss/style.php @@ -1,10 +1,12 @@ \n") ?> - - + + false]) ?>