From dc0e873577a12d19fa238c778bf480c1f52c8ead Mon Sep 17 00:00:00 2001 From: Alex Cabal Date: Tue, 12 Jul 2022 10:18:20 -0500 Subject: [PATCH] Add feed/download toolbar to author and collection indexes --- config/apache/standardebooks.org.conf | 2 + config/apache/standardebooks.test.conf | 2 + lib/OpdsNavigationEntry.php | 1 + scripts/generate-feeds | 8 ++- templates/FeedHowTo.php | 23 +++----- www/css/core.css | 43 +++++++++++++- www/ebooks/author.php | 9 +-- www/ebooks/index.php | 9 ++- www/feeds/401.php | 11 +--- www/feeds/atom/index.php | 4 +- www/feeds/get.php | 75 +++++++++++++++++++++++++ www/feeds/index.php | 3 +- www/feeds/rss/index.php | 4 +- www/fonts/fork-awesome-subset.woff2 | Bin 1688 -> 2184 bytes 14 files changed, 151 insertions(+), 43 deletions(-) create mode 100644 www/feeds/get.php diff --git a/config/apache/standardebooks.org.conf b/config/apache/standardebooks.org.conf index fedf59ff..5e8644ae 100644 --- a/config/apache/standardebooks.org.conf +++ b/config/apache/standardebooks.org.conf @@ -246,9 +246,11 @@ Define webroot /standardebooks.org/web RewriteRule ^/ebooks/([^\./]+?)$ /ebooks/author.php?url-path=$1 [QSA] RewriteRule ^/ebooks/([^\./]+?)/downloads$ /bulk-downloads/get.php?author=$1 [QSA] + RewriteRule ^/ebooks/([^\./]+?)/feeds$ /feeds/get.php?author=$1 [QSA] RewriteRule ^/subjects/([^\./]+?)$ /ebooks/index.php?tags[]=$1 [QSA] RewriteRule ^/collections/([^\./]+?)$ /ebooks/index.php?collection=$1 [QSA] RewriteRule ^/collections/([^/]+?)/downloads$ /bulk-downloads/get.php?collection=$1 + RewriteRule ^/collections/([^/]+?)/feeds$ /feeds/get.php?collection=$1 # Prevent this rule from firing if we're getting a distribution file RewriteCond %{REQUEST_FILENAME} !^/ebooks/.+?/downloads/.+$ diff --git a/config/apache/standardebooks.test.conf b/config/apache/standardebooks.test.conf index 593ce8eb..80affa53 100644 --- a/config/apache/standardebooks.test.conf +++ b/config/apache/standardebooks.test.conf @@ -228,9 +228,11 @@ Define webroot /standardebooks.org/web RewriteRule ^/ebooks/([^\./]+?)$ /ebooks/author.php?url-path=$1 [QSA] RewriteRule ^/ebooks/([^\./]+?)/downloads$ /bulk-downloads/get.php?author=$1 [QSA] + RewriteRule ^/ebooks/([^\./]+?)/feeds$ /feeds/get.php?author=$1 [QSA] RewriteRule ^/subjects/([^\./]+?)$ /ebooks/index.php?tags[]=$1 [QSA] RewriteRule ^/collections/([^\./]+?)$ /ebooks/index.php?collection=$1 [QSA] RewriteRule ^/collections/([^/]+?)/downloads$ /bulk-downloads/get.php?collection=$1 + RewriteRule ^/collections/([^/]+?)/feeds$ /feeds/get.php?collection=$1 # Prevent this rule from firing if we're getting a distribution file RewriteCond %{REQUEST_FILENAME} !^/ebooks/.+?/downloads/.+$ diff --git a/lib/OpdsNavigationEntry.php b/lib/OpdsNavigationEntry.php index 50f74dc4..a56a36ee 100644 --- a/lib/OpdsNavigationEntry.php +++ b/lib/OpdsNavigationEntry.php @@ -7,6 +7,7 @@ class OpdsNavigationEntry{ public $Updated; public $Description; public $Title; + public $SortTitle; public function __construct(string $title, string $description, string $url, ?DateTime $updated, string $rel, string $type){ $this->Id = SITE_URL . $url; diff --git a/scripts/generate-feeds b/scripts/generate-feeds index 7a825c84..4df034f5 100755 --- a/scripts/generate-feeds +++ b/scripts/generate-feeds @@ -38,10 +38,12 @@ function CreateOpdsCollectionFeed(string $name, string $url, string $description // Create the collections navigation document $collectionNavigationEntries = []; foreach($collections as $collection){ - $collectionNavigationEntries[] = new OpdsNavigationEntry($collection['name'], str_replace('%s', $collection['name'], $description), $url . '/' . $collection['id'], $now, 'subsection', 'navigation'); + $entry = new OpdsNavigationEntry($collection['name'], str_replace('%s', $collection['name'], $description), $url . '/' . $collection['id'], $now, 'subsection', 'navigation'); + $entry->SortTitle = $collection['sortedname']; + $collectionNavigationEntries[] = $entry; } $collectionsFeed = new OpdsNavigationFeed('Standard Ebooks by ' . ucfirst($name), 'Browse Standard Ebooks by ' . $name . '.', $url, $webRoot . $url . '/index.xml', $collectionNavigationEntries, $opdsRoot); - $collectionsFeed->Subtitle = 'Browse Standard Ebooks by collection.'; + $collectionsFeed->Subtitle = 'Browse Standard Ebooks by ' . $name . '.'; SaveFeed($collectionsFeed, $force, null, null, $now); // Now generate each individual collection feed @@ -49,7 +51,7 @@ function CreateOpdsCollectionFeed(string $name, string $url, string $description $id = basename($collectionNavigationEntry->Id); usort($ebooks[$id], 'SortByUpdatedDesc'); $collectionFeed = new OpdsAcquisitionFeed($collectionNavigationEntry->Title . ' Ebooks', $collectionNavigationEntry->Description, $url . '/' . $id, $webRoot . $url . '/' . $id . '.xml', $ebooks[$id], $collectionsFeed); - SaveFeed($collectionFeed, $force, null, null, $now); + SaveFeed($collectionFeed, $force, $collectionNavigationEntry->Title, $collectionNavigationEntry->SortTitle, $now); } } diff --git a/templates/FeedHowTo.php b/templates/FeedHowTo.php index b5da1966..54842d60 100644 --- a/templates/FeedHowTo.php +++ b/templates/FeedHowTo.php @@ -1,21 +1,12 @@

