mirror of
https://github.com/readest/readest.git
synced 2026-11-30 03:13:39 +00:00
* feat(library): add readestpack collection bundle export and import * feat(library): support .readestpack transfer and collection restoration via Nearby BookDrop * fix(library): name restored pack collections and fix Nearby pack sends (owner: fix the issues) Follow-ups from reviewing #6945 on Linux (CEF) and Android: - Importing a .readestpack by drop or file picker into a library without that group named the group after its id ("424dbc0" instead of "Classics"): getGroupId fingerprints an unknown name, so the `|| collectionName` fallback never ran and getGroupName(id) || id stored the id. resolveImportGroup now carries the collection name through and is shared by the picker, Open-with and BookDrop paths. It also keeps a library-root import's groupName undefined, as on main. - Nearby wrote the temporary pack under base 'None' with a relative name, which the fs scope refuses ("forbidden path"). Since any send from inside a group went through it, even one book, Nearby from a group failed on every platform. The pack now goes to a Temp subdirectory, and only two or more books sharing one group travel as a pack; one book is sent as itself. - A mixed selection took the first book's group as the collection name, so ungrouped books joined it on import. Pack and Nearby now use the group only when every book shares it. - Export no longer reports "Exported" after the save dialog is cancelled. - Only .readestpack files are unpacked on import; a plain .zip is no longer read whole into memory before falling back. - Open-with resolves a content:// URI's display name before checking the extension, so an Android VIEW intent for a pack is recognised. - A received pack that can't be read or imports nothing reports the existing "Failed to import" error, and the received file is removed in a finally block. Nearby warns when books are left out of the pack. - Declare com.readest.pack in the macOS Info.plist and the .readestpack intent filters in the Android manifest (the generated block is what `tauri android build` writes from bundle.fileAssociations). Tests that fail without the change (src/__tests__/app/library/ pack-library-utils.test.ts, run against the PR's logic first): - "names a new group after the pack collection, not its id": expected groupName 'Classics', received '424dbc0' - "returns undefined when one book is outside the group": expected 'Classics' to be undefined - "keeps the import target when there is no pack collection": expected groupName undefined, received '' Verified in the app: - Linux CEF dev build, isolated profiles: dropping the pack into a fresh profile restores "Classics"; Nearby of the Classics group between two profiles restores "Classics" with 3 books and removes the temp file; one book from inside the group is sent as its .epub. - Android emulator (API 35, debug x86_64 build of this change): picking a pack with a new collection name restores "Novellen"; an Open-with VIEW intent (downloads-provider content:// URI) imports the pack into its group; Nearby on the group writes the pack under cache/localsend, opens the device picker and removes the file on close; Nearby of one book sends the book itself. Not run: a BookDrop transfer between Android and desktop (the emulator does not see local desktop peers), the final receive-side restructure in a live transfer, macOS/Windows/iOS file association, and the full `pnpm test` suite (related suites only: 393 passed). pnpm lint and pnpm format:check pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(i18n): translate the .readestpack strings Extracted with pnpm i18n:extract and translated in all 34 locales. The extractor also dropped seven unused Turkish keys; they are kept so this change only adds the pack strings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(library): rename .readestpack to .rbooks (owner: go with .rbooks) The maintainer found .readestpack too long. .rbooks matches .rdict, the existing Readest dictionary bundle. No .rbooks extension is in use elsewhere; .rpack was avoided because game resource archives use it. The format has not shipped, so nothing reads the old name. Renamed: the extension, the MIME type (application/x-readest-books), the macOS UTI (com.readest.books), the manifest format id, and the Android intent filters. Internal names (isReadestPackFile, READEST_PACK_*) stay. Verified: the pack-service, localsend formats and constants tests were switched to .rbooks first and failed against the old name (e.g. "expected [ Array(15) ] to include 'rbooks'"), then passed after the rename; related suites 549 passed, pnpm lint and format:check pass. In the Linux CEF dev build: Pack proposes Classics.rbooks, and the saved file's manifest has format "rbooks". Dropping it into a fresh profile restores "Classics". Nearby BookDrop of the Classics group to a fresh profile shows "Restored collection "Classics" (3 books)" and removes both temp files. Not run: the Android build of this rename (the manifest change mirrors what `tauri android build` generates from tauri.conf.json); macOS, Windows and iOS file association. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(library): use an outline icon for Pack (owner: the icon for the Pack is not consistent with other buttons) MdArchive was the only filled icon among the outline actions in the select-mode bar. MdOutlineArchive is from the same Material outline set as MdOutlineCloudDownload and MdLabelOutline. Verified in the Linux CEF dev build: screenshots of the select-mode bar in light and dark themes show Pack drawn at the same weight as its neighbours. No behaviour change, so no test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(library): reject the whole pack when it passes the size limit CodeRabbit (review of 1dcd22de4): when the running uncompressed total went over the 4 GB limit, extraction broke out of the loop and returned the books it had already read, though it logged "Rejected archive". It now closes the reader and returns null, as the entry-count limit does. Test that fails without the change: pack-service.test.ts "rejects the whole archive when the cumulative size limit is exceeded" (five entries reported at the 1 GB per-book limit) failed with "expected { collectionName: undefined, …(2) } to be null" and passes with it. Related suites: 158 passed. pnpm lint and pnpm format:check pass. Not run: a real archive over 4 GB in the app. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(i18n): add English plural forms for the pack messages (owner: the translation should also have plural formats for EN language) The three new count strings had _one/_other variants in the other locales but none in en, so English showed the key as written: "Creating package for 1 book(s)...", "1 book(s) omitted ..." and "Restored collection "Classics" (1 books)". Test that fails without the change (src/__tests__/app/library/ pack-library-utils.test.ts, "uses singular and plural book counts"): expected 'Creating package for 1 book(s)...' to be 'Creating package for 1 book...'. It passes with the change; pnpm lint and pnpm format:check pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(library): restore each book's group from the pack (owner: yes, restore each book's group from the manifest) A pack made from several groups, or from a group with subfolders, has no collection name. Its manifest records each book's group, but import read only the collection name, so every book landed in one place and the groups were lost. extractCollectionPack now returns each book with its group from the manifest, falling back to the pack's collection name (older and hand-made packs). The picker/drop, Open-with and BookDrop paths put each book in its own group. Importing from inside a group still puts every book in that group, and the BookDrop "Restored collection" toast is still shown only for a named collection. Tests that fail without the change (src/__tests__/services/ pack-service.test.ts): - "keeps each book's group when the pack spans several groups": expected undefined to deeply equal [ 'Classics', 'Classics/Poetry', …(2) ] - "puts books without their own group in the pack collection": expected undefined to deeply equal [ 'Classics', 'Classics' ] Verified in the app: - Web (dev-web, fresh profiles): a pack with books in Klassiker, Klassiker/Novellen and Essays restores all three groups. Pack on Klassiker + Essays + an ungrouped book exports readest-collection.rbooks with each book's group; a second fresh profile imports it with the same groups and the loose book at the root. Dropping the pack while inside Essays puts every book in Essays. - Linux desktop (CEF, fresh profiles): Open-with of that export restores the same groups. BookDrop of the Klassiker group between two profiles shows "Restored collection "Klassiker" (3 books)" and leaves no pack file behind. Not run: Android, macOS, Windows and iOS. pnpm lint and pnpm format:check pass; related suites (pack, library, localsend: 353 tests) pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Huang Xin <chrox.huang@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| main | ||
| test/java/com/bilingify/readest | ||