52 Commits

Author SHA1 Message Date
Joseph Milazzo
6e1b227e65
Transaction Support (#309)
* Added transactions to UnitOfWork and refactored code to use it.

* This included blank UI fix from Kavita-webui
2021-06-18 07:37:48 -05:00
Joseph Milazzo
aa7439178c
Don't log exceptions to Sentry when debugging locally. Fixed a constraint issue with collection tags that prevented deleting series. Ensure when we scan we add SeriesMetadata objects to existing series. (#265) 2021-06-04 17:49:19 -05:00
Joseph Milazzo
a01613f80f
EPUB Support (#178)
* Added book filetype detection and reorganized tests due to size of file

* Added ability to get basic Parse Info from Book and Pages.

* We can now scan books and get them in a library with cover images.

* Take the first image in the epub if the cover isn't set.

* Implemented the ability to unzip the ebup to cache. Implemented a test api to load html files.

* Just some test code to figure out how to approach this.

* Fixed some merge conflicts

* Removed some dead code from merge

* Snapshot: I can now load everything properly into the UI by rewriting the urls before I send them back. I don't notice any lag from this method. It can be optimized further.

* Implemented a way to load the content in the browser not via an iframe.

* Added a note

* Anchor mappings is complete. New anchors are updated so references now resolve to javascript:void() for UI to take care of internally loading and the appropriate page is mapped to it. Anchors that are external have target="_blank" added so they don't force you out of the app and styles are of course inlined.

* Oops i need this

* Table of contents api implemented (rough) and some small enhancements to codebase for books.

* GetBookPageResources now only loads files from within the book. Nested chapter list support and images now use html parsing instead of string parsing.

* Fonts now are remapped to load from endpoint.

* book-resources now uses a key, ensuring the file is in proper format for lookup. Changed chapter list based on structure with one HEADER and nested chapters.

* Properly handle svg resource requests and when there are part anchors that are clickable, make sure we handle them in the UI by adding a kavita-page handler.

* Add Chapter group page even if one isn't set by using first page (without part) from nestedChildren.

* Added extra debug code for issue #163.

* Added new user preferences for books and updated the css so we scope it to our reading section.

* Cleaned up style code

* Implemented ability to save book preferences and some cleanup on existing apis.

* Added an api for checking if a user has read something in a library type before.

* Forgot to make sure the has reading progress is against a user lol.

* Remove cacheservice code for books, sine we use an in-memory method

* Handle svg images as well

* Enhanced cover image extraction to check for a "cover" image if the cover image wasn't set in OPF before falling back to the first image.

* Fixed an issue with special books not properly generating metadata due to not having filename set.

* Cleanup, removed warmup task code from statup/program and changed taskscheduler to schedule tasks on startup only (or if tasks are changed from UI).

* Code cleanup

* Code cleanup

* So much code. Lots of refactors to try to test scanner service. Moved a lot of the queries into Extensions to allow to easier test, even though it's hacky. Support @font-face src:url swaps with ' and ". Source summary information from epubs.

* Well...baseURL needs to come from BE and not from UI lol.

* Adjusted migrations so default values match Entity

* Removed comment

* I think I finally fixed #163! The issue was that when i checked if it had a parserInfo, i wasn't considering that the chapter range might have a - in it (0-6) and so when the code to check if range could parse out a number failed, it treated it like a special and checked range against info's filename.

* Some bugfixes

* Lots of testing, extracting code to make it easier to test. This code is buggy, but fixed a bug where 1) If we changed the normalization code, we would remove the whole db during a scan and 2) We weren't actually removing series properly.

Other than that, code is being extracted to remove duplication and centralize logic.

* More code cleanup and test cleanup to ensure scan loop is working as expected and matches expectaions from tests.

* Cleaned up the code and made it so if I change normalization, which I do in this branch, it wont break existing DBs.

* Some comic parser changes for partial chapter support.

* Added some code for directory service and scanner service along with python code to generate test files (not used yet). Fixed up all the tests.