Accessing the feeds

-

Our New Releases feeds are accessible by the public. Access to our other, more detailed feeds is available to our Patrons Circle supporters and our corporate sponsors.

-

If you’re a Patrons Circle member, when prompted enter your email address and leave the password field blank to access a feed.

-
-

Access for individuals

-
    -
  • Join the Patrons Circle by making a donation to get access to all of our ebook feeds for the duration of your gift.

  • -
  • Produce an ebook for Standard Ebooks to get lifetime access to our ebook feeds. If you’ve already done that, contact us to enable your access.

  • -
-
-
-

Access for organizations and projects

-
    -
  • Corporate sponsors get access to all of our ebook feeds for the duration of their sponsorship. Contact us to chat about having your organization sponsor our mission.

  • -
  • Software projects that are open-source and not-for-profit may be granted free access to our feeds. Contact us to inquire.

  • -
-
+

Our New Releases feeds are open to everyone. Our other feeds are a benefit of Patrons Circle membership.

+ +

If you’re a Patrons Circle member, when prompted enter your email address and leave the password field blank to access a feed.

diff --git a/www/css/core.css b/www/css/core.css index 84713744..56d31722 100644 --- a/www/css/core.css +++ b/www/css/core.css @@ -2352,13 +2352,43 @@ h1.is-collection{ margin-bottom: 1rem; } -.download-collection{ +.ebooks-toolbar{ display: flex; - justify-content: center; + justify-content: flex-end; margin-bottom: 4rem; border-bottom: 1px dashed var(--sub-text); padding-bottom: 1rem; font-style: italic; + gap: 1rem; +} + +.ebooks-toolbar a{ + padding: .5rem 1rem; + padding-left: .75rem; + text-decoration: none; +} + +.ebooks-toolbar a.button{ + /*font-family: "Crimson Pro", Georgia, serif;*/ + font-size: .75rem; + display: inline-flex; + gap: .75rem; + align-items: center; + font-weight: bold; +} + +.ebooks-toolbar a.button::before{ + font-family: "Fork Awesome"; + display: inline-block; + font-size: 1rem; +} + +.ebooks-toolbar a.button[href*="/downloads"]::before{ + content: "\f019"; +} + +.ebooks-toolbar a.button[href*="/feeds"]::before{ + content: "\f143"; } abbr.acronym{ @@ -3099,6 +3129,15 @@ ul.feed p{ white-space: normal; margin: 0 10px; } + + + .ebooks-toolbar{ + } + .ebooks-toolbar a.button{ + font-size: 0; + gap: 0; + padding: .5rem .75rem; + } } @media(max-width: 680px){ diff --git a/www/ebooks/author.php b/www/ebooks/author.php index 411fb038..3a3b97c9 100644 --- a/www/ebooks/author.php +++ b/www/ebooks/author.php @@ -23,10 +23,11 @@ catch(Exceptions\InvalidAuthorException $ex){ } ?> 'Ebooks by ' . strip_tags($ebooks[0]->AuthorsHtml), 'highlight' => 'ebooks', 'description' => 'All of the Standard Ebooks ebooks by ' . strip_tags($ebooks[0]->AuthorsHtml)]) ?>
- 1){ ?> class="is-collection">Ebooks by AuthorsHtml ?> - 1){ ?> -

Download all ebooks in this collection

- +

Ebooks by AuthorsHtml ?>

+

+ Download collection + Author feeds +

$ebooks, 'view' => VIEW_GRID]) ?>

