Commit graph

190 commits

Author SHA1 Message Date
Mike Colagrosso
03ed3c2257 Add Ebook::DownloadUrl for web and feed downloads
This commit adds a rewrite rule for ebook downloads of the form:

```
/ebooks/some-author/some-book/downloads/some-filename.epub
```

to `www/ebooks/download.php`. That file handles the logic of whether to
show a thank you page before beginning the download.

Download URLs in RSS, Atom, and OPDS feeds follow the same pattern, but
they have a query string parameter `?source=feed` to always skip the
thank you page.
2025-04-25 14:31:44 -05:00
Alex Cabal
810087ccf9 Update OpenSearch features to current standards 2025-03-31 13:28:26 -05:00
Mike Colagrosso
dab857d127 Cast WordCount to string to fix PHPStan error 2025-03-25 13:10:53 -05:00
Alex Cabal
ba22538659 Add new schema.org wordCount property to ebook view 2025-03-14 12:10:05 -05:00
Alex Cabal
124e8343fc Completely type hint template functions and switch to named arguments 2025-03-04 20:32:20 -06:00
Alex Cabal
99b5fd66f2 More type fixes 2025-02-26 15:17:08 -06:00
Alex Cabal
9d1b66d19e Update PHPStan and Safe PHP, and review codebase for further type correctness 2025-02-25 22:41:18 -06:00
Mike Colagrosso
55e0428006 Add a Default EbookSortType
This allows the user to run a keyword search and then change the sort
order. `Default` is interpreted as `Relevance` if a query is present,
`Newest` if not.
2025-02-13 13:48:39 -06:00
Mike Colagrosso
1a71913794 Add a Relevance sort order and improve search
Here's what's in `IndexableText` right now:

1. Title
2. Collections
3. Authors
4. Tags
5. LocSubjects
6. TocEntries

Here is the proposed new ranking:

```
10 * Title +
8 * Authors +
3 * Collections +
IndexableText
```

New indices for existing DBs:

```
ALTER TABLE `Ebooks` ADD COLUMN `IndexableAuthors` text NOT NULL;
ALTER TABLE `Ebooks` ADD COLUMN `IndexableCollections` text NULL;
ALTER TABLE `Ebooks` ADD FULLTEXT `indexSearchTitle` (`Title`);
ALTER TABLE `Ebooks` ADD FULLTEXT `idxSearchAuthors` (`IndexableAuthors`);
ALTER TABLE `Ebooks` ADD FULLTEXT `idxSearchCollections` (`IndexableCollections`);
```
2025-02-13 13:48:39 -06:00
Alex Cabal
bdeebc8291 Add endpoint to get collections for an ebook or placeholder 2025-01-15 14:32:50 -06:00
Alex Cabal
0105bfefa4 Tweak donation banners and some type safety 2025-01-06 13:25:02 -06:00
Alex Cabal
1cb4cbfe24 Redirect ebook searches for only one tag to the /subjects/<TAG endpoint 2025-01-05 13:52:09 -06:00
Alex Cabal
bcba5c2192 Remove now-redundant PD placeholders code 2025-01-01 10:05:59 -06:00
Alex Cabal
b8def40795 Tweak semantics and contribute index page 2024-12-31 11:08:21 -06:00
Mike Colagrosso
c016547e2c Rename template to CollectionDescriptor 2024-12-28 14:18:08 -06:00
Mike Colagrosso
9652d63b12 Add Template::CollectionFormatted for common formatting 2024-12-28 14:18:08 -06:00
Alex Cabal
8e8cbb0c5e Move delete form and more multi select fixes 2024-12-19 14:40:38 -06:00
Alex Cabal
e21f411191 Emit HTTP 405 instead of HTTP 404 when posting to Ebooks 2024-12-18 13:14:48 -06:00
Alex Cabal
806939ca49 Replace Template::Emit...() functions with more generic function 2024-12-18 13:14:16 -06:00
Mike Colagrosso
f449c024ea Add /edit endpoint to update placeholders 2024-12-18 12:58:18 -06:00
Alex Cabal
97021ce26d Add blog post 2024-12-16 23:47:02 -06:00
Alex Cabal
5782d6ca7d Further refine projects system 2024-12-15 23:39:23 -06:00
Alex Cabal
c7a4e34e31 Add projects index page, and more detail on placeholder pages 2024-12-14 21:12:00 -06:00
Alex Cabal
adfe07aad9 Add beginning of a project management system to placeholders 2024-12-14 19:13:03 -06:00
Alex Cabal
1a742baa51 Add CanEditEbooks benefit and clean up some PHPStan errors 2024-12-14 11:50:16 -06:00
Alex Cabal
77ce4cc6b4 Make titlecasing in <h1> and page titles consistent 2024-12-13 14:16:39 -06:00
Mike Colagrosso
1ab95df084 Add placeholders for ebooks 2024-12-13 11:46:36 -06:00
Alex Cabal
c65035630f Add public domain day banner 2024-11-27 12:52:37 -06:00
Alex Cabal
b536ebdaee Add blog post for Public Domain Day 2025 2024-11-26 23:14:26 -06:00
Alex Cabal
e11f2ad6b1 Adjust nofollow attribute 2024-11-26 13:41:00 -06:00
Alex Cabal
84f4b2b0bf Add donation drive aside to download page 2024-11-25 12:03:26 -06:00
Alex Cabal
11d9d0f44a Tweak a session variable name and update comments 2024-11-20 16:42:24 -06:00
Alex Cabal
3050ab7219 Use HTTP code enums instead of ints 2024-11-20 14:52:05 -06:00
Alex Cabal
8546039b97 Comment formatting 2024-11-15 21:40:56 -06:00
Alex Cabal
d4c7703cf0 Restructure how incorrect ebook URLs are redirected 2024-11-11 13:59:45 -06:00
Alex Cabal
ec0b81817d Restructure some files to match new URL structure 2024-11-11 11:17:04 -06:00
Alex Cabal
b7b63a4be5 Refactor functions out of Library 2024-11-10 23:05:31 -06:00
Alex Cabal
1449148989 Switch logged in user to static typed variable instead of in $GLOBALS 2024-11-10 23:05:31 -06:00
Alex Cabal
acb30b897c Add PropertyFromHttp trait and update codebase to use new pattern 2024-11-10 22:23:43 -06:00
Alex Cabal
c35c47b793 Add DateTimeFormat enum 2024-11-08 16:41:15 -06:00
Alex Cabal
be5574eaec Move enums into their own namespace 2024-11-08 16:34:21 -06:00
Alex Cabal
d03d9782d1 Fixes for PD Day placeholder ebooks 2024-11-07 20:15:20 -06:00
Alex Cabal
8f17f39e1b Clean up some PD day code 2024-11-05 16:01:44 -06:00
Alex Cabal
163ada3b09 Add placeholders for public domain day ebooks 2024-11-04 21:17:09 -06:00
Alex Cabal
60f0ea16cb Formatting tweaks 2024-11-04 13:31:17 -06:00
Mike Colagrosso
9a4da8f961 Fix PHPStan errors for CollectionType enum
Use the `value` property of PHP enums to get the underlying string for functions that expect a string.

Followup to #392
2024-11-04 13:16:56 -06:00
Mike Colagrosso
6c8e819316 Implement OpenSearch feed search with FilterEbooks 2024-11-04 13:16:56 -06:00
Mike Colagrosso
807e8410b4 Use array shapes in the PHPDoc
This makes the extra documentation unnecessary
2024-11-04 13:16:56 -06:00
Mike Colagrosso
989dcab9f0 Implement FilterEbooks via DB 2024-11-04 13:16:56 -06:00
Mike Colagrosso
44dc65005d Query Contributors table for GetEbooksByAuthor() 2024-11-04 13:16:56 -06:00