* Code smells
2021-04-28 16:16:22 -05:00
Joseph Milazzo
d3c14863d6
Performance, Scan Loop, Specials, and cleanup (#150)
* More cases for parsing regex

* Fixed a bug where chapter cover images weren't being updated due to a missed not.

* Removed a piece of code that was needed for upgrading, since all beta users agreed to wipe db.

* Fixed InProgress to properly respect order and show more recent activity first. Issue is with IEntityDate LastModified not updating in DataContext.

* Updated dependencies to lastest stable.

* LastModified on Volumes wasn't updating, validated it does update when data is changed.

* Rewrote a check to avoid a small heap object warning.

* Ensure UpdateSeries checks all libraries for unique name.

* Took care of some todos, removed unused imports, on dev go ahead and schedule reoocuring jobs since LiteDB caused the locking issue.

* No Tracking when we aren't using entities.

* Added code to remove abandoned progress rows after a chapter gets deleted.

* RefreshMetadata uses one large query rather than many trips to DB for updating metadata. Significantly faster.

* Fixed a bug where UpdateSeries would always complain about a unique name even when we weren't updating name.

* Files that are linked to a series but can't parse out Vol/Chapter information are properly grouped like other Specials.

* Refresh metadata on UI should call the task directly

* Fixed a bug on updating series to make sure we don't complain if we aren't trying to update the name to an existing name.

* Fixed #142 - Library cards should be sorted.

* Refactored the name of some variables to be more agnostic to comics.

* Implemented ScanLibrary but abandoning it.

* Code Cleanup & removing ScanSeries code.

* Some more tests and new Comparators for natural sorting.

* Fixed #137 - When performing I/O on archives, ignore __MACOSX folders completely.

* Fixed #137 - When performing I/O on archives, ignore __MACOSX folders completely.

* All entities that will show under specials tab should be marked special, rather than just what has a special keyword.

* Don't let specials generate cover images

* Don't let specials generate cover images

* SearchResults should send LocalizedName back since we are searching against it.

* Added some tests around macosx folders found from my actual server.

* Put extra notes about a case where duplicates come about, logger will now tell user about this issue.

* Missed a build issue somehow...

* Some code smells
2021-04-05 08:37:45 -05:00
Joseph Milazzo
d73bd22db2 Some code cleanup 2021-03-23 12:22:47 -05:00
Joseph Milazzo
52b91a9b92 Public caching causes an issue with cache validation on browser causing images not to be cached correctly. Made private to ensure we get proper images each load. 2021-03-12 18:35:12 -06:00
Joseph Milazzo
24118da49c Added localizedName for search function 2021-03-12 13:23:21 -06:00
Joseph Milazzo
922c0153d3 Added series progress/rating information back in. Left attempts at doing via a JOIN or raw SQL. 2021-02-17 15:28:57 -06:00
Joseph Milazzo
222959981f Implemented pagination on GetSeriesForLibrary 2021-02-17 11:23:08 -06:00
Joseph Milazzo
b4ee16d8d1 Code cleanup. Implemented ability to schedule Library Backups. 2021-02-17 08:58:36 -06:00
Joseph Milazzo
83b9394b17 Implemented ability to mark a series as Read/Unread. 2021-02-16 12:48:04 -06:00
Joseph Milazzo
2887fab53f Implements search functionality and prepares for upcoming paging in v0.3. 2021-02-15 13:08:30 -06:00
Joseph Milazzo
9461b89725 A hefty refactor of the ScanLibrary code. There were significant fallouts due to duplicate entities getting created and SingleOrDefaults failing. 2021-02-08 12:03:52 -06:00
Joseph Milazzo
10c8ea34fe Cleanup after feature implementation. 2021-02-04 17:01:37 -06:00
Joseph Milazzo
e60f795410 Refactored Cache Cleanup code. 2021-02-02 09:40:26 -06:00
Joseph Milazzo
7cd0b80ac2 More regex tweaking and use cases for real library. 2021-01-24 14:08:09 -06:00
Joseph Milazzo
3c8e4b2240 Cleaned up some warnings and implemented re-occuring scan libraries task. Customization of task schedules is in v0.2. 2021-01-19 14:41:50 -06:00
Joseph Milazzo
e180032a8e ScanLibrary now respects the library a series belongs to, doesn't reset series every run but updates/removes/inserts as needed. 2021-01-19 14:35:24 -06:00
Joseph Milazzo
c75feb03e1 Fixed offset bug in GetCachedPagePath for if you've read just one page. Fixed a bad refactor for getting files. 2021-01-19 12:06:45 -06:00
Joseph Milazzo
14e8c3b820 Fixed some APIs that worked mins ago....something strange happening with EF relationships. 2021-01-19 10:45:37 -06:00
Joseph Milazzo
295e62d773 Fixed grant-access api and new library to properly update the db. Somehow the old way of updating db no longer works. 2021-01-18 17:18:42 -06:00
Joseph Milazzo
26660a9bb3 Further cleanup. Moved BackgroundJob Task enqueues into TaskScheduler, so I can have complete control via one interface. 2021-01-18 13:53:24 -06:00
Joseph Milazzo
825afd83a2 Removed some dead code on the interfaces. Introduced UnitOfWork to simplify repo injection. 2021-01-18 13:07:48 -06:00
Joseph Milazzo
effdf07cef Very messy code that implements read status tracking. Needs major cleanup. 2021-01-17 15:05:27 -06:00
Joseph Milazzo
56e8a0059e Implemented ability to delete a series. Refactored some operations to remove unneeded parameters. 2021-01-12 16:51:23 -06:00
Joseph Milazzo
731e3a9c5e Cache cleanup implemented 2021-01-11 15:39:25 -06:00
Joseph Milazzo
f737f662df Added a sorting mechanism to emulate how windows sorts files. Refactored cache to support chapter folders as well. 2021-01-10 12:47:34 -06:00
Joseph Milazzo
59a4921ba9 Refactored ScanLibrary to produce page numbers on the Manga File, Format and to update existing series/volumes rather than always create new entries. 2021-01-09 15:27:04 -06:00
Joseph Milazzo
14ad2a3dd5 Fixed the github build issue. I'm totally blind. 2021-01-08 10:41:43 -06:00
Joseph Milazzo
cf953c1e06
Merge pull request #20 from Kareadita/feature/cover-images
Implements ability to set cover images from archive files and to force updating DB entries. Cover images will be compressed and a thumbnail will be saved rather than raw image due to size of raw files (1MB vs 60 KB)
2021-01-08 10:10:02 -06:00
Joseph Milazzo
13dab81f39 Will this fix Github build complaining when local builds fine? 2021-01-08 09:38:15 -06:00
Joseph Milazzo
0b35ec70fd Refactored GetCoverImage to create a thumbnail (optional) instead of raw image (raw images are large and bloat API, using thumbnail is indistiguishable); b) Ability to force updating cover images in DB even if they are already set. 2021-01-07 10:30:54 -06:00
Joseph Milazzo
0b486cdc08 Scan library after we edit library folders, only if folders have differences. 2021-01-04 13:10:19 -06:00
Joseph Milazzo
219f6e675a Implemented the ability to update a library including folders. 2021-01-04 13:06:01 -06:00
Joseph Milazzo
5e18c1bf3a Implemented the ability to delete a Library. 2021-01-02 12:59:04 -06:00
Joseph Milazzo
7b1714349d Refactored ScanLibrary to accept and library id rather than DTO. Refactored ScanLibrary to use Task.Run() rather than having synchronous repo methods. 2021-01-02 12:48:48 -06:00
Joseph Milazzo
9168e12483 Refactored Volume to have Name and Number (int) so that we can properly sort and still handle possible split volumes.
Refactored ScanLibrary into Library controller and updated it so it adds the new library to all admins.
2021-01-02 12:21:36 -06:00
Joseph Milazzo
55a44000fc Changed scan to POST and added new API for route gurads on UI. 2021-01-02 09:25:45 -06:00
Joseph Milazzo
c429c50ba2 Fixed a bug in ScanLibrary that caused duplicated Volumes. Implemented APIs for navigating down to Volume for webui.
This is rough code and needs to be polished and refactored.
2021-01-01 14:04:31 -06:00
Joseph Milazzo
380c3e7b3c Rough version of Saving Series, Volumes, and MangaFiles to the DB. Relies on Cascaded delete rather than manually handling updating of file changes. 2020-12-30 11:30:12 -06:00
Joseph Milazzo
104c63b2b9 Cleaned up the code from previous enhancements. 2020-12-29 11:01:52 -06:00
Joseph Milazzo
4fd9943b91 Added Hangfire with LiteDB for a task running system. At the most basic, this allows us to monitor tasks running on the system (during dev only) and run tasks on a reoccuring or ad-hoc basis. 2020-12-26 14:03:35 -06:00
Joseph Milazzo
e1c1719b6a Merge branch 'main' of https://github.com/Kareadita/Kavita into feature/scan-library 2020-12-26 09:08:49 -06:00
Joseph Milazzo
b3f210a8ab Added Hangfire and Hangfire SQLite extension for future task framework. Added a basic directory scanning implementation. 2020-12-26 09:08:27 -06:00
Andrew Song
2d066ea36c Fixing sonar code quality recommendations 2020-12-25 15:08:40 -06:00
Joseph Milazzo
f8c50b40bb Ensure only admins can call getDirectories 2020-12-24 10:37:49 -06:00
Joseph Milazzo
b899157015 Enhanced DirectoryService to exclude System and Hidden folders. 2020-12-24 09:14:48 -06:00
Joseph Milazzo
f0919042b0 Added a new policy to require being an admin. Implemented ability to delete a user. 2020-12-24 08:13:58 -06:00
Andrew Song
8f7df85d49 Refractor token auth stuff to use identiycore framework 2020-12-21 09:24:21 -06:00
Joseph Milazzo
8156aeb495 Some api work 2020-12-20 17:47:18 -06:00