We also have bulk ebook downloads available, as well as ebook catalog feeds for use directly in your ereader app or RSS reader.

diff --git a/www/ebooks/index.php b/www/ebooks/index.php index 22825407..c3321287 100644 --- a/www/ebooks/index.php +++ b/www/ebooks/index.php @@ -118,7 +118,7 @@ catch(Exceptions\InvalidCollectionException $ex){ } ?> $pageTitle, 'highlight' => 'ebooks', 'description' => $pageDescription]) ?>
- 1){ ?> class="is-collection"> + class="is-collection"> @@ -127,8 +127,11 @@ catch(Exceptions\InvalidCollectionException $ex){ $query, 'tags' => $tags, 'sort' => $sort, 'view' => $view, 'perPage' => $perPage]) ?> - 1){ ?> -

Download all ebooks in this collection

+ +

+ Download collection + Collection feeds +

No ebooks matched your filters. You can try different filters, or browse all of our ebooks.

diff --git a/www/feeds/401.php b/www/feeds/401.php index def1babb..d62b2801 100644 --- a/www/feeds/401.php +++ b/www/feeds/401.php @@ -42,18 +42,9 @@ if($type == 'atom'){ - -

OPDS feeds, or “catalogs,” can be added to ereading apps on phones and tablets to search, browse, and download from our entire catalog, directly in your ereader. Most modern ereading apps support OPDS catalogs.

-

They’re also perfect for scripting, or for libraries or other organizations who wish to download and process our catalog of ebooks.

- -

RSS feeds are the predecessors of Atom feeds. They contain less information than Atom feeds, but might be better supported by some news readers.

- -

Atom feeds can be read by one of the many RSS clients available for download, like Thunderbird. They contain more information than regular RSS feeds. Most RSS clients can read both Atom and RSS feeds.

-

Note that some RSS readers may show these feeds ordered by when an ebook was last updated, even though the feeds are ordered by when an ebook was first released. You should be able to change the sort order in your RSS reader.

-
diff --git a/www/feeds/atom/index.php b/www/feeds/atom/index.php index cca73b7e..1b0df25b 100644 --- a/www/feeds/atom/index.php +++ b/www/feeds/atom/index.php @@ -9,7 +9,7 @@ require_once('Core.php');

Note that some RSS readers may show these feeds ordered by when an ebook was last updated, even though the feeds are ordered by when an ebook was first released. You should be able to change the sort order in your RSS reader.

-

General feeds

+

General Atom feeds

  • New releases (Public)

    @@ -24,7 +24,7 @@ require_once('Core.php');
-

Feeds by topic

+

Atom feeds by topic

  • Feeds by author

    diff --git a/www/feeds/get.php b/www/feeds/get.php new file mode 100644 index 00000000..5dcadbd5 --- /dev/null +++ b/www/feeds/get.php @@ -0,0 +1,75 @@ + $title, 'description' => $description]) ?> +
    +
    +

    Ebook Feeds for

    + + +
    +

    RSS 2.0Atom 1.0OPDS 1.2 Feed

    + +

    Import this feed into your ereader app to get access to these ebooks directly in your ereader.

    + + +

    Get updates in your RSS client whenever a new ebook is released, or parse this feed for easy scripting.

    + + +

    The predecessor of Atom, compatible with most RSS clients.

    + +
      +
    • +

      +

      https://Email) ?>@/feeds///

      +
    • +
    +
    + +
    +
    + diff --git a/www/feeds/index.php b/www/feeds/index.php index c61b66f5..eb487625 100644 --- a/www/feeds/index.php +++ b/www/feeds/index.php @@ -14,8 +14,9 @@ require_once('Core.php');

    OPDS 1.2 feeds

    -

    OPDS feeds, or “catalogs,” can be added to ereading apps on phones and tablets to search, browse, and download from our entire catalog, directly in your ereader. Most modern ereading apps support OPDS catalogs.

    +

    OPDS feeds, or “catalogs,” can be added to ereading apps on phones and tablets to search, browse, and download from our ebook catalog, directly in your ereader. Most modern ereading apps support OPDS catalogs.

    They’re also perfect for scripting, or for libraries or other organizations who wish to download, process, and keep up to date with our catalog of ebooks.

    +

    To connect your ereading app to our catalog, enter the URL below when prompted by your app:

    • The Standard Ebooks OPDS feed

      diff --git a/www/feeds/rss/index.php b/www/feeds/rss/index.php index 2d801d6c..2ac45609 100644 --- a/www/feeds/rss/index.php +++ b/www/feeds/rss/index.php @@ -8,7 +8,7 @@ require_once('Core.php');

      RSS feeds are the predecessors of Atom feeds. They contain less information than Atom feeds, but might be better supported by some news readers.

      -

      General feeds

      +

      General RSS feeds

      • New releases (Public)

        @@ -23,7 +23,7 @@ require_once('Core.php');
      -

      Feeds by topic

      +

      RSS feeds by topic

      • Feeds by author

        diff --git a/www/fonts/fork-awesome-subset.woff2 b/www/fonts/fork-awesome-subset.woff2 index 6f3662f8358d8bab4270b42a76b6dbbc32e0cf4f..d36dfdb731c42f8036a4ad84a1606418043cb1d4 100644 GIT binary patch delta 2173 zcmV-@2!i*R4TupKcTYw#00961000Px01f~E000pT000Ovkr*U@LI?yA2nvrpj6MrM z00A}vBm;Z|AO(hY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