Commit graph

76 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
34fd71e55a Tweak wording on delete artist page and add some more breadcrumbs 2025-03-07 10:37:56 -06:00
Mike Colagrosso
a91509726c
Add admin tool to handle duplicate artist names (#480) 2025-03-06 14:28:26 -06:00
Alex Cabal
a5a19f947f More type fixes 2025-02-26 14:32:04 -06:00
Alex Cabal
e2e14a3551 Remove DbConnection class in favor of fully-static and typed Db class 2025-02-25 16:47:25 -06:00
Alex Cabal
0a684facee Simplify exceptions in HttpInput 2025-02-24 14:46:42 -06:00
Alex Cabal
831c1531d8 Minor refactor 2025-02-15 11:44:18 -06:00
Mike Colagrosso
a3ce3f1ec1 Make IndexableText optional
Placeholders do not have FullTitle, AlternateTitle, Tags, LocSubjects,
or TocEntries.
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
c36d1ac3d3 Rename exception for consistency 2025-01-09 14:08:54 -06:00
Alex Cabal
d9fe3e9303 Fix error handling for duplicate ebook placeholders 2025-01-09 14:00:50 -06:00
Alex Cabal
98e09f414e Allow creating new ebook placeholders when creating a new project 2024-12-18 22:23:57 -06:00
Alex Cabal
7a3c7ad503 Allow VCS URLs to be null in projects 2024-12-16 21:48:01 -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
Mike Colagrosso
1ab95df084 Add placeholders for ebooks 2024-12-13 11:46:36 -06:00
Alex Cabal
cf5f488cae Improve error message for people trying to log in to the Patrons Circle 2024-12-13 10:10:52 -06:00
Mike Colagrosso
cae8271ecb Set ReviewerUserId only if Status changed
For non-admin reviewers (i.e., without `CanReviewOwnArtwork`), the `PATCH` form
has a hidden element with the artwork's current `Status`. If the reviewer
updates the `EbookUrl` and not `Status`, then don't record the reviewer's
`ReviewerUserId` because they didn't review or change the `Status`.

Side note: Sending the `PATCH` form an invalid `Status` will result in a
validation error, but that validation error was hard to read because it was the
wrong exception type. This commit adds a new `InvalidArtworkStatusException` to
fix that.

Fixes #433
2024-12-13 09:06:57 -06:00
Alex Cabal
8ad3291a35 Add admin form to view and edit users 2024-11-23 14:30:11 -06:00
Alex Cabal
d4c7703cf0 Restructure how incorrect ebook URLs are redirected 2024-11-11 13:59:45 -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
be5574eaec Move enums into their own namespace 2024-11-08 16:34:21 -06:00
Alex Cabal
06b82cdaaa Fix broken updated timestamps in OPDS feeds, and fix and add some type hints. 2024-11-08 12:43:47 -06:00
Mike Colagrosso
65d1dcdd88 Use the NOW constant from eec7971 2024-11-04 13:16:56 -06:00
Mike Colagrosso
6bec232d37 Remove checks against EBOOK_EARLIEST_CREATION_DATE 2024-11-04 13:16:56 -06:00
Mike Colagrosso
1076c9a77d Remove primary key EbookSourceId
There is a one to many relationship between `Ebook` and `EbookSource`, and we
don't query by `EbookSourceId`. We add a `SortOrder` column to keep the sources
in the same order as specified in `content.opf`.
2024-11-04 13:16:56 -06:00
Mike Colagrosso
85307a7c7e Standardize trim and other validation of nullable and non-nullable properties 2024-11-04 13:16:56 -06:00
Mike Colagrosso
0eaf2e8e47 Handle nullable and non-nullable validation consistently 2024-11-04 13:16:56 -06:00
Mike Colagrosso
8a61713fa4 Ebook validation: Trim properties that are present 2024-11-04 13:16:56 -06:00
Mike Colagrosso
221c2ff347 Validate Collection name 2024-11-04 13:16:56 -06:00
Mike Colagrosso
2aae231710 EbookTag validation: Trim name and check for empty string 2024-11-04 13:16:56 -06:00
Mike Colagrosso
2273367c6d Collection validation: Pass enum to InvalidCollectionTypeException, not value 2024-11-04 13:16:56 -06:00
Mike Colagrosso
754fc0ab2b LocSubject: Trim Name and validate Name isn't empty 2024-11-04 13:16:56 -06:00
Mike Colagrosso
5b1bb2a9f0 Change tag type from string to enum (TagType) 2024-11-04 13:16:56 -06:00
Mike Colagrosso
402dae95ff Add a Type enum to Tags for artwork/ebook 2024-11-04 13:16:56 -06:00
Mike Colagrosso
ee29c526f8 Add a CollectionMembership class 2024-11-04 13:16:56 -06:00
Mike Colagrosso
5c69923176 Workaround a bug in Safe-PHP causes PHPStan errors 2024-11-04 13:16:56 -06:00
Mike Colagrosso
72d679a04f Fix PHPStan errors 2024-11-04 13:16:56 -06:00
Mike Colagrosso
032032b920 Additional Ebook validation 2024-11-04 13:16:56 -06:00
Mike Colagrosso
63d411a2e6 Initial code changes to insert/update Ebook records 2024-11-04 13:16:56 -06:00
Alex Cabal
44901cf3e2 Add Db::QueryBool() and some code style updates 2024-09-15 13:50:13 -05:00
Alex Cabal
fa323842f6 Fix broken check in ValidationException 2024-05-24 23:37:28 -05:00
Alex Cabal
98f45ea4e0 Add the HttpInput::File() and HttpInput::Date() method 2024-05-24 20:48:28 -05:00
Alex Cabal
a9eab552ab Flesh out some PHPDocs, and consistently name enums 2024-05-14 15:40:56 -05:00
Alex Cabal
ee7c8343dd Convert some constants to enums 2024-05-11 21:51:06 -05:00
Alex Cabal
703e1a7a03 Continue improving type hints 2024-05-10 23:38:57 -05:00
Alex Cabal
c4c8e7353f Enable strict exception type hint checking in PHPStan and add exception type hints 2024-05-10 20:47:36 -05:00
Alex Cabal
50efeb05d1 Style tweaks for getters and add more type hinting 2024-04-30 22:45:20 -05:00
Alex Cabal
e14988ff8c Improve exceptions in DB classes 2024-04-27 14:42:37 -05:00
Alex Cabal
07110829e7 Specify explicit duplicate key exception in DB class 2024-04-26 13:58:05 -05:00