v0.7.5 - Remove from On Deck (#2142)
* Report Media Issues (#1964) * Started working on a report problems implementation. * Started code * Added logging to book and archive service. * Removed an additional ComicInfo read when comicinfo is null when trying to load. But we've already done it once earlier, so there really isn't any point. * Added basic implementation for media errors. * MediaErrors will ignore duplicate errors when there are multiple issues on same file in a scan. * Fixed unit tests * Basic code in place to view and clear. Just UI Cleanup needed. * Slight css upgrade * Fixed up centering and simplified the code to use regular array instead of observables as it wasn't working. * Fixed unit tests * Fixed unit tests for real * Bump versions by dotnet-bump-version. * Expanded Metadata for EPUBs (#1965) * Fixed a bug breaking ability to save server settings * Explicitly capture more people roles from Epubs, else fallback to how we do it now. It seems to be getting called twice and 2nd time is overriding data. Not sure why * Refactored the code to clean it up * Added support for generating collections or reading list based on dc:title and collection title-type with an optional display-seq. * ReadingList/Collection support can't be done until VersOne supports. https://github.com/vers-one/EpubReader/issues/81 * Double include author for epub parsing and let the People code handle removing duplicates. * Bump versions by dotnet-bump-version. * Nothing changed, this is just to retrigger a stable build. (#1967) (#1968) * Adding paper book reader theme (#1976) * Adding paper book reader theme # Added - Added: Paper book reader theme * Fixing some leftover styles * adding book emulation to 2column layout for paper style * Adding migrations * removing migration and compressing image * Reverting DataContextModelSnapshot * checking out datacontextmodelsnapshot file * Bump versions by dotnet-bump-version. * Web Links (#1983) * Updated dependencies * Updated the default key to be 256 bits to meet security requirements. * Added basic implementation of web link resolving favicon. Needs lots more work and testing on all OSes. * Implemented ability to see links and click on them for an individual chapter. * Hooked up the ability to set Series web links. * Render out the web link * Refactored out the favicon so there is a backup in case it fails. Refactored the baseline image placeholders to be dark mode since that is the default. * Added Robbie's nice error weblink fallbacks. * Bump versions by dotnet-bump-version. * Updated Docker entrypoint (#1984) * Bump versions by dotnet-bump-version. * ISBN Support (#1985) * Fixed a bug where weblinks would always show * Started to try and support ico -> png conversion by manually grabbing image data out, but it's hard as hell. * Implemented ability to parse out ISBN codes for books and ISBN-13 codes for ComicInfo. I can't figure out ISBN-10. * Fixed Favicon not working on anything but windows * Implemented ISBN support into Kavita * Don't round so much when transforming bytes * Bump versions by dotnet-bump-version. * AVIF Support & Much More! (#1992) * Expand the list of potential favicon icons to grab. * Added a url mapping functionality to use alternative urls for fetching icons * Initial commit to streamline media encoding. No DB migration yet, No UI changes, no Task changes. * Started refactoring code so that webp queries use encoding format instead. * More refactoring to remove hardcoded webp references. * Moved manual migrations to their own folder to keep things organized. Manually drop the obsolete webp keys. * Removed old apis for converting media and now have one. Reworked where the conversion code was located and streamlined events and whatnot. * Make favicon encode setting aware * Cleaned up favicon conversion * Updated format counter to now just use Extension from MangaFile now that it's been out a while. * Tweaked jumpbar code to reduce a lookup to hashmap. * Added AVIF (8-bit only) support. * In UpdatePeopleList, use FirstOrDefault as Single adds extra checks that may not be needed. * You can now remove weblinks from edit series page and you can leave empty cells, they will just be removed on backend. * Forgot a file * Don't prompt to write a review, just show the pencil. It's the same amount of clicks if you do, less if you dont. * Fixed Refresh token using wrong Claim to look up the user. * Refactored how we refresh authentication to perform it every 10 m ins to ensure we always stay authenticated. * Changed Version update code to run more throughout the day. Updated some hangfire to newer method signatures. * Bump versions by dotnet-bump-version. * More Fixes (#1993) * Strip just isbn: from epub isbns and log when it's back (books) * Tweaked to allow invalid GTINs but only valid ISBN 10/13s will be saved to Kavita. * Fixed a bug with parsing series from a filename that is just a chapter range and no chapter/volume keywords. * Show the media issue count before you open accordion * Added a inpage filter for Media issues * Cleanup styles * Fixed up some code in epub isbn parsing when it's null * Encode filenames when downloading so that non english characters can be passed properly to UI. * Added support to parse ComicInfo's with Empty Tags. * Reset development settings. * Tweaked the code in generating reading lists to avoid extra work when not needed. * Fix comicvine's favicon * Fixed up a unit test * Tweaked the favicon code to ignore icons that have query parameters * More favicon work. Expanded ability to grab icons a bit. Added in ability to not keep requesting favicons when we failed to parse already. * Added a note for later * Fixed stats server url * Added more debugging * Fixed unit tests * Bump versions by dotnet-bump-version. * More Fixes from Recent PRs (#1995) * Added extra debugging for logout issue * Fixed the null issue with ISBN * Allow web links to be cleared out * More logging on refresh token * More key fallback when building Table of Contents * Added better fallback implementation for building table of contents based on the many different ways epubs are packed and referenced. * Updated dependencies * Fixed up refresh token refresh which was invalidating sessions for no reason. Added it to update last active time as well. * Bump versions by dotnet-bump-version. * Fixed a bug with config (#1996) * Bump versions by dotnet-bump-version. * Changed IsDocker check (#1998) * Refactored IsDocker to be completely static and changed to use an environment variable instead. * Removed file from another branch * Bump versions by dotnet-bump-version. * Migrated up to VersOne 3.3 with epub 3.3 support. (#1999) This enables collection and reading list support from epubs. * Bump versions by dotnet-bump-version. * More Bugfixes (EPUB Mainly) (#2004) * Fixed an issue with downloading where spaces turned into plus signs. * If the refresh token is invalid, but the auth token still has life in it, don't invalidate. * Fixed docker users unable to save settings * Show a default error icon until favicon loads * Fixed a bug in mappings (keys/files) to pages that caused some links not to map appropriately. Updated epub-reader to v3.3.2. * Expanded Table of Content generation by also checking for any files that are named Navigation.xhtml to have Kavita generate a simple ToC from (instead of just TOC.xhtml) * Added another hack to massage key to page lookups when rewriting anchors. * Cleaned up debugging notes * Bump versions by dotnet-bump-version. * More Polish (#2005) * Implemented sort title extraction from epub 3 files. * Added link to wiki for media errors * Fixed the hack to reduce JWT refresh token expiration * Fixed up a case where favicon downloading wasn't correcting links that started with // correctly. Added a fallback for sites that just don't pngs available. * Implemented a mechanism to fallback to Kavita's website for favicons which can be dynamically added/updated by the community. * Reworked the logic for bookwalker which will fail to get the base html, so we have to rely on the fallback handler. * Bump versions by dotnet-bump-version. * Angular 16 (#2007) * Removed adv, which isn't needed. * Updated zone * Updated to angular 16 * Updated to angular 16 (partially) * Updated to angular 16 * Package update for Angular 16 (and other dependencies) is complete. * Replaced all takeUntil(this.onDestroy) with new takeUntilDestroyed() * Updated all inputs that have ! to be required and deleted all unit tests. * Corrected how takeUntilDestroyed() is supposed to be implemented. * Bump versions by dotnet-bump-version. * Pipeline adjustment for Angular 16 (#2008) * Bump versions by dotnet-bump-version. * Try a different build (#2009) * Bump versions by dotnet-bump-version. * Continue Reading Bugfix (#2010) * Fixed an edge case where continue point wasn't considering any chapters that had progress. Continue point is now slightly faster and uses less memory. * Added a unit test for a user's case. Still not reproducible * Bump versions by dotnet-bump-version. * Ensure chapters are sorted when getting continue point (#2011) Fixes new behaviour in #1625 * Bump versions by dotnet-bump-version. * Strip more forms of comments from CSS before parsing/inlining. (#2014) Handle if ExCSS throws an exception during inlining and attempt to fallback to scoping css instead of inlining. I still cannot update past ExCSS v4.1.0 else NPEs for common css will be thrown. * Bump versions by dotnet-bump-version. * Misc Changes (#2015) * Updated ng-bootstrap * Fixed an issue where jumpbar would be disabled when it shouldn't have been. * When there are duplicate files that make up a volume, show the count on series detail. * Added basic ISBN searching which will return a chapter back. * Bump versions by dotnet-bump-version. * Fixed count for cards (#2016) * Bump versions by dotnet-bump-version. * Last Release before Release Testing (#2017) * Attempting to invalidate JWT on login (when locked out), but can't figure a way to get a JWT, since we don't store them. Just committing as I'm going to remove the middleware, this is not worth the performance and complexity. * Removed some security stuff that didn't line up. * Dropping Token Expiration down to 2 days to test during release testing. * Bump versions by dotnet-bump-version. * Removed old migrations for Kavita startup. Only migrations from v0.7.2 onwards are present. (#2019) * Bump versions by dotnet-bump-version. * Fixed up jumpbar not properly disabling/enabling (#2022) * Bump versions by dotnet-bump-version. * Fix StoryArc & StoryArcNumber mismatch (#2018) * Ensure StoryArc and StoryArcNumber are max length * Trim StoryArc to remove excess spaces. * Replaced with cleaner approach. * Update with majora2007 recommendations * Bump versions by dotnet-bump-version. * Last fixes before release (#2027) * Disable login button when a login is in-progress. This will help prevent spamming when internet is slow. * Fixed a bug where an empty space could cause an error when creating a library. * Apply Split Options throughout the codebase to add extra safe-guard on empty spaces and ensure trimming. * Bump versions by dotnet-bump-version. * Added NoContent responses when APIs don't find entities (#2028) * Bump versions by dotnet-bump-version. * Few More Fixes (#2032) * Fixed spreads stretching on PC * Fixed a bug where reading list dates couldn't be cleared out. * Reading list page refreshes after updating info in the modal * Fixed an issue where create library wouldn't take into account advanced settings. * Fixed an issue where selection of the first chapter of a series to pull series-level metadata could fail in cases where you had Volume 2 and Chapter 1, Volume 2 would be selected. * Bump versions by dotnet-bump-version. * Fixed a bug where scan series wouldn't trigger word count analysis nor cover generation. (#2035) * Bump versions by dotnet-bump-version. * Okay this should be the last (#2037) * Fixed improper date visualization for reading list detail page. * Correct not-read badge position (#2034) --------- Co-authored-by: Andre Smith <Hobogrammer@users.noreply.github.com> * Bump versions by dotnet-bump-version. * Fixed a bug where reading list month wasn't rendering correctly (#2039) * Bump versions by dotnet-bump-version. * Version bump (#2040) * Bump versions by dotnet-bump-version. * Bugfixes for a hotfix (#2052) * Nothing changed, this is just to retrigger a stable build. (#1967) * v0.7.3 - The Quality of Life Update (#2036) * Version bump * Okay this should be the last (#2037) * Fixed improper date visualization for reading list detail page. * Correct not-read badge position (#2034) --------- Co-authored-by: Andre Smith <Hobogrammer@users.noreply.github.com> * Bump versions by dotnet-bump-version. * Merged develop in --------- Co-authored-by: Andre Smith <Hobogrammer@users.noreply.github.com> * v0.7.3 - The Quality of Life Update (#2041) * Report Media Issues (#1964) * Started working on a report problems implementation. * Started code * Added logging to book and archive service. * Removed an additional ComicInfo read when comicinfo is null when trying to load. But we've already done it once earlier, so there really isn't any point. * Added basic implementation for media errors. * MediaErrors will ignore duplicate errors when there are multiple issues on same file in a scan. * Fixed unit tests * Basic code in place to view and clear. Just UI Cleanup needed. * Slight css upgrade * Fixed up centering and simplified the code to use regular array instead of observables as it wasn't working. * Fixed unit tests * Fixed unit tests for real * Bump versions by dotnet-bump-version. * Expanded Metadata for EPUBs (#1965) * Fixed a bug breaking ability to save server settings * Explicitly capture more people roles from Epubs, else fallback to how we do it now. It seems to be getting called twice and 2nd time is overriding data. Not sure why * Refactored the code to clean it up * Added support for generating collections or reading list based on dc:title and collection title-type with an optional display-seq. * ReadingList/Collection support can't be done until VersOne supports. https://github.com/vers-one/EpubReader/issues/81 * Double include author for epub parsing and let the People code handle removing duplicates. * Bump versions by dotnet-bump-version. * Nothing changed, this is just to retrigger a stable build. (#1967) (#1968) * Adding paper book reader theme (#1976) * Adding paper book reader theme # Added - Added: Paper book reader theme * Fixing some leftover styles * adding book emulation to 2column layout for paper style * Adding migrations * removing migration and compressing image * Reverting DataContextModelSnapshot * checking out datacontextmodelsnapshot file * Bump versions by dotnet-bump-version. * Web Links (#1983) * Updated dependencies * Updated the default key to be 256 bits to meet security requirements. * Added basic implementation of web link resolving favicon. Needs lots more work and testing on all OSes. * Implemented ability to see links and click on them for an individual chapter. * Hooked up the ability to set Series web links. * Render out the web link * Refactored out the favicon so there is a backup in case it fails. Refactored the baseline image placeholders to be dark mode since that is the default. * Added Robbie's nice error weblink fallbacks. * Bump versions by dotnet-bump-version. * Updated Docker entrypoint (#1984) * Bump versions by dotnet-bump-version. * ISBN Support (#1985) * Fixed a bug where weblinks would always show * Started to try and support ico -> png conversion by manually grabbing image data out, but it's hard as hell. * Implemented ability to parse out ISBN codes for books and ISBN-13 codes for ComicInfo. I can't figure out ISBN-10. * Fixed Favicon not working on anything but windows * Implemented ISBN support into Kavita * Don't round so much when transforming bytes * Bump versions by dotnet-bump-version. * AVIF Support & Much More! (#1992) * Expand the list of potential favicon icons to grab. * Added a url mapping functionality to use alternative urls for fetching icons * Initial commit to streamline media encoding. No DB migration yet, No UI changes, no Task changes. * Started refactoring code so that webp queries use encoding format instead. * More refactoring to remove hardcoded webp references. * Moved manual migrations to their own folder to keep things organized. Manually drop the obsolete webp keys. * Removed old apis for converting media and now have one. Reworked where the conversion code was located and streamlined events and whatnot. * Make favicon encode setting aware * Cleaned up favicon conversion * Updated format counter to now just use Extension from MangaFile now that it's been out a while. * Tweaked jumpbar code to reduce a lookup to hashmap. * Added AVIF (8-bit only) support. * In UpdatePeopleList, use FirstOrDefault as Single adds extra checks that may not be needed. * You can now remove weblinks from edit series page and you can leave empty cells, they will just be removed on backend. * Forgot a file * Don't prompt to write a review, just show the pencil. It's the same amount of clicks if you do, less if you dont. * Fixed Refresh token using wrong Claim to look up the user. * Refactored how we refresh authentication to perform it every 10 m ins to ensure we always stay authenticated. * Changed Version update code to run more throughout the day. Updated some hangfire to newer method signatures. * Bump versions by dotnet-bump-version. * More Fixes (#1993) * Strip just isbn: from epub isbns and log when it's back (books) * Tweaked to allow invalid GTINs but only valid ISBN 10/13s will be saved to Kavita. * Fixed a bug with parsing series from a filename that is just a chapter range and no chapter/volume keywords. * Show the media issue count before you open accordion * Added a inpage filter for Media issues * Cleanup styles * Fixed up some code in epub isbn parsing when it's null * Encode filenames when downloading so that non english characters can be passed properly to UI. * Added support to parse ComicInfo's with Empty Tags. * Reset development settings. * Tweaked the code in generating reading lists to avoid extra work when not needed. * Fix comicvine's favicon * Fixed up a unit test * Tweaked the favicon code to ignore icons that have query parameters * More favicon work. Expanded ability to grab icons a bit. Added in ability to not keep requesting favicons when we failed to parse already. * Added a note for later * Fixed stats server url * Added more debugging * Fixed unit tests * Bump versions by dotnet-bump-version. * More Fixes from Recent PRs (#1995) * Added extra debugging for logout issue * Fixed the null issue with ISBN * Allow web links to be cleared out * More logging on refresh token * More key fallback when building Table of Contents * Added better fallback implementation for building table of contents based on the many different ways epubs are packed and referenced. * Updated dependencies * Fixed up refresh token refresh which was invalidating sessions for no reason. Added it to update last active time as well. * Bump versions by dotnet-bump-version. * Fixed a bug with config (#1996) * Bump versions by dotnet-bump-version. * Changed IsDocker check (#1998) * Refactored IsDocker to be completely static and changed to use an environment variable instead. * Removed file from another branch * Bump versions by dotnet-bump-version. * Migrated up to VersOne 3.3 with epub 3.3 support. (#1999) This enables collection and reading list support from epubs. * Bump versions by dotnet-bump-version. * More Bugfixes (EPUB Mainly) (#2004) * Fixed an issue with downloading where spaces turned into plus signs. * If the refresh token is invalid, but the auth token still has life in it, don't invalidate. * Fixed docker users unable to save settings * Show a default error icon until favicon loads * Fixed a bug in mappings (keys/files) to pages that caused some links not to map appropriately. Updated epub-reader to v3.3.2. * Expanded Table of Content generation by also checking for any files that are named Navigation.xhtml to have Kavita generate a simple ToC from (instead of just TOC.xhtml) * Added another hack to massage key to page lookups when rewriting anchors. * Cleaned up debugging notes * Bump versions by dotnet-bump-version. * More Polish (#2005) * Implemented sort title extraction from epub 3 files. * Added link to wiki for media errors * Fixed the hack to reduce JWT refresh token expiration * Fixed up a case where favicon downloading wasn't correcting links that started with // correctly. Added a fallback for sites that just don't pngs available. * Implemented a mechanism to fallback to Kavita's website for favicons which can be dynamically added/updated by the community. * Reworked the logic for bookwalker which will fail to get the base html, so we have to rely on the fallback handler. * Bump versions by dotnet-bump-version. * Angular 16 (#2007) * Removed adv, which isn't needed. * Updated zone * Updated to angular 16 * Updated to angular 16 (partially) * Updated to angular 16 * Package update for Angular 16 (and other dependencies) is complete. * Replaced all takeUntil(this.onDestroy) with new takeUntilDestroyed() * Updated all inputs that have ! to be required and deleted all unit tests. * Corrected how takeUntilDestroyed() is supposed to be implemented. * Bump versions by dotnet-bump-version. * Pipeline adjustment for Angular 16 (#2008) * Bump versions by dotnet-bump-version. * Try a different build (#2009) * Bump versions by dotnet-bump-version. * Continue Reading Bugfix (#2010) * Fixed an edge case where continue point wasn't considering any chapters that had progress. Continue point is now slightly faster and uses less memory. * Added a unit test for a user's case. Still not reproducible * Bump versions by dotnet-bump-version. * Ensure chapters are sorted when getting continue point (#2011) Fixes new behaviour in #1625 * Bump versions by dotnet-bump-version. * Strip more forms of comments from CSS before parsing/inlining. (#2014) Handle if ExCSS throws an exception during inlining and attempt to fallback to scoping css instead of inlining. I still cannot update past ExCSS v4.1.0 else NPEs for common css will be thrown. * Bump versions by dotnet-bump-version. * Misc Changes (#2015) * Updated ng-bootstrap * Fixed an issue where jumpbar would be disabled when it shouldn't have been. * When there are duplicate files that make up a volume, show the count on series detail. * Added basic ISBN searching which will return a chapter back. * Bump versions by dotnet-bump-version. * Fixed count for cards (#2016) * Bump versions by dotnet-bump-version. * Last Release before Release Testing (#2017) * Attempting to invalidate JWT on login (when locked out), but can't figure a way to get a JWT, since we don't store them. Just committing as I'm going to remove the middleware, this is not worth the performance and complexity. * Removed some security stuff that didn't line up. * Dropping Token Expiration down to 2 days to test during release testing. * Bump versions by dotnet-bump-version. * Removed old migrations for Kavita startup. Only migrations from v0.7.2 onwards are present. (#2019) * Bump versions by dotnet-bump-version. * Fixed up jumpbar not properly disabling/enabling (#2022) * Bump versions by dotnet-bump-version. * Fix StoryArc & StoryArcNumber mismatch (#2018) * Ensure StoryArc and StoryArcNumber are max length * Trim StoryArc to remove excess spaces. * Replaced with cleaner approach. * Update with majora2007 recommendations * Bump versions by dotnet-bump-version. * Last fixes before release (#2027) * Disable login button when a login is in-progress. This will help prevent spamming when internet is slow. * Fixed a bug where an empty space could cause an error when creating a library. * Apply Split Options throughout the codebase to add extra safe-guard on empty spaces and ensure trimming. * Bump versions by dotnet-bump-version. * Added NoContent responses when APIs don't find entities (#2028) * Bump versions by dotnet-bump-version. * Few More Fixes (#2032) * Fixed spreads stretching on PC * Fixed a bug where reading list dates couldn't be cleared out. * Reading list page refreshes after updating info in the modal * Fixed an issue where create library wouldn't take into account advanced settings. * Fixed an issue where selection of the first chapter of a series to pull series-level metadata could fail in cases where you had Volume 2 and Chapter 1, Volume 2 would be selected. * Bump versions by dotnet-bump-version. * Fixed a bug where scan series wouldn't trigger word count analysis nor cover generation. (#2035) * Bump versions by dotnet-bump-version. * Okay this should be the last (#2037) * Fixed improper date visualization for reading list detail page. * Correct not-read badge position (#2034) --------- Co-authored-by: Andre Smith <Hobogrammer@users.noreply.github.com> * Bump versions by dotnet-bump-version. * Fixed a bug where reading list month wasn't rendering correctly (#2039) * Bump versions by dotnet-bump-version. * Version bump (#2040) * Bump versions by dotnet-bump-version. * Fixed bug in CI pipeline for main --------- Co-authored-by: Robbie Davis <robbie@therobbiedavis.com> Co-authored-by: Chris Plaatjes <kizaing@gmail.com> Co-authored-by: pssandhu <pssandhu@users.noreply.github.com> Co-authored-by: Jolyon Suthers <jolyon.suthers@gmail.com> Co-authored-by: Andre Smith <Hobogrammer@users.noreply.github.com> * Reverted a scaling issue for fit to width * Fixed an issue where creating a new library wouldn't persist advanced options due to a conflict with default value. When deleting a library, give the library name in the prompt. * Fixed kbd tags in epubs with paper theme having a style conflict. * Fixed an edge case where the incorrect first cover could be chosen in some strange grouping situations. * Manually sort directories as some OSes don't return them in a natural sort order. * Fixed an issue where autocompleting when adding a directory could throw an error when you're typing. --------- Co-authored-by: Andre Smith <Hobogrammer@users.noreply.github.com> Co-authored-by: Robbie Davis <robbie@therobbiedavis.com> Co-authored-by: Chris Plaatjes <kizaing@gmail.com> Co-authored-by: pssandhu <pssandhu@users.noreply.github.com> Co-authored-by: Jolyon Suthers <jolyon.suthers@gmail.com> * Bump versions by dotnet-bump-version. * [skipci] No User facing Changes (#2054) * Setup canary GA * Fixed bad repo * Aligned GA (#2059) * v0.7.4 - Kavita+ Launch (#2117) * Initial Canary Push (#2055) * Added AniList Token * Implemented the ability to set your AniList token. License check is not in place. * Added a check that validates AniList token is still valid. As I build out more support, I will add more checks. * Refactored the code to validate the license before allowing UI control to be edited. * Started license server stuff, but may need to change approach. Hooked up ability to scrobble rating events to KavitaPlus API. * Hooked in the ability to sync Mark Series as Read/Unread * Fixed up unit tests and only scrobble when a full chapter is read naturally. * Fixed up the Scrobbling service * Tweak one of the queries * Started an idea for Scrobble History, might rework into generic TaskHistory. * AniList Token now has a validation check. * Implemented a mechanism such that events are persisted to the database, processed every X hours to the API layer, then deleted from the database. * Hooked in code for want to read so we only send what's important. Will migrate these to bulk calls to lessen strain on API server. * Added some todos. Need to take a break. * Hooked up the ability to backfill scrobble events after turning it on. * Started on integrating license key into the server and ability to turn off scrobbling at the library level. Added sync history table for scrobbling and other API based information. * Started writing to sync table * Refactored the migrations to flatten them. Started working a basic license add flow and added in some of the cache. Lots to do. * Ensure that when we backfill scrobble events, we respect if a library has scrobbling turned on or not. * Hooked up the ability to send when the series was started to be read * Refactored the UI to streamline and group KavitaPlus Account Forms. * Aligning with API * Fixed bad merge * Fixed up inputting a user license. * Hooked up a cron task that validates licenses every 4 hours and on startup. * Reworked how the update license code works so that we always update the cache and we handle removing license from user. * Cleaned up some UI code * UserDto now has if there is a valid license or not. It's not exposed though as there is no need to expose the license key ever. * Fixed a strange encoding issue with extra ". Started working on having the UI aware of the license information. Refactored all code to properly pass the correct license to the API layer. * There is a circular dependency in the code. Fixed some theme code which wasn't checking the right variable. Reworked the JWT interceptor to be better at handling async code. Lots of misc code changes, DI circular issue is still present. * Fixed the DI issue and moved all things that need bootstrapping to app.component. * Hooked up the ability to not have a donation button show up if the server default user/admin has a valid KavitaPlus license. * Refactored how we extract out ids from weblinks * Ensure if API fails, we don't delete the record. * Refactored how rate checks occur for scrobbling processing. * Lots of testing and ensuring rate limit doesn't get destroyed. * Ensure the media item is valid for that user's providers set. * Refactored the loop code into one method to keep things much cleaner * Lots of code to get the scrobbling streamlined and foolproof. Unknown series are now reported on the UI. * Prevent duplicates for scrobble errors. * Ensure we are sending the correct type to the Scrobble Provider * Ensure we send the date of the scrobble event for upstream to use. * Replaced the dedicated run backfilling of scrobble events to just trigger when setting the anilist token for the first time. Streamlined a lot of the code for adding your license to ensure user understands how it works. * Fixed a bug where scan series wasn't triggering word count or cover generation. * Started the plumbing for recommendations * Merge conflicts * Recommendation plumbing is nearly complete. * Setup response caching and general cleanup * Fixed UI not showing the recommendation tab * Switched to prod url * Fixed broken unit tests due to Hangfire not being setup for unit tests * Fixed branch selection (#2056) * Damn you GA (#2058) * Bump versions by dotnet-bump-version. * Fixed GA not pulling the right branch and removed unneeded building from veresion job (#2060) * Bump versions by dotnet-bump-version. * Canary Second (#2071) * Just started * Started building the user review card. Fixed Recommendations not having user progress on them. * Fixed a bug where scrobbling ratings wasn't working. * Added a temp ability to trigger scrobbling processing for testing. * Cleaned up the design of review card. Added a temp way to trigger scrobbling. * Fixed clear scrobbling errors and refactored so reviews now load from DB and is streamlined. * Refactored so edit review is now a single module component and editable from the series detail page. * Removed SyncHistory table as it's no longer needed. Refactored read events to properly update to the latest progress information. Refactored to a new way of clearing events, so that user's can see their scrobble history. * Fixed a bug where Anilist token wouldn't show as set due to some state issue * Added the ability to see your own scrobble events * Avoid a potential collision with recommendations. * Fixed an issue where when checking for a license on UI, it wouldn't force the check (in case server was down on first check). * External reviews are implemented. * Fixed unit tests * Bump versions by dotnet-bump-version. * Made the api url dynamic based on dev more or not. (#2072) * Bump versions by dotnet-bump-version. * Canary Build 3 (#2079) * Updated reviews to have tagline support to match how Anilist has them. Cleaned up the KavitaPlus documentation and added a feature list. Review cards look much better. * Fixed up a NPE in scrobble event creation * Removed the ability to have images leak in the read more review card. Review's now show the user if they are a local user, else External. * Added caching to the reviews and recommendations that come from an external source. Max of 50MB will be used across whole instance. Entries are cached for 1 hour. * Reviews are looking much better * Added the ability for users to share their series reviews with other users on the server via a new opt-in mechanism. Fixed up some cache busting mechanism for reviews. * More review polish to align with better matching * Added the extra information for Recommendation matching. * Preview of the review is much cleaner now and the full body is styled better. * More anilist specific syntax * Fixed bad regex * Added the ability to bust cache. Spoilers are now implemented for reviews. Introduces: --review-spoiler-bg-color --review-spoiler-text-color * Bump versions by dotnet-bump-version. * Canary Build 4 (#2086) * Updated Kavita Plus feature list. Added a hover-over to the progress bars in the app to know exact percentage of reading for a chapter or series. * Added a button to go to external review. Changed how enums show in the documentation so you can see their string value too. Limited reviews to top 10 with proper ordering. Drastically cleaned up how we handle preview summary generation * Cleaned up the margin below review section * Fixed an issue where a processed scrobble event would get updated instead of a new event created. * By default, there is now a prompt on series review to add your own, which fills up the space nicely. Added the backend for Series Holds. * Scrobble History is now ordered by recent -> latest. Some minor cleanup in other files. * Added a simple way to see and toggle scrobble service from the series. * Fixed a bug where updating the user's last active time wasn't writing to database and causing a logout event. * Tweaked the registration email wording to be more clear for email field. * Improved OPDS Url generation and included using host name if defined. * Fixed the issues with choosing the correct series cover image. Added many unit tests to cover the edge cases. * Small cleanup * Fixed an issue where urls with , in them would break weblinks. * Fixed a bug where we weren't trying a png before we hit fallback for favicon parsing. * Ensure scrobbling tab isn't active without a license. Changed how updating user last active worked to supress more concurrency issues. * Fixed an issue where duplicate series could appear on newly added during a scan. * Bump versions by dotnet-bump-version. * Fixed a bad dto (#2087) * Bump versions by dotnet-bump-version. * Canary Build 4 (#2089) * New server-based auth is in place with the ability to register the instance. * Refactored to single install bound licensing. * Made the Kavita+ tab gold. * Change the JWTs to last 10 days. This is a self-hosted software and the usage doesn't need the level of 2 days expiration * Bump versions by dotnet-bump-version. * Canary Build 4 (#2090) * By default, a new library will only have scrobbling on if it's of type book or manga given current scrobble providers. * Started building out external reviews. * Added the ability to re-enter your license information. * Fixed side nav not extending enough * Fixed a bug with info cards * Integrated rating support, fixed review cards without a tagline, and misc fixes. * Streamlined where ratings are located on series detail page. * Aligned with other series lookups * Bump versions by dotnet-bump-version. * Canary Build 6 (#2092) * Cleaned up some messaging * Fixed up series detail * Cleanup * Bump versions by dotnet-bump-version. * Canary Build 6 (#2093) * Fixed scrobble token not being visible by default. * Added a loader for external reviews * Added the ability to edit series details (weblinks) from Scrobble Issues page. * Slightly lessened the focus on buttons * Fixed review cards so whenever you click your own review, it will open the edit modal. * Need for speed - Updated Kavita log to be much smaller and replaced all code ones with a 32x version. * Optimized a ton of our images to be much smaller and faster to load. * Added more MIME types for response compression * Edit Series modal name field should be readonly as it is directly mapped to file metadata or filename parsed. It shouldn't be changeable via the UI. * Removed the ability to update the Series name via Kavita UI/API as it is no longer editable. * Moved Image component to be standalone * Moved ReadMore component to be standalone * Moved PersonBadge component to be standalone * Moved IconAndTitle component to be standalone * Fixed some bugs with standalone. * Hooked in the ability to scrobble series reviews. * Refactored everything to use HashUtil token rather than InstallId. * Swapped over to a generated machine token and fixed an issue where after registering, the license would not say valid. * Added the missing migration for review scrobble events. * Clean up some wording around busting cache. * Fixed a bug where chapters within a volume could be unordered in the UI info screen. * Refactored to prepare for external series rendering on series detail. * Implemented external recs * Bump versions by dotnet-bump-version. * Canary Build 7 (#2097) * Aligned ExtractId to extract a long, since MAL id can be just that. * Fixed external series card not clicking correctly. Fixed a bug when extracting a Mal link. Fixed cancel button on license component. * Renamed user-license to license component given new direction for licensing. * Implemented card layout for recommendations * Moved more components over to be standalone and removed pipes module. This is going to take some time for sure. * Removed Cards and SharedCardsSideNav and SideNav over to standalone. This has been shaken out. * Cleaned up a bunch of extra space on reading list detail page. * Fixed rating popover not having a black triangle. * When checking license, show a loading indicator for validity icon. * Cache size can now be changed by admins if they want to give more memory for better browsing. * Added LastReadTime * Cleanup the scrobbling control text for Library Settings. * Fixed yet another edge case for getting series cover image where first volume is higher than 1 and the rest is just loose leaf chapters. * Changed OPDS Content Type to be application/atom+xml to align better with the spec. * Fixed unit tests * Bump versions by dotnet-bump-version. * Canary Build 7 (#2098) * Fixed the percentage readout on card item progress bar * Ensure scrobble control is always visible * Review card could show person icon in tablet viewport. * Changed how the ServerToken for node locking works as docker was giving different results each time. * After we update series metadata, bust cache * License componet cleanup on the styles * Moved license to admin module and removed feature modal as wiki is much easier to maintain. * Bump versions by dotnet-bump-version. * Canary Build 8 (#2100) * Fixed a very slight amount of the active nav tag bleeding outside the border radius * Switched how we count words in epub to handle languages that don't have spaces. * Updated dependencies and fixed a series cover image on list item view for recs. * Fixed a bug where external recs werent showing summary of the series. * Rewrote the rec loop to be cleaner * Added the ability to see series summary on series detail page on list view. Changed Scrobble Event page to show in server time and not utc. * Added tons of output to identify why unraid generates a new fingerprint each time. * Refactored scrobble event table to have filtering and pagination support. Fixed a few bad template issues and fixed loading scrobbling tab on refresh of page. * Aligned a few apis to use a default pagination rather than a higher level one. * Undo OPDS change as Chunky/Panels break. * Moved the holds code around * Don't show an empty review for the user, it eats up uneeded space and is ugly. * Cleaned up the review code * Fixed a bug with arrow on sortable table header. * More scrobbling debug information to ensure events are being processed correctly. * Applied a ton of code cleanup build warnings * Enhanced rec matching by prioritizing matching on weblinks before falling back to name matching. * Fixed the calculation of word count for epubs. * Bump versions by dotnet-bump-version. * Canary Build 9 (#2104) * Added another unit test * Changed how we create cover images to force the aspect ratio, which allows for Kavita to do some extra work later down the line. Prevents skewing from comic sources. * Code cleanup * Updated signatures to explicitly indicate they return a physical file. * Refactored the GA to be a bit more streamlined. * Fixed up how after cover conversion, how we refresh volume and series image links. * Undid the PhysicalFileResult stuff. * Fixed an issue in the epub reader where html tags within an anchor could break the navigation code for inner-links. * Fixed a bug in GetContinueChapter where a special could appear ahead of a loose leaf chapter. * Optimized aspect ratios for custom library images to avoid shift layout. Moved the series detail page down a bit to be inline with first row of actionables. * Finally fixed the media conversion issue where volumes and series wouldn't get their file links updated. * Added some new layout for license to allow a user to buy a sub after their last sub expired. * Added more metrics for fingerprinting to test on docker. * Tried to fix a bug with getnextchapter looping incorrectly, but unable to solve. * Cleanup some UI stuff to reduce bad calls. * Suppress annoying issues with reaching K+ when it's down (only affects local builds) * Fixed an edge case bug for picking the correct cover image for a series. * Fixed a bug where typeahead x wouldn't clear out the input field. * Renamed Clear -> Reset for metadata filter to be more informative of its function. * Don't allow duplicates for reading list characters. * Fixed a bug where when calculating recently updated, series with the same name but different libraries could get grouped. * Fixed an issue with fit to height where there could still be a small amount of scroll due to a timing issue with the image loading. * Don't show a loading if the user doesn't have a license for external ratings * Fixed bad stat url * Fixed up licensing to make it so you have to email me to get a sub renewed. * Updated deps * When scrobbling reading events, recalculate the highest chapter/volume during processing. * Code cleanup * Disabled some old test code that is likely not needed as it breaks a lot on netvips updates * Bump versions by dotnet-bump-version. * Canary Build 10 (#2105) * Aligned fingerprint to be unique * Updated email button to have a template * Fixed inability to progress to next chapter when last page is a spread and user is using split rendering. * Attempted fix at the column reader cutting off parts of the words. Can't fully reproduce, but added a bit of padding to help. * Aligned AniList icon to match that of weblinks. * Bump versions by dotnet-bump-version. * Canary Build 11 (#2108) * Fixed an issue with continuous reader in manga reader. * Aligned KavitaPlus->Kavita+ * Updated the readme * Adjusted first time registration messaging. * Fixed a bug where having just one type of weblink could cause a bad recommendation lookup * Removed manual invocation of scrobbling as testing is over for that feature. * Fixed a bad observerable for downloading logs from browser. * Don't get reviews/recs for comic libraries. Override user selection for scrobbling on Comics since there are no places to scrobble to. * Added a migration so all existing comic libraries will have scrobbling turned off. * Don't allow the UI to toggle scrobbling on a library with no providers. * Refactored the code to not throw generic 500 toasts on the UI. Added the ability to clear your license on Kavita side. * Converted reader settings to new accordion format. * Converted user preferences to new accordion format. * I couldn't convert CBL Reading modal to new accordion directives due to some weird bug. * Migrated the whole application to standalone components. This fixes the download progress bar not showing up. * Hooked up the ability to have reading list generate random items. Removed the old code as it's no longer needed. * Added random covers for collection's as well. * Added a speed up to not regenerate merged covers if we've already created them. * Fixed an issue where tooltips weren't styled correctly after updating a library. Migrated Library access modal to OnPush. * Fixed broken table styling. Fixed grid breakpoint css variables not using the ones from variables due to a missing import. * Misc fixes around tables and some api doc cleanup * Fixed a bug where when switching from webtoon back to a non-webtoon reading mode, if the browser size isn't large enough for double, the reader wouldn't go to single mode. * When combining external recs, normalize names to filter out differences, like capitalization. * Finally get to update ExCSS to the latest version! This adds much more css properties for epubs. * Ensure rejected reviews are saved as errors * A crap ton of code cleanup * Cleaned up some equality code in GenreHelper.cs * Fixed up the table styling after the bootstrap update changed it. * Bump versions by dotnet-bump-version. * Canary Build 12 (#2111) * Aligned GA (#2059) * Fixed the code around merging images to resize them. This will only look correct if this release's cover generation runs. * Misc code cleanup * Fixed an issue with epub column layout cutting off text * Collection detail page will now default sort by sort name. * Explicitly lazy load library icon images. * Make sure the full error message can be passed to the license component/user. * Use WhereIf in some places * Changed the hash util code for unraid again * Fixed up an issue with split render mode where last page wouldn't move into the next chapter. * Bump versions by dotnet-bump-version. * Don't ask me how, but i think I fixed the epub cutoff issue (#2112) * Bump versions by dotnet-bump-version. * Canary 14 (#2113) * Switched how we build the unraid fingerprint. * Fixed a bit of space below the image on fit to height * Removed some bad code * Bump versions by dotnet-bump-version. * Canary Build 15 (#2114) * When performing a scan series, force a recount of words/pages to ensure read time gets updated. * Fixed broken download logs button (develop) * Sped up the query for getting libraries and added caching for that api, which is helpful for users with larger library counts. * Fixed an issue in directory picker where if you had two folders with the same name, the 2nd to last wouldn't be clickable. * Added more destroy ref stuff. * Switched the buy/manage links over to be environment specific. * Bump versions by dotnet-bump-version. * Canary Build 16 (#2115) * Added the promo code for K+ and version bump. * Don't show see more if there isn't more to see on series detail. * Bump versions by dotnet-bump-version. * Last Build (#2116) * Merge * Close the view after removing a license key from server. * Bump versions by dotnet-bump-version. * Reset version to v0.7.4 for merge. * Bump versions by dotnet-bump-version. * Cleanup from the Release (#2127) * Added an FAQ link on the Kavita+ tab. * Don't query Kavita+ for ratings on comic libraries as there is no upstream provider yet. * Jumpbar keys are a little hard to click * Fixed an issue where libraries that don't allow scrobbling could be scrobbled when generating past history with read events. * Made the min/max release year on metadata filter number and removed the spin arrows for styling. * Fixed disable tabs color contrast due to bootstrap undocumented change. * Refactored whole codebase to unify caching mechanism. Upped the default cache memory amount to 75 to account for the extra data load. Still LRU. Fixed an issue where Cache key was using Port instead. Refactored all the Configuration code to use strongly typed deserialization. * Fixed an issue where get latest progress would throw an exception if there was no progress due to LINQ and MAX query. * Fixed a bug where Send to Device wasn't present on Series cards. * Hooked up the ability to change the cache size for Kavita via the UI. * Bump versions by dotnet-bump-version. * Overall Ratings (#2129) * Corrected tooltip for Cache * Ensure we sync the DB to what's in appsettings.json for Cache key. * Change the fingerprinting method for Windows installs exclusively to avoid churn due to how security updates are handled. * Hooked up the ability to see where reviews are from via an icon on the review card, rather than having to click or know that MAL has "external Review" as title. * Updated FAQ for Kavita+ to link directly to the FAQ * Added the ability for all ratings on a series to be shown to the user. Added favorite count on AL and MAL * Cleaned up so the check for Kavita+ license doesn't seem like it's running when no license is registered. * Tweaked the test instance buy link to test new product. * Bump versions by dotnet-bump-version. * Remove From On Deck (#2131) * Allow admins to customize the amount of progress time or last item added time for on deck calculation * Implemented the ability to remove series from on deck. They will be removed until the user reads a new chapter. Quite a few db lookup reduction calls for reading based stuff, like continue point, bookmarks, etc. * Bump versions by dotnet-bump-version. * Preparation for Release (#2135) * Don't allow Comic libraries to do any scrobbling as there aren't any Comic scrobbling providers yet. * Fixed a bug where if you have multiple libraries pointing the same folder (for whatever reason), the Scan Folder api could be rejected. * Handle if publication from an epub is empty to avoid a bad parse error * Cleaned up some hardcoded default strings. * Fixed up some defaulting code for the cache size. * Changed how moving something back to on deck works after it's been removed. Now any progress will trigger it, as epubs don't have chapters. * Ignore .caltrash, which is a Calibre managed folder, when scanning. * Added the ability to see Volume Last Read Date (or individual chapter) in details drawer. Hover over the clock for the full timestamp. * Bump versions by dotnet-bump-version. * Forgot 2 files in last PR (#2136) * Don't allow Comic libraries to do any scrobbling as there aren't any Comic scrobbling providers yet. * Fixed a bug where if you have multiple libraries pointing the same folder (for whatever reason), the Scan Folder api could be rejected. * Handle if publication from an epub is empty to avoid a bad parse error * Cleaned up some hardcoded default strings. * Fixed up some defaulting code for the cache size. * Changed how moving something back to on deck works after it's been removed. Now any progress will trigger it, as epubs don't have chapters. * Ignore .caltrash, which is a Calibre managed folder, when scanning. * Added the ability to see Volume Last Read Date (or individual chapter) in details drawer. Hover over the clock for the full timestamp. * Somehow some files got left off the commit * Bump versions by dotnet-bump-version. * Changed the fingerprinting code for Kavita+. Optimized System tab to be way faster. (#2140) * Bump versions by dotnet-bump-version. * Version bump (#2141) --------- Co-authored-by: Robbie Davis <robbie@therobbiedavis.com> Co-authored-by: Chris Plaatjes <kizaing@gmail.com> Co-authored-by: pssandhu <pssandhu@users.noreply.github.com> Co-authored-by: Jolyon Suthers <jolyon.suthers@gmail.com> Co-authored-by: Andre Smith <Hobogrammer@users.noreply.github.com>
This commit is contained in:
parent
f8955ec25a
commit
1035e911bb
87 changed files with 3355 additions and 463 deletions
|
@ -225,6 +225,7 @@ public class ParserTests
|
|||
[InlineData("@Recently-Snapshot/Love Hina/", true)]
|
||||
[InlineData("@recycle/Love Hina/", true)]
|
||||
[InlineData("E:/Test/__MACOSX/Love Hina/", true)]
|
||||
[InlineData("E:/Test/.caltrash/Love Hina/", true)]
|
||||
public void HasBlacklistedFolderInPathTest(string inputPath, bool expected)
|
||||
{
|
||||
Assert.Equal(expected, HasBlacklistedFolderInPath(inputPath));
|
||||
|
|
|
@ -11,4 +11,11 @@ public static class EasyCacheProfiles
|
|||
/// If a user's license is valid
|
||||
/// </summary>
|
||||
public const string License = "license";
|
||||
/// <summary>
|
||||
/// Cache the libraries on the server
|
||||
/// </summary>
|
||||
public const string Library = "library";
|
||||
public const string KavitaPlusReviews = "kavita+reviews";
|
||||
public const string KavitaPlusRecommendations = "kavita+recommendations";
|
||||
public const string KavitaPlusRatings = "kavita+ratings";
|
||||
}
|
||||
|
|
|
@ -16,5 +16,5 @@ public static class ResponseCacheProfiles
|
|||
public const string Instant = "Instant";
|
||||
public const string Month = "Month";
|
||||
public const string LicenseCache = "LicenseCache";
|
||||
public const string Recommendation = "Recommendation";
|
||||
public const string KavitaPlus = "KavitaPlus";
|
||||
}
|
||||
|
|
|
@ -88,7 +88,8 @@ public class DeviceController : BaseApiController
|
|||
return BadRequest("Send to device cannot be used with Kavita's email service. Please configure your own.");
|
||||
|
||||
var userId = await _unitOfWork.UserRepository.GetUserIdByUsernameAsync(User.GetUsername());
|
||||
await _eventHub.SendMessageToAsync(MessageFactory.NotificationProgress, MessageFactory.SendingToDeviceEvent($"Transferring files to your device", "started"), userId);
|
||||
await _eventHub.SendMessageToAsync(MessageFactory.NotificationProgress,
|
||||
MessageFactory.SendingToDeviceEvent($"Transferring files to your device", "started"), userId);
|
||||
try
|
||||
{
|
||||
var success = await _deviceService.SendTo(dto.ChapterIds, dto.DeviceId);
|
||||
|
@ -100,7 +101,8 @@ public class DeviceController : BaseApiController
|
|||
}
|
||||
finally
|
||||
{
|
||||
await _eventHub.SendMessageToAsync(MessageFactory.SendingToDevice, MessageFactory.SendingToDeviceEvent($"Transferring files to your device", "ended"), userId);
|
||||
await _eventHub.SendMessageToAsync(MessageFactory.SendingToDevice,
|
||||
MessageFactory.SendingToDeviceEvent($"Transferring files to your device", "ended"), userId);
|
||||
}
|
||||
|
||||
return BadRequest("There was an error sending the file to the device");
|
||||
|
@ -108,6 +110,42 @@ public class DeviceController : BaseApiController
|
|||
|
||||
|
||||
|
||||
[HttpPost("send-series-to")]
|
||||
public async Task<ActionResult> SendSeriesToDevice(SendSeriesToDeviceDto dto)
|
||||
{
|
||||
if (dto.SeriesId <= 0) return BadRequest("SeriesId must be greater than 0");
|
||||
if (dto.DeviceId < 0) return BadRequest("DeviceId must be greater than 0");
|
||||
|
||||
if (await _emailService.IsDefaultEmailService())
|
||||
return BadRequest("Send to device cannot be used with Kavita's email service. Please configure your own.");
|
||||
|
||||
var userId = await _unitOfWork.UserRepository.GetUserIdByUsernameAsync(User.GetUsername());
|
||||
await _eventHub.SendMessageToAsync(MessageFactory.NotificationProgress, MessageFactory.SendingToDeviceEvent($"Transferring files to your device", "started"), userId);
|
||||
|
||||
var series =
|
||||
await _unitOfWork.SeriesRepository.GetSeriesByIdAsync(dto.SeriesId,
|
||||
SeriesIncludes.Volumes | SeriesIncludes.Chapters);
|
||||
if (series == null) return BadRequest("Series doesn't Exist");
|
||||
var chapterIds = series.Volumes.SelectMany(v => v.Chapters.Select(c => c.Id)).ToList();
|
||||
try
|
||||
{
|
||||
var success = await _deviceService.SendTo(chapterIds, dto.DeviceId);
|
||||
if (success) return Ok();
|
||||
}
|
||||
catch (KavitaException ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
await _eventHub.SendMessageToAsync(MessageFactory.SendingToDevice, MessageFactory.SendingToDeviceEvent($"Transferring files to your device", "ended"), userId);
|
||||
}
|
||||
|
||||
return BadRequest("There was an error sending the file(s) to the device");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using API.Constants;
|
||||
using API.Data;
|
||||
using API.Data.Repositories;
|
||||
using API.DTOs;
|
||||
|
@ -18,11 +18,10 @@ using API.Services;
|
|||
using API.Services.Tasks.Scanner;
|
||||
using API.SignalR;
|
||||
using AutoMapper;
|
||||
using EasyCaching.Core;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using TaskScheduler = API.Services.TaskScheduler;
|
||||
|
||||
namespace API.Controllers;
|
||||
|
@ -37,12 +36,13 @@ public class LibraryController : BaseApiController
|
|||
private readonly IUnitOfWork _unitOfWork;
|
||||
private readonly IEventHub _eventHub;
|
||||
private readonly ILibraryWatcher _libraryWatcher;
|
||||
private readonly IMemoryCache _memoryCache;
|
||||
private readonly IEasyCachingProvider _libraryCacheProvider;
|
||||
private const string CacheKey = "library_";
|
||||
|
||||
public LibraryController(IDirectoryService directoryService,
|
||||
ILogger<LibraryController> logger, IMapper mapper, ITaskScheduler taskScheduler,
|
||||
IUnitOfWork unitOfWork, IEventHub eventHub, ILibraryWatcher libraryWatcher, IMemoryCache memoryCache)
|
||||
IUnitOfWork unitOfWork, IEventHub eventHub, ILibraryWatcher libraryWatcher,
|
||||
IEasyCachingProviderFactory cachingProviderFactory)
|
||||
{
|
||||
_directoryService = directoryService;
|
||||
_logger = logger;
|
||||
|
@ -51,7 +51,8 @@ public class LibraryController : BaseApiController
|
|||
_unitOfWork = unitOfWork;
|
||||
_eventHub = eventHub;
|
||||
_libraryWatcher = libraryWatcher;
|
||||
_memoryCache = memoryCache;
|
||||
|
||||
_libraryCacheProvider = cachingProviderFactory.GetCachingProvider(EasyCacheProfiles.Library);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -102,7 +103,7 @@ public class LibraryController : BaseApiController
|
|||
_taskScheduler.ScanLibrary(library.Id);
|
||||
await _eventHub.SendMessageAsync(MessageFactory.LibraryModified,
|
||||
MessageFactory.LibraryModifiedEvent(library.Id, "create"), false);
|
||||
_memoryCache.RemoveByPrefix(CacheKey);
|
||||
await _libraryCacheProvider.RemoveByPrefixAsync(CacheKey);
|
||||
return Ok();
|
||||
}
|
||||
|
||||
|
@ -134,23 +135,19 @@ public class LibraryController : BaseApiController
|
|||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public ActionResult<IEnumerable<LibraryDto>> GetLibraries()
|
||||
public async Task<ActionResult<IEnumerable<LibraryDto>>> GetLibraries()
|
||||
{
|
||||
var username = User.GetUsername();
|
||||
if (string.IsNullOrEmpty(username)) return Unauthorized();
|
||||
|
||||
var cacheKey = CacheKey + username;
|
||||
if (_memoryCache.TryGetValue(cacheKey, out string cachedValue))
|
||||
{
|
||||
return Ok(JsonConvert.DeserializeObject<IEnumerable<LibraryDto>>(cachedValue));
|
||||
}
|
||||
var result = await _libraryCacheProvider.GetAsync<IEnumerable<LibraryDto>>(cacheKey);
|
||||
if (result.HasValue) return Ok(result.Value);
|
||||
|
||||
var ret = _unitOfWork.LibraryRepository.GetLibraryDtosForUsernameAsync(username);
|
||||
var cacheEntryOptions = new MemoryCacheEntryOptions()
|
||||
.SetSize(1)
|
||||
.SetAbsoluteExpiration(TimeSpan.FromHours(24));
|
||||
_memoryCache.Set(cacheKey, JsonConvert.SerializeObject(ret), cacheEntryOptions);
|
||||
await _libraryCacheProvider.SetAsync(CacheKey, ret, TimeSpan.FromHours(24));
|
||||
_logger.LogDebug("Caching libraries for {Key}", cacheKey);
|
||||
|
||||
return Ok(ret);
|
||||
}
|
||||
|
||||
|
@ -211,7 +208,7 @@ public class LibraryController : BaseApiController
|
|||
{
|
||||
_logger.LogInformation("Added: {SelectedLibraries} to {Username}",libraryString, updateLibraryForUserDto.Username);
|
||||
// Bust cache
|
||||
_memoryCache.RemoveByPrefix(CacheKey);
|
||||
await _libraryCacheProvider.RemoveByPrefixAsync(CacheKey);
|
||||
return Ok(_mapper.Map<MemberDto>(user));
|
||||
}
|
||||
|
||||
|
@ -334,7 +331,7 @@ public class LibraryController : BaseApiController
|
|||
|
||||
await _unitOfWork.CommitAsync();
|
||||
|
||||
_memoryCache.RemoveByPrefix(CacheKey);
|
||||
await _libraryCacheProvider.RemoveByPrefixAsync(CacheKey);
|
||||
|
||||
if (chapterIds.Any())
|
||||
{
|
||||
|
@ -433,7 +430,7 @@ public class LibraryController : BaseApiController
|
|||
await _eventHub.SendMessageAsync(MessageFactory.LibraryModified,
|
||||
MessageFactory.LibraryModifiedEvent(library.Id, "update"), false);
|
||||
|
||||
_memoryCache.RemoveByPrefix(CacheKey);
|
||||
await _libraryCacheProvider.RemoveByPrefixAsync(CacheKey);
|
||||
|
||||
return Ok();
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ public class LicenseController : BaseApiController
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates server license. Returns true if updated and valid
|
||||
/// Updates server license
|
||||
/// </summary>
|
||||
/// <remarks>Caches the result</remarks>
|
||||
/// <returns></returns>
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using API.Constants;
|
||||
using API.Data;
|
||||
using API.DTOs;
|
||||
using API.DTOs.SeriesDetail;
|
||||
using API.Services.Plus;
|
||||
using EasyCaching.Core;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace API.Controllers;
|
||||
|
||||
|
@ -20,16 +19,20 @@ public class RatingController : BaseApiController
|
|||
{
|
||||
private readonly ILicenseService _licenseService;
|
||||
private readonly IRatingService _ratingService;
|
||||
private readonly IMemoryCache _cache;
|
||||
private readonly ILogger<RatingController> _logger;
|
||||
public const string CacheKey = "rating-";
|
||||
private readonly IUnitOfWork _unitOfWork;
|
||||
private readonly IEasyCachingProvider _cacheProvider;
|
||||
public const string CacheKey = "rating_";
|
||||
|
||||
public RatingController(ILicenseService licenseService, IRatingService ratingService, IMemoryCache memoryCache, ILogger<RatingController> logger)
|
||||
public RatingController(ILicenseService licenseService, IRatingService ratingService,
|
||||
ILogger<RatingController> logger, IEasyCachingProviderFactory cachingProviderFactory, IUnitOfWork unitOfWork)
|
||||
{
|
||||
_licenseService = licenseService;
|
||||
_ratingService = ratingService;
|
||||
_cache = memoryCache;
|
||||
_logger = logger;
|
||||
_unitOfWork = unitOfWork;
|
||||
|
||||
_cacheProvider = cachingProviderFactory.GetCachingProvider(EasyCacheProfiles.KavitaPlusRatings);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -38,36 +41,36 @@ public class RatingController : BaseApiController
|
|||
/// <param name="seriesId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[ResponseCache(CacheProfileName = ResponseCacheProfiles.Recommendation, VaryByQueryKeys = new []{"seriesId"})]
|
||||
[ResponseCache(CacheProfileName = ResponseCacheProfiles.KavitaPlus, VaryByQueryKeys = new []{"seriesId"})]
|
||||
public async Task<ActionResult<IEnumerable<RatingDto>>> GetRating(int seriesId)
|
||||
{
|
||||
|
||||
if (!await _licenseService.HasActiveLicense())
|
||||
{
|
||||
return Ok(new List<RatingDto>());
|
||||
return Ok(Enumerable.Empty<RatingDto>());
|
||||
}
|
||||
|
||||
var cacheKey = CacheKey + seriesId;
|
||||
var setCache = false;
|
||||
IEnumerable<RatingDto> ratings;
|
||||
if (_cache.TryGetValue(cacheKey, out string cachedData))
|
||||
var results = await _cacheProvider.GetAsync<IEnumerable<RatingDto>>(cacheKey);
|
||||
if (results.HasValue)
|
||||
{
|
||||
ratings = JsonConvert.DeserializeObject<IEnumerable<RatingDto>>(cachedData);
|
||||
}
|
||||
else
|
||||
{
|
||||
ratings = await _ratingService.GetRatings(seriesId);
|
||||
setCache = true;
|
||||
return Ok(results.Value);
|
||||
}
|
||||
|
||||
if (setCache)
|
||||
{
|
||||
var cacheEntryOptions = new MemoryCacheEntryOptions()
|
||||
.SetSize(1)
|
||||
.SetAbsoluteExpiration(TimeSpan.FromHours(24));
|
||||
_cache.Set(cacheKey, JsonConvert.SerializeObject(ratings), cacheEntryOptions);
|
||||
var ratings = await _ratingService.GetRatings(seriesId);
|
||||
await _cacheProvider.SetAsync(cacheKey, ratings, TimeSpan.FromHours(24));
|
||||
_logger.LogDebug("Caching external rating for {Key}", cacheKey);
|
||||
}
|
||||
|
||||
return Ok(ratings);
|
||||
}
|
||||
|
||||
[HttpGet("overall")]
|
||||
public async Task<ActionResult<RatingDto>> GetOverallRating(int seriesId)
|
||||
{
|
||||
return Ok(new RatingDto()
|
||||
{
|
||||
Provider = ScrobbleProvider.Kavita,
|
||||
AverageScore = await _unitOfWork.SeriesRepository.GetAverageUserRating(seriesId),
|
||||
FavoriteCount = 0
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -314,6 +314,7 @@ public class ReaderController : BaseApiController
|
|||
if (!await _unitOfWork.CommitAsync()) return BadRequest("There was an issue saving progress");
|
||||
|
||||
BackgroundJob.Enqueue(() => _scrobblingService.ScrobbleReadingUpdate(user.Id, markReadDto.SeriesId));
|
||||
BackgroundJob.Enqueue(() => _unitOfWork.SeriesRepository.ClearOnDeckRemoval(markReadDto.SeriesId, user.Id));
|
||||
return Ok();
|
||||
}
|
||||
|
||||
|
@ -376,13 +377,11 @@ public class ReaderController : BaseApiController
|
|||
MessageFactory.UserProgressUpdateEvent(user.Id, user.UserName!, markVolumeReadDto.SeriesId,
|
||||
markVolumeReadDto.VolumeId, 0, chapters.Sum(c => c.Pages)));
|
||||
|
||||
if (await _unitOfWork.CommitAsync())
|
||||
{
|
||||
BackgroundJob.Enqueue(() => _scrobblingService.ScrobbleReadingUpdate(user.Id, markVolumeReadDto.SeriesId));
|
||||
return Ok();
|
||||
}
|
||||
if (!await _unitOfWork.CommitAsync()) return BadRequest("Could not save progress");
|
||||
|
||||
return BadRequest("Could not save progress");
|
||||
BackgroundJob.Enqueue(() => _scrobblingService.ScrobbleReadingUpdate(user.Id, markVolumeReadDto.SeriesId));
|
||||
BackgroundJob.Enqueue(() => _unitOfWork.SeriesRepository.ClearOnDeckRemoval(markVolumeReadDto.SeriesId, user.Id));
|
||||
return Ok();
|
||||
}
|
||||
|
||||
|
||||
|
@ -406,14 +405,12 @@ public class ReaderController : BaseApiController
|
|||
var chapters = await _unitOfWork.ChapterRepository.GetChaptersByIdsAsync(chapterIds);
|
||||
await _readerService.MarkChaptersAsRead(user, dto.SeriesId, chapters.ToList());
|
||||
|
||||
if (await _unitOfWork.CommitAsync())
|
||||
{
|
||||
if (!await _unitOfWork.CommitAsync()) return BadRequest("Could not save progress");
|
||||
BackgroundJob.Enqueue(() => _scrobblingService.ScrobbleReadingUpdate(user.Id, dto.SeriesId));
|
||||
BackgroundJob.Enqueue(() => _unitOfWork.SeriesRepository.ClearOnDeckRemoval(dto.SeriesId, user.Id));
|
||||
return Ok();
|
||||
}
|
||||
|
||||
|
||||
return BadRequest("Could not save progress");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -463,18 +460,16 @@ public class ReaderController : BaseApiController
|
|||
await _readerService.MarkChaptersAsRead(user, volume.SeriesId, volume.Chapters);
|
||||
}
|
||||
|
||||
if (await _unitOfWork.CommitAsync())
|
||||
{
|
||||
if (!await _unitOfWork.CommitAsync()) return BadRequest("Could not save progress");
|
||||
|
||||
foreach (var sId in dto.SeriesIds)
|
||||
{
|
||||
BackgroundJob.Enqueue(() => _scrobblingService.ScrobbleReadingUpdate(user.Id, sId));
|
||||
BackgroundJob.Enqueue(() => _unitOfWork.SeriesRepository.ClearOnDeckRemoval(sId, user.Id));
|
||||
}
|
||||
return Ok();
|
||||
}
|
||||
|
||||
return BadRequest("Could not save progress");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Marks all chapters within a list of series as Unread.
|
||||
/// </summary>
|
||||
|
@ -530,11 +525,14 @@ public class ReaderController : BaseApiController
|
|||
/// <param name="progressDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("progress")]
|
||||
public async Task<ActionResult> BookmarkProgress(ProgressDto progressDto)
|
||||
public async Task<ActionResult> SaveProgress(ProgressDto progressDto)
|
||||
{
|
||||
if (await _readerService.SaveReadingProgress(progressDto, User.GetUserId())) return Ok(true);
|
||||
|
||||
var userId = User.GetUserId();
|
||||
if (!await _readerService.SaveReadingProgress(progressDto, userId))
|
||||
return BadRequest("Could not save progress");
|
||||
|
||||
|
||||
return Ok(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -545,9 +543,7 @@ public class ReaderController : BaseApiController
|
|||
[HttpGet("continue-point")]
|
||||
public async Task<ActionResult<ChapterDto>> GetContinuePoint(int seriesId)
|
||||
{
|
||||
var userId = await _unitOfWork.UserRepository.GetUserIdByUsernameAsync(User.GetUsername());
|
||||
|
||||
return Ok(await _readerService.GetContinuePoint(seriesId, userId));
|
||||
return Ok(await _readerService.GetContinuePoint(seriesId, User.GetUserId()));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -558,8 +554,7 @@ public class ReaderController : BaseApiController
|
|||
[HttpGet("has-progress")]
|
||||
public async Task<ActionResult<bool>> HasProgress(int seriesId)
|
||||
{
|
||||
var userId = await _unitOfWork.UserRepository.GetUserIdByUsernameAsync(User.GetUsername());
|
||||
return Ok(await _unitOfWork.AppUserProgressRepository.HasAnyProgressOnSeriesAsync(seriesId, userId));
|
||||
return Ok(await _unitOfWork.AppUserProgressRepository.HasAnyProgressOnSeriesAsync(seriesId, User.GetUserId()));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -570,10 +565,7 @@ public class ReaderController : BaseApiController
|
|||
[HttpGet("chapter-bookmarks")]
|
||||
public async Task<ActionResult<IEnumerable<BookmarkDto>>> GetBookmarks(int chapterId)
|
||||
{
|
||||
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername(), AppUserIncludes.Bookmarks);
|
||||
if (user == null) return Unauthorized();
|
||||
if (user.Bookmarks == null) return Ok(Array.Empty<BookmarkDto>());
|
||||
return Ok(await _unitOfWork.UserRepository.GetBookmarkDtosForChapter(user.Id, chapterId));
|
||||
return Ok(await _unitOfWork.UserRepository.GetBookmarkDtosForChapter(User.GetUserId(), chapterId));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -584,11 +576,7 @@ public class ReaderController : BaseApiController
|
|||
[HttpPost("all-bookmarks")]
|
||||
public async Task<ActionResult<IEnumerable<BookmarkDto>>> GetAllBookmarks(FilterDto filterDto)
|
||||
{
|
||||
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername(), AppUserIncludes.Bookmarks);
|
||||
if (user == null) return Unauthorized();
|
||||
if (user.Bookmarks == null) return Ok(Array.Empty<BookmarkDto>());
|
||||
|
||||
return Ok(await _unitOfWork.UserRepository.GetAllBookmarkDtos(user.Id, filterDto));
|
||||
return Ok(await _unitOfWork.UserRepository.GetAllBookmarkDtos(User.GetUserId(), filterDto));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -676,10 +664,7 @@ public class ReaderController : BaseApiController
|
|||
[HttpGet("volume-bookmarks")]
|
||||
public async Task<ActionResult<IEnumerable<BookmarkDto>>> GetBookmarksForVolume(int volumeId)
|
||||
{
|
||||
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername(), AppUserIncludes.Bookmarks);
|
||||
if (user == null) return Unauthorized();
|
||||
if (user.Bookmarks == null) return Ok(Array.Empty<BookmarkDto>());
|
||||
return Ok(await _unitOfWork.UserRepository.GetBookmarkDtosForVolume(user.Id, volumeId));
|
||||
return Ok(await _unitOfWork.UserRepository.GetBookmarkDtosForVolume(User.GetUserId(), volumeId));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -690,11 +675,7 @@ public class ReaderController : BaseApiController
|
|||
[HttpGet("series-bookmarks")]
|
||||
public async Task<ActionResult<IEnumerable<BookmarkDto>>> GetBookmarksForSeries(int seriesId)
|
||||
{
|
||||
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername(), AppUserIncludes.Bookmarks);
|
||||
if (user == null) return Unauthorized();
|
||||
if (user.Bookmarks == null) return Ok(Array.Empty<BookmarkDto>());
|
||||
|
||||
return Ok(await _unitOfWork.UserRepository.GetBookmarkDtosForSeries(user.Id, seriesId));
|
||||
return Ok(await _unitOfWork.UserRepository.GetBookmarkDtosForSeries(User.GetUserId(), seriesId));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -760,8 +741,7 @@ public class ReaderController : BaseApiController
|
|||
[HttpGet("next-chapter")]
|
||||
public async Task<ActionResult<int>> GetNextChapter(int seriesId, int volumeId, int currentChapterId)
|
||||
{
|
||||
var userId = await _unitOfWork.UserRepository.GetUserIdByUsernameAsync(User.GetUsername());
|
||||
return await _readerService.GetNextChapterIdAsync(seriesId, volumeId, currentChapterId, userId);
|
||||
return await _readerService.GetNextChapterIdAsync(seriesId, volumeId, currentChapterId, User.GetUserId());
|
||||
}
|
||||
|
||||
|
||||
|
@ -779,8 +759,7 @@ public class ReaderController : BaseApiController
|
|||
[HttpGet("prev-chapter")]
|
||||
public async Task<ActionResult<int>> GetPreviousChapter(int seriesId, int volumeId, int currentChapterId)
|
||||
{
|
||||
var userId = await _unitOfWork.UserRepository.GetUserIdByUsernameAsync(User.GetUsername());
|
||||
return await _readerService.GetPrevChapterIdAsync(seriesId, volumeId, currentChapterId, userId);
|
||||
return await _readerService.GetPrevChapterIdAsync(seriesId, volumeId, currentChapterId, User.GetUserId());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -793,7 +772,7 @@ public class ReaderController : BaseApiController
|
|||
[ResponseCache(CacheProfileName = "Hour", VaryByQueryKeys = new [] { "seriesId"})]
|
||||
public async Task<ActionResult<HourEstimateRangeDto>> GetEstimateToCompletion(int seriesId)
|
||||
{
|
||||
var userId = await _unitOfWork.UserRepository.GetUserIdByUsernameAsync(User.GetUsername());
|
||||
var userId = User.GetUserId();
|
||||
var series = await _unitOfWork.SeriesRepository.GetSeriesDtoByIdAsync(seriesId, userId);
|
||||
|
||||
// Get all sum of all chapters with progress that is complete then subtract from series. Multiply by modifiers
|
||||
|
|
|
@ -9,6 +9,7 @@ using API.DTOs.Recommendation;
|
|||
using API.Extensions;
|
||||
using API.Helpers;
|
||||
using API.Services.Plus;
|
||||
using EasyCaching.Core;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using Newtonsoft.Json;
|
||||
|
@ -20,16 +21,16 @@ public class RecommendedController : BaseApiController
|
|||
private readonly IUnitOfWork _unitOfWork;
|
||||
private readonly IRecommendationService _recommendationService;
|
||||
private readonly ILicenseService _licenseService;
|
||||
private readonly IMemoryCache _cache;
|
||||
public const string CacheKey = "recommendation-";
|
||||
private readonly IEasyCachingProvider _cacheProvider;
|
||||
public const string CacheKey = "recommendation_";
|
||||
|
||||
public RecommendedController(IUnitOfWork unitOfWork, IRecommendationService recommendationService,
|
||||
ILicenseService licenseService, IMemoryCache cache)
|
||||
ILicenseService licenseService, IEasyCachingProviderFactory cachingProviderFactory)
|
||||
{
|
||||
_unitOfWork = unitOfWork;
|
||||
_recommendationService = recommendationService;
|
||||
_licenseService = licenseService;
|
||||
_cache = cache;
|
||||
_cacheProvider = cachingProviderFactory.GetCachingProvider(EasyCacheProfiles.KavitaPlusRecommendations);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -38,7 +39,7 @@ public class RecommendedController : BaseApiController
|
|||
/// <param name="seriesId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("recommendations")]
|
||||
[ResponseCache(CacheProfileName = ResponseCacheProfiles.Recommendation, VaryByQueryKeys = new []{"seriesId"})]
|
||||
[ResponseCache(CacheProfileName = ResponseCacheProfiles.KavitaPlus, VaryByQueryKeys = new []{"seriesId"})]
|
||||
public async Task<ActionResult<RecommendationDto>> GetRecommendations(int seriesId)
|
||||
{
|
||||
var userId = User.GetUserId();
|
||||
|
@ -53,16 +54,14 @@ public class RecommendedController : BaseApiController
|
|||
}
|
||||
|
||||
var cacheKey = $"{CacheKey}-{seriesId}-{userId}";
|
||||
if (_cache.TryGetValue(cacheKey, out string cachedData))
|
||||
var results = await _cacheProvider.GetAsync<RecommendationDto>(cacheKey);
|
||||
if (results.HasValue)
|
||||
{
|
||||
return Ok(JsonConvert.DeserializeObject<RecommendationDto>(cachedData));
|
||||
return Ok(results.Value);
|
||||
}
|
||||
|
||||
var ret = await _recommendationService.GetRecommendationsForSeries(userId, seriesId);
|
||||
var cacheEntryOptions = new MemoryCacheEntryOptions()
|
||||
.SetSize(ret.OwnedSeries.Count() + ret.ExternalSeries.Count())
|
||||
.SetAbsoluteExpiration(TimeSpan.FromHours(10));
|
||||
_cache.Set(cacheKey, JsonConvert.SerializeObject(ret), cacheEntryOptions);
|
||||
await _cacheProvider.SetAsync(cacheKey, ret, TimeSpan.FromHours(10));
|
||||
return Ok(ret);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ using API.Helpers.Builders;
|
|||
using API.Services;
|
||||
using API.Services.Plus;
|
||||
using AutoMapper;
|
||||
using EasyCaching.Core;
|
||||
using Hangfire;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
|
@ -26,20 +27,22 @@ public class ReviewController : BaseApiController
|
|||
private readonly ILicenseService _licenseService;
|
||||
private readonly IMapper _mapper;
|
||||
private readonly IReviewService _reviewService;
|
||||
private readonly IMemoryCache _cache;
|
||||
private readonly IScrobblingService _scrobblingService;
|
||||
public const string CacheKey = "review-";
|
||||
private readonly IEasyCachingProvider _cacheProvider;
|
||||
public const string CacheKey = "review_";
|
||||
|
||||
public ReviewController(ILogger<ReviewController> logger, IUnitOfWork unitOfWork, ILicenseService licenseService,
|
||||
IMapper mapper, IReviewService reviewService, IMemoryCache cache, IScrobblingService scrobblingService)
|
||||
IMapper mapper, IReviewService reviewService, IScrobblingService scrobblingService,
|
||||
IEasyCachingProviderFactory cachingProviderFactory)
|
||||
{
|
||||
_logger = logger;
|
||||
_unitOfWork = unitOfWork;
|
||||
_licenseService = licenseService;
|
||||
_mapper = mapper;
|
||||
_reviewService = reviewService;
|
||||
_cache = cache;
|
||||
_scrobblingService = scrobblingService;
|
||||
|
||||
_cacheProvider = cachingProviderFactory.GetCachingProvider(EasyCacheProfiles.KavitaPlusReviews);
|
||||
}
|
||||
|
||||
|
||||
|
@ -48,7 +51,7 @@ public class ReviewController : BaseApiController
|
|||
/// </summary>
|
||||
/// <param name="seriesId"></param>
|
||||
[HttpGet]
|
||||
[ResponseCache(CacheProfileName = ResponseCacheProfiles.Recommendation, VaryByQueryKeys = new []{"seriesId"})]
|
||||
[ResponseCache(CacheProfileName = ResponseCacheProfiles.KavitaPlus, VaryByQueryKeys = new []{"seriesId"})]
|
||||
public async Task<ActionResult<IEnumerable<UserReviewDto>>> GetReviews(int seriesId)
|
||||
{
|
||||
var userId = User.GetUserId();
|
||||
|
@ -63,15 +66,26 @@ public class ReviewController : BaseApiController
|
|||
var cacheKey = CacheKey + seriesId;
|
||||
IEnumerable<UserReviewDto> externalReviews;
|
||||
var setCache = false;
|
||||
if (_cache.TryGetValue(cacheKey, out string cachedData))
|
||||
|
||||
var result = await _cacheProvider.GetAsync<IEnumerable<UserReviewDto>>(cacheKey);
|
||||
if (result.HasValue)
|
||||
{
|
||||
externalReviews = JsonConvert.DeserializeObject<IEnumerable<UserReviewDto>>(cachedData);
|
||||
externalReviews = result.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
externalReviews = await _reviewService.GetReviewsForSeries(userId, seriesId);
|
||||
setCache = true;
|
||||
}
|
||||
// if (_cache.TryGetValue(cacheKey, out string cachedData))
|
||||
// {
|
||||
// externalReviews = JsonConvert.DeserializeObject<IEnumerable<UserReviewDto>>(cachedData);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// externalReviews = await _reviewService.GetReviewsForSeries(userId, seriesId);
|
||||
// setCache = true;
|
||||
// }
|
||||
|
||||
// Fetch external reviews and splice them in
|
||||
foreach (var r in externalReviews)
|
||||
|
@ -81,10 +95,11 @@ public class ReviewController : BaseApiController
|
|||
|
||||
if (setCache)
|
||||
{
|
||||
var cacheEntryOptions = new MemoryCacheEntryOptions()
|
||||
.SetSize(userRatings.Count)
|
||||
.SetAbsoluteExpiration(TimeSpan.FromHours(10));
|
||||
_cache.Set(cacheKey, JsonConvert.SerializeObject(externalReviews), cacheEntryOptions);
|
||||
// var cacheEntryOptions = new MemoryCacheEntryOptions()
|
||||
// .SetSize(userRatings.Count)
|
||||
// .SetAbsoluteExpiration(TimeSpan.FromHours(10));
|
||||
//_cache.Set(cacheKey, JsonConvert.SerializeObject(externalReviews), cacheEntryOptions);
|
||||
await _cacheProvider.SetAsync(cacheKey, externalReviews, TimeSpan.FromHours(10));
|
||||
_logger.LogDebug("Caching external reviews for {Key}", cacheKey);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using API.Constants;
|
||||
|
@ -15,12 +14,11 @@ using API.Extensions;
|
|||
using API.Helpers;
|
||||
using API.Services;
|
||||
using API.Services.Plus;
|
||||
using Kavita.Common;
|
||||
using EasyCaching.Core;
|
||||
using Kavita.Common.Extensions;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http.HttpResults;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace API.Controllers;
|
||||
|
@ -31,19 +29,25 @@ public class SeriesController : BaseApiController
|
|||
private readonly ITaskScheduler _taskScheduler;
|
||||
private readonly IUnitOfWork _unitOfWork;
|
||||
private readonly ISeriesService _seriesService;
|
||||
private readonly IMemoryCache _cache;
|
||||
private readonly ILicenseService _licenseService;
|
||||
private readonly IEasyCachingProvider _ratingCacheProvider;
|
||||
private readonly IEasyCachingProvider _reviewCacheProvider;
|
||||
private readonly IEasyCachingProvider _recommendationCacheProvider;
|
||||
|
||||
|
||||
public SeriesController(ILogger<SeriesController> logger, ITaskScheduler taskScheduler, IUnitOfWork unitOfWork,
|
||||
ISeriesService seriesService, IMemoryCache cache, ILicenseService licenseService)
|
||||
ISeriesService seriesService, ILicenseService licenseService,
|
||||
IEasyCachingProviderFactory cachingProviderFactory)
|
||||
{
|
||||
_logger = logger;
|
||||
_taskScheduler = taskScheduler;
|
||||
_unitOfWork = unitOfWork;
|
||||
_seriesService = seriesService;
|
||||
_cache = cache;
|
||||
_licenseService = licenseService;
|
||||
|
||||
_ratingCacheProvider = cachingProviderFactory.GetCachingProvider(EasyCacheProfiles.KavitaPlusRatings);
|
||||
_reviewCacheProvider = cachingProviderFactory.GetCachingProvider(EasyCacheProfiles.KavitaPlusReviews);
|
||||
_recommendationCacheProvider = cachingProviderFactory.GetCachingProvider(EasyCacheProfiles.KavitaPlusRecommendations);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
|
@ -280,6 +284,18 @@ public class SeriesController : BaseApiController
|
|||
return Ok(pagedList);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a series from displaying on deck until the next read event on that series
|
||||
/// </summary>
|
||||
/// <param name="seriesId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("remove-from-on-deck")]
|
||||
public async Task<ActionResult> RemoveFromOnDeck([FromQuery] int seriesId)
|
||||
{
|
||||
await _unitOfWork.SeriesRepository.RemoveFromOnDeck(seriesId, User.GetUserId());
|
||||
return Ok();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Runs a Cover Image Generation task
|
||||
/// </summary>
|
||||
|
@ -344,12 +360,13 @@ public class SeriesController : BaseApiController
|
|||
if (await _licenseService.HasActiveLicense())
|
||||
{
|
||||
_logger.LogDebug("Clearing cache as series weblinks may have changed");
|
||||
_cache.Remove(ReviewController.CacheKey + updateSeriesMetadataDto.SeriesMetadata.SeriesId);
|
||||
_cache.Remove(RatingController.CacheKey + updateSeriesMetadataDto.SeriesMetadata.SeriesId);
|
||||
await _reviewCacheProvider.RemoveAsync(ReviewController.CacheKey + updateSeriesMetadataDto.SeriesMetadata.SeriesId);
|
||||
await _ratingCacheProvider.RemoveAsync(RatingController.CacheKey + updateSeriesMetadataDto.SeriesMetadata.SeriesId);
|
||||
|
||||
var allUsers = (await _unitOfWork.UserRepository.GetAllUsersAsync()).Select(s => s.Id);
|
||||
foreach (var userId in allUsers)
|
||||
{
|
||||
_cache.Remove(RecommendedController.CacheKey + $"{updateSeriesMetadataDto.SeriesMetadata.SeriesId}-{userId}");
|
||||
await _recommendationCacheProvider.RemoveAsync(RecommendedController.CacheKey + $"{updateSeriesMetadataDto.SeriesMetadata.SeriesId}-{userId}");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using API.Constants;
|
||||
using API.Data;
|
||||
using API.DTOs.Jobs;
|
||||
using API.DTOs.MediaErrors;
|
||||
|
@ -13,6 +14,7 @@ using API.Extensions;
|
|||
using API.Helpers;
|
||||
using API.Services;
|
||||
using API.Services.Tasks;
|
||||
using EasyCaching.Core;
|
||||
using Hangfire;
|
||||
using Hangfire.Storage;
|
||||
using Kavita.Common;
|
||||
|
@ -38,12 +40,12 @@ public class ServerController : BaseApiController
|
|||
private readonly IAccountService _accountService;
|
||||
private readonly ITaskScheduler _taskScheduler;
|
||||
private readonly IUnitOfWork _unitOfWork;
|
||||
private readonly IMemoryCache _memoryCache;
|
||||
private readonly IEasyCachingProviderFactory _cachingProviderFactory;
|
||||
|
||||
public ServerController(ILogger<ServerController> logger,
|
||||
IBackupService backupService, IArchiveService archiveService, IVersionUpdaterService versionUpdaterService, IStatsService statsService,
|
||||
ICleanupService cleanupService, IScannerService scannerService, IAccountService accountService,
|
||||
ITaskScheduler taskScheduler, IUnitOfWork unitOfWork, IMemoryCache memoryCache)
|
||||
ITaskScheduler taskScheduler, IUnitOfWork unitOfWork, IEasyCachingProviderFactory cachingProviderFactory)
|
||||
{
|
||||
_logger = logger;
|
||||
_backupService = backupService;
|
||||
|
@ -55,7 +57,7 @@ public class ServerController : BaseApiController
|
|||
_accountService = accountService;
|
||||
_taskScheduler = taskScheduler;
|
||||
_unitOfWork = unitOfWork;
|
||||
_memoryCache = memoryCache;
|
||||
_cachingProviderFactory = cachingProviderFactory;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -122,6 +124,17 @@ public class ServerController : BaseApiController
|
|||
return Ok(await _statsService.GetServerInfo());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns non-sensitive information about the current system
|
||||
/// </summary>
|
||||
/// <remarks>This is just for the UI and is extremly lightweight</remarks>
|
||||
/// <returns></returns>
|
||||
[HttpGet("server-info-slim")]
|
||||
public async Task<ActionResult<ServerInfoDto>> GetSlimVersion()
|
||||
{
|
||||
return Ok(await _statsService.GetServerInfoSlim());
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Triggers the scheduling of the convert media job. This will convert all media to the target encoding (except for PNG). Only one job will run at a time.
|
||||
|
@ -239,14 +252,20 @@ public class ServerController : BaseApiController
|
|||
|
||||
|
||||
/// <summary>
|
||||
/// Bust Review and Recommendation Cache
|
||||
/// Bust Kavita+ Cache
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[Authorize("RequireAdminRole")]
|
||||
[HttpPost("bust-review-and-rec-cache")]
|
||||
public ActionResult BustReviewAndRecCache()
|
||||
public async Task<ActionResult> BustReviewAndRecCache()
|
||||
{
|
||||
_memoryCache.Clear();
|
||||
_logger.LogInformation("Busting Kavita+ Cache");
|
||||
var provider = _cachingProviderFactory.GetCachingProvider(EasyCacheProfiles.KavitaPlusReviews);
|
||||
await provider.FlushAsync();
|
||||
provider = _cachingProviderFactory.GetCachingProvider(EasyCacheProfiles.KavitaPlusRecommendations);
|
||||
await provider.FlushAsync();
|
||||
provider = _cachingProviderFactory.GetCachingProvider(EasyCacheProfiles.KavitaPlusRatings);
|
||||
await provider.FlushAsync();
|
||||
return Ok();
|
||||
}
|
||||
|
||||
|
|
|
@ -182,6 +182,24 @@ public class SettingsController : BaseApiController
|
|||
_unitOfWork.SettingsRepository.Update(setting);
|
||||
}
|
||||
|
||||
if (setting.Key == ServerSettingKey.OnDeckProgressDays && updateSettingsDto.OnDeckProgressDays + string.Empty != setting.Value)
|
||||
{
|
||||
setting.Value = updateSettingsDto.OnDeckProgressDays + string.Empty;
|
||||
_unitOfWork.SettingsRepository.Update(setting);
|
||||
}
|
||||
|
||||
if (setting.Key == ServerSettingKey.OnDeckUpdateDays && updateSettingsDto.OnDeckUpdateDays + string.Empty != setting.Value)
|
||||
{
|
||||
setting.Value = updateSettingsDto.OnDeckUpdateDays + string.Empty;
|
||||
_unitOfWork.SettingsRepository.Update(setting);
|
||||
}
|
||||
|
||||
if (setting.Key == ServerSettingKey.TaskScan && updateSettingsDto.TaskScan != setting.Value)
|
||||
{
|
||||
setting.Value = updateSettingsDto.TaskScan;
|
||||
_unitOfWork.SettingsRepository.Update(setting);
|
||||
}
|
||||
|
||||
if (setting.Key == ServerSettingKey.Port && updateSettingsDto.Port + string.Empty != setting.Value)
|
||||
{
|
||||
if (OsInfo.IsDocker) continue;
|
||||
|
@ -191,6 +209,14 @@ public class SettingsController : BaseApiController
|
|||
_unitOfWork.SettingsRepository.Update(setting);
|
||||
}
|
||||
|
||||
if (setting.Key == ServerSettingKey.CacheSize && updateSettingsDto.CacheSize + string.Empty != setting.Value)
|
||||
{
|
||||
setting.Value = updateSettingsDto.CacheSize + string.Empty;
|
||||
// CacheSize is managed in appSetting.json
|
||||
Configuration.CacheSize = updateSettingsDto.CacheSize;
|
||||
_unitOfWork.SettingsRepository.Update(setting);
|
||||
}
|
||||
|
||||
if (setting.Key == ServerSettingKey.IpAddresses && updateSettingsDto.IpAddresses != setting.Value)
|
||||
{
|
||||
if (OsInfo.IsDocker) continue;
|
||||
|
|
|
@ -45,6 +45,10 @@ public class ChapterDto : IHasReadTimeEstimate, IEntityDate
|
|||
/// </summary>
|
||||
public DateTime LastReadingProgressUtc { get; set; }
|
||||
/// <summary>
|
||||
/// The last time a chapter was read by current authenticated user
|
||||
/// </summary>
|
||||
public DateTime LastReadingProgress { get; set; }
|
||||
/// <summary>
|
||||
/// If the Cover Image is locked for this entity
|
||||
/// </summary>
|
||||
public bool CoverImageLocked { get; set; }
|
||||
|
|
7
API/DTOs/Device/SendSeriesToDeviceDto.cs
Normal file
7
API/DTOs/Device/SendSeriesToDeviceDto.cs
Normal file
|
@ -0,0 +1,7 @@
|
|||
namespace API.DTOs.Device;
|
||||
|
||||
public class SendSeriesToDeviceDto
|
||||
{
|
||||
public int DeviceId { get; set; }
|
||||
public int SeriesId { get; set; }
|
||||
}
|
|
@ -1,4 +1,6 @@
|
|||
namespace API.DTOs.SeriesDetail;
|
||||
using API.Services.Plus;
|
||||
|
||||
namespace API.DTOs.SeriesDetail;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a User Review for a given Series
|
||||
|
@ -48,4 +50,9 @@ public class UserReviewDto
|
|||
/// The main body with just text, for review preview
|
||||
/// </summary>
|
||||
public string? BodyJustText { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If this review is External, which Provider did it come from
|
||||
/// </summary>
|
||||
public ScrobbleProvider Provider { get; set; } = ScrobbleProvider.Kavita;
|
||||
}
|
||||
|
|
|
@ -72,4 +72,16 @@ public class ServerSettingDto
|
|||
/// The Host name (ie Reverse proxy domain name) for the server
|
||||
/// </summary>
|
||||
public string HostName { get; set; }
|
||||
/// <summary>
|
||||
/// The size in MB for Caching API data
|
||||
/// </summary>
|
||||
public long CacheSize { get; set; }
|
||||
/// <summary>
|
||||
/// How many Days since today in the past for reading progress, should content be considered for On Deck, before it gets removed automatically
|
||||
/// </summary>
|
||||
public int OnDeckProgressDays { get; set; }
|
||||
/// <summary>
|
||||
/// How many Days since today in the past for chapter updates, should content be considered for On Deck, before it gets removed automatically
|
||||
/// </summary>
|
||||
public int OnDeckUpdateDays { get; set; }
|
||||
}
|
||||
|
|
21
API/DTOs/Stats/ServerInfoSlimDto.cs
Normal file
21
API/DTOs/Stats/ServerInfoSlimDto.cs
Normal file
|
@ -0,0 +1,21 @@
|
|||
namespace API.DTOs.Stats;
|
||||
|
||||
/// <summary>
|
||||
/// This is just for the Server tab on UI
|
||||
/// </summary>
|
||||
public class ServerInfoSlimDto
|
||||
{
|
||||
/// <summary>
|
||||
/// Unique Id that represents a unique install
|
||||
/// </summary>
|
||||
public required string InstallId { get; set; }
|
||||
/// <summary>
|
||||
/// If the Kavita install is using Docker
|
||||
/// </summary>
|
||||
public bool IsDocker { get; set; }
|
||||
/// <summary>
|
||||
/// Version of Kavita
|
||||
/// </summary>
|
||||
public required string KavitaVersion { get; set; }
|
||||
|
||||
}
|
|
@ -52,6 +52,7 @@ public sealed class DataContext : IdentityDbContext<AppUser, AppRole, int,
|
|||
public DbSet<ScrobbleEvent> ScrobbleEvent { get; set; } = null!;
|
||||
public DbSet<ScrobbleError> ScrobbleError { get; set; } = null!;
|
||||
public DbSet<ScrobbleHold> ScrobbleHold { get; set; } = null!;
|
||||
public DbSet<AppUserOnDeckRemoval> AppUserOnDeckRemoval { get; set; } = null!;
|
||||
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder builder)
|
||||
|
|
2184
API/Data/Migrations/20230715125951_OnDeckRemoval.Designer.cs
generated
Normal file
2184
API/Data/Migrations/20230715125951_OnDeckRemoval.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
93
API/Data/Migrations/20230715125951_OnDeckRemoval.cs
Normal file
93
API/Data/Migrations/20230715125951_OnDeckRemoval.cs
Normal file
|
@ -0,0 +1,93 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace API.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class OnDeckRemoval : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Title",
|
||||
table: "ReadingList",
|
||||
type: "TEXT",
|
||||
nullable: false,
|
||||
defaultValue: "",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "TEXT",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "NormalizedTitle",
|
||||
table: "ReadingList",
|
||||
type: "TEXT",
|
||||
nullable: false,
|
||||
defaultValue: "",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "TEXT",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AppUserOnDeckRemoval",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
SeriesId = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
AppUserId = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AppUserOnDeckRemoval", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_AppUserOnDeckRemoval_AspNetUsers_AppUserId",
|
||||
column: x => x.AppUserId,
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_AppUserOnDeckRemoval_Series_SeriesId",
|
||||
column: x => x.SeriesId,
|
||||
principalTable: "Series",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AppUserOnDeckRemoval_AppUserId",
|
||||
table: "AppUserOnDeckRemoval",
|
||||
column: "AppUserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AppUserOnDeckRemoval_SeriesId",
|
||||
table: "AppUserOnDeckRemoval",
|
||||
column: "SeriesId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "AppUserOnDeckRemoval");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Title",
|
||||
table: "ReadingList",
|
||||
type: "TEXT",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "TEXT");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "NormalizedTitle",
|
||||
table: "ReadingList",
|
||||
type: "TEXT",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "TEXT");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -15,7 +15,7 @@ namespace API.Data.Migrations
|
|||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "7.0.5");
|
||||
modelBuilder.HasAnnotation("ProductVersion", "7.0.8");
|
||||
|
||||
modelBuilder.Entity("API.Entities.AppRole", b =>
|
||||
{
|
||||
|
@ -183,6 +183,27 @@ namespace API.Data.Migrations
|
|||
b.ToTable("AppUserBookmark");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("API.Entities.AppUserOnDeckRemoval", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("AppUserId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("SeriesId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("AppUserId");
|
||||
|
||||
b.HasIndex("SeriesId");
|
||||
|
||||
b.ToTable("AppUserOnDeckRemoval");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("API.Entities.AppUserPreferences", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
|
@ -943,6 +964,7 @@ namespace API.Data.Migrations
|
|||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("NormalizedTitle")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<bool>("Promoted")
|
||||
|
@ -958,6 +980,7 @@ namespace API.Data.Migrations
|
|||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
@ -1082,7 +1105,7 @@ namespace API.Data.Migrations
|
|||
b.Property<int>("LibraryId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int?>("MalId")
|
||||
b.Property<long?>("MalId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime?>("ProcessDateUtc")
|
||||
|
@ -1626,6 +1649,25 @@ namespace API.Data.Migrations
|
|||
b.Navigation("AppUser");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("API.Entities.AppUserOnDeckRemoval", b =>
|
||||
{
|
||||
b.HasOne("API.Entities.AppUser", "AppUser")
|
||||
.WithMany()
|
||||
.HasForeignKey("AppUserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("API.Entities.Series", "Series")
|
||||
.WithMany()
|
||||
.HasForeignKey("SeriesId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("AppUser");
|
||||
|
||||
b.Navigation("Series");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("API.Entities.AppUserPreferences", b =>
|
||||
{
|
||||
b.HasOne("API.Entities.AppUser", "AppUser")
|
||||
|
|
|
@ -136,7 +136,8 @@ public class AppUserProgressRepository : IAppUserProgressRepository
|
|||
{
|
||||
return await _context.AppUserProgresses
|
||||
.Select(d => d.LastModifiedUtc)
|
||||
.MaxAsync();
|
||||
.OrderByDescending(d => d)
|
||||
.FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
public async Task<ProgressDto> GetUserProgressDtoAsync(int chapterId, int userId)
|
||||
|
|
|
@ -253,11 +253,13 @@ public class ChapterRepository : IChapterRepository
|
|||
{
|
||||
chapter.PagesRead = progress.PagesRead ;
|
||||
chapter.LastReadingProgressUtc = progress.LastModifiedUtc;
|
||||
chapter.LastReadingProgress = progress.LastModified;
|
||||
}
|
||||
else
|
||||
{
|
||||
chapter.PagesRead = 0;
|
||||
chapter.LastReadingProgressUtc = DateTime.MinValue;
|
||||
chapter.LastReadingProgress = DateTime.MinValue;
|
||||
}
|
||||
|
||||
return chapter;
|
||||
|
|
|
@ -14,6 +14,7 @@ using API.DTOs.Metadata;
|
|||
using API.DTOs.ReadingLists;
|
||||
using API.DTOs.Search;
|
||||
using API.DTOs.SeriesDetail;
|
||||
using API.DTOs.Settings;
|
||||
using API.Entities;
|
||||
using API.Entities.Enums;
|
||||
using API.Entities.Metadata;
|
||||
|
@ -135,8 +136,10 @@ public interface ISeriesRepository
|
|||
Task<IDictionary<int, int>> GetLibraryIdsForSeriesAsync();
|
||||
Task<IList<SeriesMetadataDto>> GetSeriesMetadataForIds(IEnumerable<int> seriesIds);
|
||||
Task<IList<Series>> GetAllWithCoversInDifferentEncoding(EncodeFormat encodeFormat, bool customOnly = true);
|
||||
|
||||
Task<SeriesDto?> GetSeriesDtoByNamesAndMetadataIdsForUser(int userId, IEnumerable<string> names, LibraryType libraryType, string aniListUrl, string malUrl);
|
||||
Task<int> GetAverageUserRating(int seriesId);
|
||||
Task RemoveFromOnDeck(int seriesId, int userId);
|
||||
Task ClearOnDeckRemoval(int seriesId, int userId);
|
||||
}
|
||||
|
||||
public class SeriesRepository : ISeriesRepository
|
||||
|
@ -757,16 +760,33 @@ public class SeriesRepository : ISeriesRepository
|
|||
/// <returns></returns>
|
||||
public async Task<PagedList<SeriesDto>> GetOnDeck(int userId, int libraryId, UserParams userParams, FilterDto filter)
|
||||
{
|
||||
var cutoffProgressPoint = DateTime.Now - TimeSpan.FromDays(30);
|
||||
var cutoffLastAddedPoint = DateTime.Now - TimeSpan.FromDays(7);
|
||||
var settings = await _context.ServerSetting
|
||||
.Select(x => x)
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
var serverSettings = _mapper.Map<ServerSettingDto>(settings);
|
||||
|
||||
var cutoffProgressPoint = DateTime.Now - TimeSpan.FromDays(serverSettings.OnDeckProgressDays);
|
||||
var cutoffLastAddedPoint = DateTime.Now - TimeSpan.FromDays(serverSettings.OnDeckUpdateDays);
|
||||
|
||||
var libraryIds = GetLibraryIdsForUser(userId, libraryId, QueryContext.Dashboard)
|
||||
.Where(id => libraryId == 0 || id == libraryId);
|
||||
var usersSeriesIds = GetSeriesIdsForLibraryIds(libraryIds);
|
||||
|
||||
// Don't allow any series the user has explicitly removed
|
||||
var onDeckRemovals = _context.AppUserOnDeckRemoval
|
||||
.Where(d => d.AppUserId == userId)
|
||||
.Select(d => d.SeriesId)
|
||||
.AsEnumerable();
|
||||
|
||||
// var onDeckRemovals = _context.AppUser.Where(u => u.Id == userId)
|
||||
// .SelectMany(u => u.OnDeckRemovals.Select(d => d.Id))
|
||||
// .AsEnumerable();
|
||||
|
||||
|
||||
var query = _context.Series
|
||||
.Where(s => usersSeriesIds.Contains(s.Id))
|
||||
.Where(s => !onDeckRemovals.Contains(s.Id))
|
||||
.Select(s => new
|
||||
{
|
||||
Series = s,
|
||||
|
@ -1658,6 +1678,42 @@ public class SeriesRepository : ISeriesRepository
|
|||
.FirstOrDefaultAsync(); // Some users may have improperly configured libraries
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the Average rating for all users within Kavita instance
|
||||
/// </summary>
|
||||
/// <param name="seriesId"></param>
|
||||
public async Task<int> GetAverageUserRating(int seriesId)
|
||||
{
|
||||
var avg = (await _context.AppUserRating
|
||||
.Where(r => r.SeriesId == seriesId)
|
||||
.AverageAsync(r => (int?) r.Rating));
|
||||
return avg.HasValue ? (int) avg.Value : 0;
|
||||
}
|
||||
|
||||
public async Task RemoveFromOnDeck(int seriesId, int userId)
|
||||
{
|
||||
var existingEntry = await _context.AppUserOnDeckRemoval
|
||||
.Where(u => u.Id == userId && u.SeriesId == seriesId)
|
||||
.AnyAsync();
|
||||
if (existingEntry) return;
|
||||
_context.AppUserOnDeckRemoval.Add(new AppUserOnDeckRemoval()
|
||||
{
|
||||
SeriesId = seriesId,
|
||||
AppUserId = userId
|
||||
});
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
public async Task ClearOnDeckRemoval(int seriesId, int userId)
|
||||
{
|
||||
var existingEntry = await _context.AppUserOnDeckRemoval
|
||||
.Where(u => u.Id == userId && u.SeriesId == seriesId)
|
||||
.FirstOrDefaultAsync();
|
||||
if (existingEntry == null) return;
|
||||
_context.AppUserOnDeckRemoval.Remove(existingEntry);
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
public async Task<bool> IsSeriesInWantToRead(int userId, int seriesId)
|
||||
{
|
||||
var libraryIds = await _context.Library.GetUserLibraries(userId).ToListAsync();
|
||||
|
|
|
@ -238,6 +238,7 @@ public class VolumeRepository : IVolumeRepository
|
|||
if (progresses.Count == 0) continue;
|
||||
c.PagesRead = progresses.Sum(p => p.PagesRead);
|
||||
c.LastReadingProgressUtc = progresses.Max(p => p.LastModifiedUtc);
|
||||
c.LastReadingProgress = progresses.Max(p => p.LastModified);
|
||||
}
|
||||
|
||||
v.PagesRead = userProgress.Where(p => p.VolumeId == v.Id).Sum(p => p.PagesRead);
|
||||
|
|
|
@ -89,10 +89,10 @@ public static class Seed
|
|||
},
|
||||
new()
|
||||
{
|
||||
Key = ServerSettingKey.Port, Value = "5000"
|
||||
Key = ServerSettingKey.Port, Value = Configuration.DefaultHttpPort + string.Empty
|
||||
}, // Not used from DB, but DB is sync with appSettings.json
|
||||
new() {
|
||||
Key = ServerSettingKey.IpAddresses, Value = "0.0.0.0,::"
|
||||
Key = ServerSettingKey.IpAddresses, Value = Configuration.DefaultIpAddresses
|
||||
}, // Not used from DB, but DB is sync with appSettings.json
|
||||
new() {Key = ServerSettingKey.AllowStatCollection, Value = "true"},
|
||||
new() {Key = ServerSettingKey.EnableOpds, Value = "true"},
|
||||
|
@ -108,6 +108,11 @@ public static class Seed
|
|||
new() {Key = ServerSettingKey.HostName, Value = string.Empty},
|
||||
new() {Key = ServerSettingKey.EncodeMediaAs, Value = EncodeFormat.PNG.ToString()},
|
||||
new() {Key = ServerSettingKey.LicenseKey, Value = string.Empty},
|
||||
new() {Key = ServerSettingKey.OnDeckProgressDays, Value = $"{30}"},
|
||||
new() {Key = ServerSettingKey.OnDeckUpdateDays, Value = $"{7}"},
|
||||
new() {
|
||||
Key = ServerSettingKey.CacheSize, Value = Configuration.DefaultCacheMemory + string.Empty
|
||||
}, // Not used from DB, but DB is sync with appSettings.json
|
||||
}.ToArray());
|
||||
|
||||
foreach (var defaultSetting in DefaultSettings)
|
||||
|
@ -130,7 +135,8 @@ public static class Seed
|
|||
directoryService.CacheDirectory + string.Empty;
|
||||
context.ServerSetting.First(s => s.Key == ServerSettingKey.BackupDirectory).Value =
|
||||
DirectoryService.BackupDirectory + string.Empty;
|
||||
|
||||
context.ServerSetting.First(s => s.Key == ServerSettingKey.CacheSize).Value =
|
||||
Configuration.CacheSize + string.Empty;
|
||||
await context.SaveChangesAsync();
|
||||
|
||||
}
|
||||
|
|
|
@ -37,6 +37,10 @@ public class AppUser : IdentityUser<int>, IHasConcurrencyToken
|
|||
/// </summary>
|
||||
public ICollection<Device> Devices { get; set; } = null!;
|
||||
/// <summary>
|
||||
/// A list of Series the user doesn't want on deck
|
||||
/// </summary>
|
||||
//public ICollection<Series> OnDeckRemovals { get; set; } = null!;
|
||||
/// <summary>
|
||||
/// An API Key to interact with external services, like OPDS
|
||||
/// </summary>
|
||||
public string? ApiKey { get; set; }
|
||||
|
|
11
API/Entities/AppUserOnDeckRemoval.cs
Normal file
11
API/Entities/AppUserOnDeckRemoval.cs
Normal file
|
@ -0,0 +1,11 @@
|
|||
namespace API.Entities;
|
||||
|
||||
public class AppUserOnDeckRemoval
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int SeriesId { get; set; }
|
||||
public Series Series { get; set; }
|
||||
public int AppUserId { get; set; }
|
||||
public AppUser AppUser { get; set; }
|
||||
|
||||
}
|
|
@ -128,5 +128,20 @@ public enum ServerSettingKey
|
|||
/// </summary>
|
||||
[Description("LicenseKey")]
|
||||
LicenseKey = 23,
|
||||
/// <summary>
|
||||
/// The size in MB for Caching API data
|
||||
/// </summary>
|
||||
[Description("Cache")]
|
||||
CacheSize = 24,
|
||||
/// <summary>
|
||||
/// How many Days since today in the past for reading progress, should content be considered for On Deck, before it gets removed automatically
|
||||
/// </summary>
|
||||
[Description("OnDeckProgressDays")]
|
||||
OnDeckProgressDays = 25,
|
||||
/// <summary>
|
||||
/// How many Days since today in the past for chapter updates, should content be considered for On Deck, before it gets removed automatically
|
||||
/// </summary>
|
||||
[Description("OnDeckUpdateDays")]
|
||||
OnDeckUpdateDays = 26,
|
||||
|
||||
}
|
||||
|
|
|
@ -79,6 +79,13 @@ public static class ApplicationServiceExtensions
|
|||
{
|
||||
options.UseInMemory(EasyCacheProfiles.Favicon);
|
||||
options.UseInMemory(EasyCacheProfiles.License);
|
||||
options.UseInMemory(EasyCacheProfiles.Library);
|
||||
options.UseInMemory(EasyCacheProfiles.RevokedJwt);
|
||||
|
||||
// KavitaPlus stuff
|
||||
options.UseInMemory(EasyCacheProfiles.KavitaPlusReviews);
|
||||
options.UseInMemory(EasyCacheProfiles.KavitaPlusRecommendations);
|
||||
options.UseInMemory(EasyCacheProfiles.KavitaPlusRatings);
|
||||
});
|
||||
|
||||
services.AddMemoryCache(options =>
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
using System.Reflection;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
|
||||
namespace API.Extensions;
|
||||
|
||||
public static class MemoryCacheExtensions
|
||||
{
|
||||
public static void RemoveByPrefix(this IMemoryCache memoryCache, string prefix)
|
||||
{
|
||||
if (memoryCache is not MemoryCache concreteMemoryCache) return;
|
||||
|
||||
var cacheEntriesCollectionInfo = typeof(MemoryCache)
|
||||
.GetProperty("EntriesCollection", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||
|
||||
var cacheEntriesCollection = cacheEntriesCollectionInfo?.GetValue(concreteMemoryCache) as dynamic;
|
||||
|
||||
if (cacheEntriesCollection == null) return;
|
||||
foreach (var cacheItem in cacheEntriesCollection)
|
||||
{
|
||||
// Check if the cache key starts with the given prefix
|
||||
if (cacheItem.GetType().GetProperty("Key").GetValue(cacheItem) is string cacheItemKey && cacheItemKey.StartsWith(prefix))
|
||||
{
|
||||
concreteMemoryCache.Remove(cacheItemKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void Clear(this IMemoryCache memoryCache)
|
||||
{
|
||||
if (memoryCache is MemoryCache concreteMemoryCache)
|
||||
{
|
||||
concreteMemoryCache.Clear();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -70,6 +70,15 @@ public class ServerSettingConverter : ITypeConverter<IEnumerable<ServerSetting>,
|
|||
case ServerSettingKey.HostName:
|
||||
destination.HostName = row.Value;
|
||||
break;
|
||||
case ServerSettingKey.CacheSize:
|
||||
destination.CacheSize = long.Parse(row.Value);
|
||||
break;
|
||||
case ServerSettingKey.OnDeckProgressDays:
|
||||
destination.OnDeckProgressDays = int.Parse(row.Value);
|
||||
break;
|
||||
case ServerSettingKey.OnDeckUpdateDays:
|
||||
destination.OnDeckUpdateDays = int.Parse(row.Value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -645,13 +645,13 @@ public class BookService : IBookService
|
|||
return Parser.CleanAuthor(person.Creator) + ",";
|
||||
}
|
||||
|
||||
private static (int year, int month, int day) GetPublicationDate(string publicationDate)
|
||||
private static (int year, int month, int day) GetPublicationDate(string? publicationDate)
|
||||
{
|
||||
var dateParsed = DateTime.TryParse(publicationDate, out var date);
|
||||
var year = 0;
|
||||
var month = 0;
|
||||
var day = 0;
|
||||
switch (dateParsed)
|
||||
if (string.IsNullOrEmpty(publicationDate)) return (year, month, day);
|
||||
switch (DateTime.TryParse(publicationDate, out var date))
|
||||
{
|
||||
case true:
|
||||
year = date.Year;
|
||||
|
|
|
@ -83,7 +83,7 @@ public class DirectoryService : IDirectoryService
|
|||
private const RegexOptions MatchOptions = RegexOptions.Compiled | RegexOptions.IgnoreCase;
|
||||
|
||||
private static readonly Regex ExcludeDirectories = new Regex(
|
||||
@"@eaDir|\.DS_Store|\.qpkg|__MACOSX|@Recently-Snapshot|@recycle|\.@__thumb",
|
||||
@"@eaDir|\.DS_Store|\.qpkg|__MACOSX|@Recently-Snapshot|@recycle|\.@__thumb|\.caltrash",
|
||||
MatchOptions,
|
||||
Tasks.Scanner.Parser.Parser.RegexTimeout);
|
||||
private static readonly Regex FileCopyAppend = new Regex(@"\(\d+\)",
|
||||
|
|
|
@ -130,11 +130,13 @@ public class LicenseService : ILicenseService
|
|||
{
|
||||
try
|
||||
{
|
||||
var license = await _unitOfWork.SettingsRepository.GetSettingAsync(ServerSettingKey.LicenseKey);
|
||||
if (string.IsNullOrEmpty(license.Value)) return;
|
||||
|
||||
_logger.LogInformation("Validating Kavita+ License");
|
||||
var provider = _cachingProviderFactory.GetCachingProvider(EasyCacheProfiles.License);
|
||||
await provider.FlushAsync();
|
||||
|
||||
var license = await _unitOfWork.SettingsRepository.GetSettingAsync(ServerSettingKey.LicenseKey);
|
||||
var isValid = await IsLicenseValid(license.Value);
|
||||
await provider.SetAsync(CacheKey, isValid, _licenseCacheTimeout);
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using API.Data;
|
||||
|
@ -40,6 +41,9 @@ public class RatingService : IRatingService
|
|||
var license = await _unitOfWork.SettingsRepository.GetSettingAsync(ServerSettingKey.LicenseKey);
|
||||
var series = await _unitOfWork.SeriesRepository.GetSeriesByIdAsync(seriesId,
|
||||
SeriesIncludes.Metadata | SeriesIncludes.Library | SeriesIncludes.Chapters | SeriesIncludes.Volumes);
|
||||
|
||||
// Don't send any ratings back for Comic libraries as Kavita+ doesn't have any providers for that
|
||||
if (series == null || series.Library.Type == LibraryType.Comic) return ImmutableList<RatingDto>.Empty;
|
||||
return await GetRatings(license.Value, series);
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ public class RecommendationService : IRecommendationService
|
|||
var series =
|
||||
await _unitOfWork.SeriesRepository.GetSeriesByIdAsync(seriesId,
|
||||
SeriesIncludes.Metadata | SeriesIncludes.Library | SeriesIncludes.Volumes | SeriesIncludes.Chapters);
|
||||
if (series == null) return new RecommendationDto();
|
||||
if (series == null || series.Library.Type == LibraryType.Comic) return new RecommendationDto();
|
||||
var license = await _unitOfWork.SettingsRepository.GetSettingAsync(ServerSettingKey.LicenseKey);
|
||||
|
||||
var user = await _unitOfWork.UserRepository.GetUserByIdAsync(userId);
|
||||
|
|
|
@ -22,9 +22,17 @@ using Microsoft.Extensions.Logging;
|
|||
|
||||
namespace API.Services.Plus;
|
||||
|
||||
/// <summary>
|
||||
/// Misleading name but is the source of data (like a review coming from AniList)
|
||||
/// </summary>
|
||||
public enum ScrobbleProvider
|
||||
{
|
||||
AniList = 1
|
||||
/// <summary>
|
||||
/// For now, this means data comes from within this instance of Kavita
|
||||
/// </summary>
|
||||
Kavita = 0,
|
||||
AniList = 1,
|
||||
Mal = 2,
|
||||
}
|
||||
|
||||
public interface IScrobblingService
|
||||
|
@ -180,6 +188,7 @@ public class ScrobblingService : IScrobblingService
|
|||
if (series == null) throw new KavitaException("Series not found");
|
||||
var library = await _unitOfWork.LibraryRepository.GetLibraryForIdAsync(series.LibraryId);
|
||||
if (library is not {AllowScrobbling: true}) return;
|
||||
if (library.Type == LibraryType.Comic) return;
|
||||
|
||||
var existingEvt = await _unitOfWork.ScrobbleRepository.GetEvent(userId, series.Id,
|
||||
ScrobbleEventType.Review);
|
||||
|
@ -224,6 +233,7 @@ public class ScrobblingService : IScrobblingService
|
|||
if (series == null) throw new KavitaException("Series not found");
|
||||
var library = await _unitOfWork.LibraryRepository.GetLibraryForIdAsync(series.LibraryId);
|
||||
if (library is not {AllowScrobbling: true}) return;
|
||||
if (library.Type == LibraryType.Comic) return;
|
||||
|
||||
var existingEvt = await _unitOfWork.ScrobbleRepository.GetEvent(userId, series.Id,
|
||||
ScrobbleEventType.ScoreUpdated);
|
||||
|
@ -272,6 +282,7 @@ public class ScrobblingService : IScrobblingService
|
|||
}
|
||||
var library = await _unitOfWork.LibraryRepository.GetLibraryForIdAsync(series.LibraryId);
|
||||
if (library is not {AllowScrobbling: true}) return;
|
||||
if (library.Type == LibraryType.Comic) return;
|
||||
|
||||
var existingEvt = await _unitOfWork.ScrobbleRepository.GetEvent(userId, series.Id,
|
||||
ScrobbleEventType.ChapterRead);
|
||||
|
@ -331,6 +342,7 @@ public class ScrobblingService : IScrobblingService
|
|||
if (series == null) throw new KavitaException("Series not found");
|
||||
var library = await _unitOfWork.LibraryRepository.GetLibraryForIdAsync(series.LibraryId);
|
||||
if (library is not {AllowScrobbling: true}) return;
|
||||
if (library.Type == LibraryType.Comic) return;
|
||||
|
||||
var existing = await _unitOfWork.ScrobbleRepository.Exists(userId, series.Id,
|
||||
onWantToRead ? ScrobbleEventType.AddWantToRead : ScrobbleEventType.RemoveWantToRead);
|
||||
|
@ -466,10 +478,11 @@ public class ScrobblingService : IScrobblingService
|
|||
var userIds = (await _unitOfWork.UserRepository.GetAllUsersAsync())
|
||||
.Where(l => userId == 0 || userId == l.Id)
|
||||
.Select(u => u.Id);
|
||||
|
||||
if (!await _licenseService.HasActiveLicense()) return;
|
||||
|
||||
foreach (var uId in userIds)
|
||||
{
|
||||
if (!await _licenseService.HasActiveLicense()) continue;
|
||||
|
||||
var wantToRead = await _unitOfWork.SeriesRepository.GetWantToReadForUserAsync(uId);
|
||||
foreach (var wtr in wantToRead)
|
||||
{
|
||||
|
@ -505,6 +518,7 @@ public class ScrobblingService : IScrobblingService
|
|||
|
||||
foreach (var series in seriesWithProgress)
|
||||
{
|
||||
if (!libAllowsScrobbling[series.LibraryId]) continue;
|
||||
await ScrobbleReadingUpdate(uId, series.Id);
|
||||
}
|
||||
|
||||
|
@ -687,7 +701,10 @@ public class ScrobblingService : IScrobblingService
|
|||
_logger.LogDebug("Processing Reading Events: {Count} / {Total}", progressCounter, totalProgress);
|
||||
progressCounter++;
|
||||
// Check if this media item can even be processed for this user
|
||||
if (!DoesUserHaveProviderAndValid(evt)) continue;
|
||||
if (!DoesUserHaveProviderAndValid(evt))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
var count = await SetAndCheckRateLimit(userRateLimits, evt.AppUser, license.Value);
|
||||
if (count == 0)
|
||||
{
|
||||
|
|
|
@ -286,6 +286,8 @@ public class ReaderService : IReaderService
|
|||
BackgroundJob.Enqueue(() => _scrobblingService.ScrobbleReadingUpdate(user.Id, progressDto.SeriesId));
|
||||
}
|
||||
|
||||
BackgroundJob.Enqueue(() => _unitOfWork.SeriesRepository.ClearOnDeckRemoval(progressDto.SeriesId, userId));
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ internal class MediaReviewDto
|
|||
/// </summary>
|
||||
public string RawBody { get; set; }
|
||||
public string Username { get; set; }
|
||||
public ScrobbleProvider Provider { get; set; }
|
||||
}
|
||||
|
||||
public interface IReviewService
|
||||
|
@ -74,6 +75,7 @@ public class ReviewService : IReviewService
|
|||
LibraryId = series.LibraryId,
|
||||
SeriesId = series.Id,
|
||||
IsExternal = true,
|
||||
Provider = r.Provider,
|
||||
BodyJustText = GetCharacters(r.Body),
|
||||
ExternalUrl = r.SiteUrl
|
||||
});
|
||||
|
|
|
@ -995,7 +995,9 @@ public static class Parser
|
|||
/// <returns></returns>
|
||||
public static bool HasBlacklistedFolderInPath(string path)
|
||||
{
|
||||
return path.Contains("__MACOSX") || path.StartsWith("@Recently-Snapshot") || path.StartsWith("@recycle") || path.StartsWith("._") || Path.GetFileName(path).StartsWith("._") || path.Contains(".qpkg");
|
||||
return path.Contains("__MACOSX") || path.StartsWith("@Recently-Snapshot") || path.StartsWith("@recycle")
|
||||
|| path.StartsWith("._") || Path.GetFileName(path).StartsWith("._") || path.Contains(".qpkg")
|
||||
|| path.Contains(".caltrash");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
using API.Entities.Enums;
|
||||
|
||||
namespace API.Services.Tasks.Scanner.Parser;
|
||||
#nullable enable
|
||||
|
||||
/// <summary>
|
||||
/// This represents all parsed information from a single file
|
||||
|
@ -12,7 +13,7 @@ public class ParserInfo
|
|||
/// Represents the parsed chapters from a file. By default, will be 0 which means nothing could be parsed.
|
||||
/// <remarks>The chapters can only be a single float or a range of float ie) 1-2. Mainly floats should be multiples of 0.5 representing specials</remarks>
|
||||
/// </summary>
|
||||
public string Chapters { get; set; } = "";
|
||||
public string Chapters { get; set; } = string.Empty;
|
||||
/// <summary>
|
||||
/// Represents the parsed series from the file or folder
|
||||
/// </summary>
|
||||
|
@ -31,17 +32,17 @@ public class ParserInfo
|
|||
/// <example>Beastars Vol 3-4 will map to "3-4"</example>
|
||||
/// <remarks>The volumes can only be a single int or a range of ints ie) 1-2. Float based volumes are not supported.</remarks>
|
||||
/// </summary>
|
||||
public string Volumes { get; set; } = "";
|
||||
public string Volumes { get; set; } = string.Empty;
|
||||
/// <summary>
|
||||
/// Filename of the underlying file
|
||||
/// <example>Beastars v01 (digital).cbz</example>
|
||||
/// </summary>
|
||||
public string Filename { get; init; } = "";
|
||||
public string Filename { get; init; } = string.Empty;
|
||||
/// <summary>
|
||||
/// Full filepath of the underlying file
|
||||
/// <example>C:/Manga/Beastars v01 (digital).cbz</example>
|
||||
/// </summary>
|
||||
public string FullFilePath { get; set; } = "";
|
||||
public string FullFilePath { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="MangaFormat"/> that represents the type of the file
|
||||
|
@ -53,7 +54,7 @@ public class ParserInfo
|
|||
/// This can potentially story things like "Omnibus, Color, Full Contact Edition, Extra, Final, etc"
|
||||
/// </summary>
|
||||
/// <remarks>Not Used in Database</remarks>
|
||||
public string Edition { get; set; } = "";
|
||||
public string Edition { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// If the file contains no volume/chapter information or contains Special Keywords <see cref="Parser.MangaSpecialRegex"/>
|
||||
|
@ -72,7 +73,7 @@ public class ParserInfo
|
|||
/// <returns></returns>
|
||||
public bool IsSpecialInfo()
|
||||
{
|
||||
return (IsSpecial || (Volumes == "0" && Chapters == "0"));
|
||||
return (IsSpecial || (Volumes == Parser.DefaultVolume && Chapters == Parser.DefaultChapter));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -89,8 +90,8 @@ public class ParserInfo
|
|||
public void Merge(ParserInfo? info2)
|
||||
{
|
||||
if (info2 == null) return;
|
||||
Chapters = string.IsNullOrEmpty(Chapters) || Chapters == "0" ? info2.Chapters: Chapters;
|
||||
Volumes = string.IsNullOrEmpty(Volumes) || Volumes == "0" ? info2.Volumes : Volumes;
|
||||
Chapters = string.IsNullOrEmpty(Chapters) || Chapters == Parser.DefaultChapter ? info2.Chapters: Chapters;
|
||||
Volumes = string.IsNullOrEmpty(Volumes) || Volumes == Parser.DefaultVolume ? info2.Volumes : Volumes;
|
||||
Edition = string.IsNullOrEmpty(Edition) ? info2.Edition : Edition;
|
||||
Title = string.IsNullOrEmpty(Title) ? info2.Title : Title;
|
||||
Series = string.IsNullOrEmpty(Series) ? info2.Series : Series;
|
||||
|
|
|
@ -164,7 +164,7 @@ public class ScannerService : IScannerService
|
|||
|
||||
var libraries = (await _unitOfWork.LibraryRepository.GetLibraryDtosAsync()).ToList();
|
||||
var libraryFolders = libraries.SelectMany(l => l.Folders);
|
||||
var libraryFolder = libraryFolders.Select(Scanner.Parser.Parser.NormalizePath).SingleOrDefault(f => f.Contains(parentDirectory));
|
||||
var libraryFolder = libraryFolders.Select(Scanner.Parser.Parser.NormalizePath).FirstOrDefault(f => f.Contains(parentDirectory));
|
||||
|
||||
if (string.IsNullOrEmpty(libraryFolder)) return;
|
||||
var library = libraries.Find(l => l.Folders.Select(Parser.NormalizePath).Contains(libraryFolder));
|
||||
|
|
|
@ -23,6 +23,7 @@ public interface IStatsService
|
|||
{
|
||||
Task Send();
|
||||
Task<ServerInfoDto> GetServerInfo();
|
||||
Task<ServerInfoSlimDto> GetServerInfoSlim();
|
||||
Task SendCancellation();
|
||||
}
|
||||
/// <summary>
|
||||
|
@ -171,6 +172,17 @@ public class StatsService : IStatsService
|
|||
return serverInfo;
|
||||
}
|
||||
|
||||
public async Task<ServerInfoSlimDto> GetServerInfoSlim()
|
||||
{
|
||||
var serverSettings = await _unitOfWork.SettingsRepository.GetSettingsDtoAsync();
|
||||
return new ServerInfoSlimDto()
|
||||
{
|
||||
InstallId = serverSettings.InstallId,
|
||||
KavitaVersion = serverSettings.InstallVersion,
|
||||
IsDocker = OsInfo.IsDocker
|
||||
};
|
||||
}
|
||||
|
||||
public async Task SendCancellation()
|
||||
{
|
||||
_logger.LogInformation("Informing KavitaStats that this instance is no longer sending stats");
|
||||
|
|
|
@ -116,7 +116,7 @@ public class Startup
|
|||
Location = ResponseCacheLocation.Client,
|
||||
NoStore = false
|
||||
});
|
||||
options.CacheProfiles.Add(ResponseCacheProfiles.Recommendation,
|
||||
options.CacheProfiles.Add(ResponseCacheProfiles.KavitaPlus,
|
||||
new CacheProfile()
|
||||
{
|
||||
Duration = TimeSpan.FromDays(30).Seconds,
|
||||
|
|
|
@ -3,5 +3,5 @@
|
|||
"Port": 5000,
|
||||
"IpAddresses": "",
|
||||
"BaseUrl": "/",
|
||||
"Cache": 50
|
||||
"Cache": 90
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"TokenKey": "super secret unguessable key",
|
||||
"TokenKey": "super secret unguessable key that is longer because we require it",
|
||||
"Port": 5000,
|
||||
"IpAddresses": "",
|
||||
"BaseUrl": "/",
|
||||
|
|
|
@ -13,7 +13,7 @@ public static class Configuration
|
|||
public const int DefaultHttpPort = 5000;
|
||||
public const int DefaultTimeOutSecs = 90;
|
||||
public const string DefaultXFrameOptions = "SAMEORIGIN";
|
||||
public const int DefaultCacheMemory = 50;
|
||||
public const long DefaultCacheMemory = 75;
|
||||
private static readonly string AppSettingsFilename = Path.Join("config", GetAppSettingFilename());
|
||||
|
||||
public static string KavitaPlusApiUrl = "https://plus.kavitareader.com";
|
||||
|
@ -42,7 +42,7 @@ public static class Configuration
|
|||
set => SetBaseUrl(GetAppSettingFilename(), value);
|
||||
}
|
||||
|
||||
public static int CacheSize
|
||||
public static long CacheSize
|
||||
{
|
||||
get => GetCacheSize(GetAppSettingFilename());
|
||||
set => SetCacheSize(GetAppSettingFilename(), value);
|
||||
|
@ -69,15 +69,8 @@ public static class Configuration
|
|||
try
|
||||
{
|
||||
var json = File.ReadAllText(filePath);
|
||||
var jsonObj = JsonSerializer.Deserialize<dynamic>(json);
|
||||
const string key = "TokenKey";
|
||||
|
||||
if (jsonObj.TryGetProperty(key, out JsonElement tokenElement))
|
||||
{
|
||||
return tokenElement.GetString();
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
var jsonObj = JsonSerializer.Deserialize<AppSettings>(json);
|
||||
return jsonObj.TokenKey;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -144,29 +137,23 @@ public static class Configuration
|
|||
|
||||
private static int GetPort(string filePath)
|
||||
{
|
||||
const int defaultPort = 5000;
|
||||
if (OsInfo.IsDocker)
|
||||
{
|
||||
return defaultPort;
|
||||
return DefaultHttpPort;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var json = File.ReadAllText(filePath);
|
||||
var jsonObj = JsonSerializer.Deserialize<dynamic>(json);
|
||||
const string key = "Port";
|
||||
|
||||
if (jsonObj.TryGetProperty(key, out JsonElement tokenElement))
|
||||
{
|
||||
return tokenElement.GetInt32();
|
||||
}
|
||||
var jsonObj = JsonSerializer.Deserialize<AppSettings>(json);
|
||||
return jsonObj.Port;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("Error writing app settings: " + ex.Message);
|
||||
}
|
||||
|
||||
return defaultPort;
|
||||
return DefaultHttpPort;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -204,13 +191,8 @@ public static class Configuration
|
|||
try
|
||||
{
|
||||
var json = File.ReadAllText(filePath);
|
||||
var jsonObj = JsonSerializer.Deserialize<dynamic>(json);
|
||||
const string key = "IpAddresses";
|
||||
|
||||
if (jsonObj.TryGetProperty(key, out JsonElement tokenElement))
|
||||
{
|
||||
return tokenElement.GetString();
|
||||
}
|
||||
var jsonObj = JsonSerializer.Deserialize<AppSettings>(json);
|
||||
return jsonObj.IpAddresses;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -224,16 +206,12 @@ public static class Configuration
|
|||
#region BaseUrl
|
||||
private static string GetBaseUrl(string filePath)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
var json = File.ReadAllText(filePath);
|
||||
var jsonObj = JsonSerializer.Deserialize<dynamic>(json);
|
||||
const string key = "BaseUrl";
|
||||
var jsonObj = JsonSerializer.Deserialize<AppSettings>(json);
|
||||
|
||||
if (jsonObj.TryGetProperty(key, out JsonElement tokenElement))
|
||||
{
|
||||
var baseUrl = tokenElement.GetString();
|
||||
var baseUrl = jsonObj.BaseUrl;
|
||||
if (!string.IsNullOrEmpty(baseUrl))
|
||||
{
|
||||
baseUrl = !baseUrl.StartsWith('/')
|
||||
|
@ -246,8 +224,6 @@ public static class Configuration
|
|||
|
||||
return baseUrl;
|
||||
}
|
||||
return DefaultBaseUrl;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -284,7 +260,7 @@ public static class Configuration
|
|||
#endregion
|
||||
|
||||
#region CacheSize
|
||||
private static void SetCacheSize(string filePath, int cache)
|
||||
private static void SetCacheSize(string filePath, long cache)
|
||||
{
|
||||
if (cache <= 0) return;
|
||||
try
|
||||
|
@ -301,18 +277,14 @@ public static class Configuration
|
|||
}
|
||||
}
|
||||
|
||||
private static int GetCacheSize(string filePath)
|
||||
private static long GetCacheSize(string filePath)
|
||||
{
|
||||
try
|
||||
{
|
||||
var json = File.ReadAllText(filePath);
|
||||
var jsonObj = JsonSerializer.Deserialize<dynamic>(json);
|
||||
const string key = "Port";
|
||||
var jsonObj = JsonSerializer.Deserialize<AppSettings>(json);
|
||||
|
||||
if (jsonObj.TryGetProperty(key, out JsonElement tokenElement))
|
||||
{
|
||||
return tokenElement.GetInt32();
|
||||
}
|
||||
return jsonObj.Cache == 0 ? DefaultCacheMemory : jsonObj.Cache;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -336,14 +308,8 @@ public static class Configuration
|
|||
try
|
||||
{
|
||||
var json = File.ReadAllText(filePath);
|
||||
var jsonObj = JsonSerializer.Deserialize<dynamic>(json);
|
||||
const string key = "XFrameOrigins";
|
||||
|
||||
if (jsonObj.TryGetProperty(key, out JsonElement tokenElement))
|
||||
{
|
||||
var origins = tokenElement.GetString();
|
||||
return !string.IsNullOrEmpty(origins) ? origins : DefaultBaseUrl;
|
||||
}
|
||||
var jsonObj = JsonSerializer.Deserialize<AppSettings>(json);
|
||||
return !string.IsNullOrEmpty(jsonObj.XFrameOrigins) ? jsonObj.XFrameOrigins : DefaultXFrameOptions;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -358,12 +324,14 @@ public static class Configuration
|
|||
{
|
||||
public string TokenKey { get; set; }
|
||||
// ReSharper disable once MemberHidesStaticFromOuterClass
|
||||
public int Port { get; set; }
|
||||
public int Port { get; set; } = DefaultHttpPort;
|
||||
// ReSharper disable once MemberHidesStaticFromOuterClass
|
||||
public string IpAddresses { get; set; } = string.Empty;
|
||||
// ReSharper disable once MemberHidesStaticFromOuterClass
|
||||
public string BaseUrl { get; set; }
|
||||
// ReSharper disable once MemberHidesStaticFromOuterClass
|
||||
public int Cache { get; set; }
|
||||
public long Cache { get; set; } = DefaultCacheMemory;
|
||||
// ReSharper disable once MemberHidesStaticFromOuterClass
|
||||
public string XFrameOrigins { get; set; } = DefaultXFrameOptions;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,31 +45,7 @@ public static class HashUtil
|
|||
|
||||
public static string ServerToken()
|
||||
{
|
||||
var seed = new DeviceIdBuilder()
|
||||
.AddMacAddress()
|
||||
.AddUserName()
|
||||
.AddComponent("ProcessorCount", new DeviceIdComponent($"{Environment.ProcessorCount}"))
|
||||
.AddComponent("OSPlatform", new DeviceIdComponent($"{Environment.OSVersion.Platform}"))
|
||||
.OnWindows(windows => windows
|
||||
.AddSystemUuid()
|
||||
.AddMotherboardSerialNumber()
|
||||
.AddSystemDriveSerialNumber())
|
||||
.OnLinux(linux =>
|
||||
{
|
||||
var osInfo = RunAndCapture("uname", "-a");
|
||||
if (Regex.IsMatch(osInfo, @"\bUnraid\b"))
|
||||
{
|
||||
var cpuModel = RunAndCapture("lscpu", string.Empty);
|
||||
var match = Regex.Match(cpuModel, @"Model name:\s+(.+)");
|
||||
linux.AddComponent("CPUModel", new DeviceIdComponent($"{match.Groups[1].Value.Trim()}"));
|
||||
return;
|
||||
}
|
||||
linux.AddMotherboardSerialNumber();
|
||||
})
|
||||
.OnMac(mac => mac
|
||||
.AddSystemDriveSerialNumber())
|
||||
.ToString();
|
||||
return CalculateCrc(seed);
|
||||
return AnonymousToken();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<TargetFramework>net7.0</TargetFramework>
|
||||
<Company>kavitareader.com</Company>
|
||||
<Product>Kavita</Product>
|
||||
<AssemblyVersion>0.7.4.0</AssemblyVersion>
|
||||
<AssemblyVersion>0.7.5.0</AssemblyVersion>
|
||||
<NeutralLanguage>en</NeutralLanguage>
|
||||
<TieredPGO>true</TieredPGO>
|
||||
</PropertyGroup>
|
||||
|
|
|
@ -43,4 +43,5 @@ export interface Chapter {
|
|||
volumeTitle?: string;
|
||||
webLinks: string;
|
||||
isbn: string;
|
||||
lastReadingProgress: string;
|
||||
}
|
||||
|
|
|
@ -88,6 +88,10 @@ export enum Action {
|
|||
* Import some data into Kavita
|
||||
*/
|
||||
Import = 18,
|
||||
/**
|
||||
* Removes the Series from On Deck inclusion
|
||||
*/
|
||||
RemoveFromOnDeck = 19,
|
||||
}
|
||||
|
||||
export interface ActionItem<T> {
|
||||
|
@ -563,9 +567,7 @@ export class ActionFactoryService {
|
|||
|
||||
// Checks the whole tree for the action and returns true if it exists
|
||||
public hasAction(actions: Array<ActionItem<any>>, action: Action) {
|
||||
var actionFound = false;
|
||||
|
||||
if (actions.length === 0) return actionFound;
|
||||
if (actions.length === 0) return false;
|
||||
|
||||
for (let i = 0; i < actions.length; i++)
|
||||
{
|
||||
|
@ -573,8 +575,7 @@ export class ActionFactoryService {
|
|||
if (this.hasAction(actions[i].children, action)) return true;
|
||||
}
|
||||
|
||||
|
||||
return actionFound;
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -578,15 +578,13 @@ export class ActionService implements OnDestroy {
|
|||
});
|
||||
}
|
||||
|
||||
private async promptIfForce(extraContent: string = '') {
|
||||
// Prompt user if we should do a force or not
|
||||
const config = this.confirmService.defaultConfirm;
|
||||
config.header = 'Force Scan';
|
||||
config.buttons = [
|
||||
{text: 'Yes', type: 'secondary'},
|
||||
{text: 'No', type: 'primary'},
|
||||
];
|
||||
const msg = 'Do you want to force this scan? This is will ignore optimizations that reduce processing and I/O. ' + extraContent;
|
||||
return !await this.confirmService.confirm(msg, config); // Not because primary is the false state
|
||||
sendSeriesToDevice(seriesId: number, device: Device, callback?: VoidActionCallback) {
|
||||
this.deviceSerivce.sendSeriesTo(seriesId, device.id).subscribe(() => {
|
||||
this.toastr.success('File(s) emailed to ' + device.name);
|
||||
if (callback) {
|
||||
callback();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -54,5 +54,9 @@ export class DeviceService {
|
|||
return this.httpClient.post(this.baseUrl + 'device/send-to', {deviceId, chapterIds}, TextResonse);
|
||||
}
|
||||
|
||||
sendSeriesTo(seriesId: number, deviceId: number) {
|
||||
return this.httpClient.post(this.baseUrl + 'device/send-series-to', {deviceId, seriesId}, TextResonse);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -24,8 +24,9 @@ import {UtilityService} from "../shared/_services/utility.service";
|
|||
import {ReadingList} from "../_models/reading-list";
|
||||
|
||||
export enum ScrobbleProvider {
|
||||
Kavita = 0,
|
||||
AniList= 1,
|
||||
Mal = 2
|
||||
Mal = 2,
|
||||
}
|
||||
|
||||
@Injectable({
|
||||
|
|
|
@ -32,12 +32,12 @@ export class SeriesService {
|
|||
paginatedSeriesForTagsResults: PaginatedResult<Series[]> = new PaginatedResult<Series[]>();
|
||||
|
||||
constructor(private httpClient: HttpClient, private imageService: ImageService,
|
||||
private utilityService: UtilityService, private filterUtilitySerivce: FilterUtilitiesService) { }
|
||||
private utilityService: UtilityService, private filterUtilityService: FilterUtilitiesService) { }
|
||||
|
||||
getAllSeries(pageNum?: number, itemsPerPage?: number, filter?: SeriesFilter) {
|
||||
let params = new HttpParams();
|
||||
params = this.utilityService.addPaginationIfExists(params, pageNum, itemsPerPage);
|
||||
const data = this.filterUtilitySerivce.createSeriesFilter(filter);
|
||||
const data = this.filterUtilityService.createSeriesFilter(filter);
|
||||
|
||||
return this.httpClient.post<PaginatedResult<Series[]>>(this.baseUrl + 'series/all', data, {observe: 'response', params}).pipe(
|
||||
map((response: any) => {
|
||||
|
@ -49,7 +49,7 @@ export class SeriesService {
|
|||
getSeriesForLibrary(libraryId: number, pageNum?: number, itemsPerPage?: number, filter?: SeriesFilter) {
|
||||
let params = new HttpParams();
|
||||
params = this.utilityService.addPaginationIfExists(params, pageNum, itemsPerPage);
|
||||
const data = this.filterUtilitySerivce.createSeriesFilter(filter);
|
||||
const data = this.filterUtilityService.createSeriesFilter(filter);
|
||||
|
||||
return this.httpClient.post<PaginatedResult<Series[]>>(this.baseUrl + 'series?libraryId=' + libraryId, data, {observe: 'response', params}).pipe(
|
||||
map((response: any) => {
|
||||
|
@ -103,7 +103,7 @@ export class SeriesService {
|
|||
}
|
||||
|
||||
getRecentlyAdded(libraryId: number = 0, pageNum?: number, itemsPerPage?: number, filter?: SeriesFilter) {
|
||||
const data = this.filterUtilitySerivce.createSeriesFilter(filter);
|
||||
const data = this.filterUtilityService.createSeriesFilter(filter);
|
||||
let params = new HttpParams();
|
||||
params = this.utilityService.addPaginationIfExists(params, pageNum, itemsPerPage);
|
||||
|
||||
|
@ -119,7 +119,7 @@ export class SeriesService {
|
|||
}
|
||||
|
||||
getWantToRead(pageNum?: number, itemsPerPage?: number, filter?: SeriesFilter): Observable<PaginatedResult<Series[]>> {
|
||||
const data = this.filterUtilitySerivce.createSeriesFilter(filter);
|
||||
const data = this.filterUtilityService.createSeriesFilter(filter);
|
||||
|
||||
let params = new HttpParams();
|
||||
params = this.utilityService.addPaginationIfExists(params, pageNum, itemsPerPage);
|
||||
|
@ -138,7 +138,7 @@ export class SeriesService {
|
|||
}
|
||||
|
||||
getOnDeck(libraryId: number = 0, pageNum?: number, itemsPerPage?: number, filter?: SeriesFilter) {
|
||||
const data = this.filterUtilitySerivce.createSeriesFilter(filter);
|
||||
const data = this.filterUtilityService.createSeriesFilter(filter);
|
||||
|
||||
let params = new HttpParams();
|
||||
params = this.utilityService.addPaginationIfExists(params, pageNum, itemsPerPage);
|
||||
|
@ -223,4 +223,11 @@ export class SeriesService {
|
|||
getRatings(seriesId: number) {
|
||||
return this.httpClient.get<Array<Rating>>(this.baseUrl + 'rating?seriesId=' + seriesId);
|
||||
}
|
||||
getOverallRating(seriesId: number) {
|
||||
return this.httpClient.get<Rating>(this.baseUrl + 'rating/overall?seriesId=' + seriesId);
|
||||
}
|
||||
|
||||
removeFromOnDeck(seriesId: number) {
|
||||
return this.httpClient.post(this.baseUrl + 'series/remove-from-on-deck?seriesId=' + seriesId, {});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { ServerInfo } from '../admin/_models/server-info';
|
||||
import {ServerInfoSlim} from '../admin/_models/server-info';
|
||||
import { UpdateVersionEvent } from '../_models/events/update-version-event';
|
||||
import { Job } from '../_models/job/job';
|
||||
import { KavitaMediaError } from '../admin/_models/media-error';
|
||||
|
@ -17,7 +17,7 @@ export class ServerService {
|
|||
|
||||
|
||||
getServerInfo() {
|
||||
return this.httpClient.get<ServerInfo>(this.baseUrl + 'server/server-info');
|
||||
return this.httpClient.get<ServerInfoSlim>(this.baseUrl + 'server/server-info-slim');
|
||||
}
|
||||
|
||||
clearCache() {
|
||||
|
|
|
@ -22,6 +22,12 @@
|
|||
</div>
|
||||
|
||||
<div class="card-footer bg-transparent text-muted">
|
||||
<ng-container *ngIf="isMyReview; else normalReview">
|
||||
<i class="d-md-none fa-solid fa-star me-1" aria-hidden="true" title="This is your review"></i>
|
||||
</ng-container>
|
||||
<ng-template #normalReview>
|
||||
<img class="me-1" [ngSrc]="review.provider | providerImage" width="20" height="20" alt="">
|
||||
</ng-template>
|
||||
{{(isMyReview ? '' : review.username | defaultValue:'')}}
|
||||
<span style="float: right" *ngIf="review.isExternal">Rating {{review.score}}%</span>
|
||||
</div>
|
||||
|
|
|
@ -8,6 +8,9 @@
|
|||
z-index: 20;
|
||||
top: 38px;
|
||||
left: 38px;
|
||||
}
|
||||
|
||||
.fa-star {
|
||||
color: var(--review-card-star-color);
|
||||
}
|
||||
|
||||
|
@ -29,10 +32,6 @@
|
|||
overflow: hidden;
|
||||
}
|
||||
|
||||
.card-footer {
|
||||
width: 288px;
|
||||
}
|
||||
|
||||
.card {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {ChangeDetectionStrategy, ChangeDetectorRef, Component, inject, Input, OnInit} from '@angular/core';
|
||||
import {CommonModule} from '@angular/common';
|
||||
import {CommonModule, NgOptimizedImage} from '@angular/common';
|
||||
import {UserReview} from "./user-review";
|
||||
import {NgbModal} from "@ng-bootstrap/ng-bootstrap";
|
||||
import {ReviewCardModalComponent} from "../review-card-modal/review-card-modal.component";
|
||||
|
@ -7,11 +7,13 @@ import {AccountService} from "../../_services/account.service";
|
|||
import {ReviewSeriesModalComponent} from "../review-series-modal/review-series-modal.component";
|
||||
import {ReadMoreComponent} from "../../shared/read-more/read-more.component";
|
||||
import {DefaultValuePipe} from "../../pipe/default-value.pipe";
|
||||
import {ImageComponent} from "../../shared/image/image.component";
|
||||
import {ProviderImagePipe} from "../../pipe/provider-image.pipe";
|
||||
|
||||
@Component({
|
||||
selector: 'app-review-card',
|
||||
standalone: true,
|
||||
imports: [CommonModule, ReadMoreComponent, DefaultValuePipe],
|
||||
imports: [CommonModule, ReadMoreComponent, DefaultValuePipe, ImageComponent, NgOptimizedImage, ProviderImagePipe],
|
||||
templateUrl: './review-card.component.html',
|
||||
styleUrls: ['./review-card.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import {ScrobbleProvider} from "../../_services/scrobbling.service";
|
||||
|
||||
export interface UserReview {
|
||||
seriesId: number;
|
||||
libraryId: number;
|
||||
|
@ -8,4 +10,5 @@ export interface UserReview {
|
|||
isExternal: boolean;
|
||||
bodyJustText?: string;
|
||||
externalUrl?: string;
|
||||
provider: ScrobbleProvider;
|
||||
}
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
export interface ServerInfo {
|
||||
os: string;
|
||||
dotnetVersion: string;
|
||||
runTimeVersion: string;
|
||||
export interface ServerInfoSlim {
|
||||
kavitaVersion: string;
|
||||
NumOfCores: number;
|
||||
installId: string;
|
||||
isDocker: boolean;
|
||||
}
|
|
@ -17,4 +17,7 @@ export interface ServerSettings {
|
|||
totalLogs: number;
|
||||
enableFolderWatching: boolean;
|
||||
hostName: string;
|
||||
cacheSize: number;
|
||||
onDeckProgressDays: number;
|
||||
onDeckUpdateDays: number;
|
||||
}
|
||||
|
|
|
@ -36,12 +36,9 @@
|
|||
<app-manage-tasks-settings></app-manage-tasks-settings>
|
||||
</ng-container>
|
||||
<ng-container *ngIf="tab.fragment === TabID.KavitaPlus">
|
||||
<p>Kavita+ is a premium subscription service which unlocks features for all users on this Kavita instance. Buy a subscription to unlock <a href="https://wiki.kavitareader.com/en/kavita-plus" target="_blank" rel="noreferrer nofollow">premium benefits</a> today!</p>
|
||||
<p>Kavita+ is a premium subscription service which unlocks features for all users on this Kavita instance. Buy a subscription to unlock <a href="https://wiki.kavitareader.com/en/kavita-plus" target="_blank" rel="noreferrer nofollow">premium benefits</a> today! <a href="https://wiki.kavitareader.com/en/kavita-plus#faq" target="_blank" rel="noreferrer nofollow">FAQ</a></p>
|
||||
<app-license></app-license>
|
||||
</ng-container>
|
||||
<ng-container *ngIf="tab.fragment === TabID.Plugins">
|
||||
Nothing here yet. This will be built out in a future update.
|
||||
</ng-container>
|
||||
</ng-template>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<div class="container-fluid">
|
||||
<form [formGroup]="settingsForm" *ngIf="serverSettings !== undefined">
|
||||
<div class="alert alert-warning" role="alert">
|
||||
<strong>Notice:</strong> Changing Port, Base Url or IPs requires a manual restart of Kavita to take effect.
|
||||
<strong>Notice:</strong> Changing Port, Base Url, Cache Size or IPs requires a manual restart of Kavita to take effect.
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
|
@ -97,7 +97,58 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<div class="row g-0 mb-2 mt-3">
|
||||
<div class="col-md-4 col-sm-12 pe-2">
|
||||
<label for="cache-size" class="form-label">Cache Size</label> <i class="fa fa-info-circle" placement="right" [ngbTooltip]="cacheSizeTooltip" role="button" tabindex="0"></i>
|
||||
<ng-template #cacheSizeTooltip>The amount of memory allowed for caching heavy APIs. Default is 75MB.</ng-template>
|
||||
<span class="visually-hidden" id="cache-size-help">The amount of memory allowed for caching heavy APIs. Default is 50MB.</span>
|
||||
<input id="cache-size" aria-describedby="cache-size-help" class="form-control" formControlName="cacheSize"
|
||||
type="number" inputmode="numeric" step="5" min="50" onkeypress="return event.charCode >= 48 && event.charCode <= 57"
|
||||
[class.is-invalid]="settingsForm.get('cacheSize')?.invalid && settingsForm.get('cacheSize')?.touched">
|
||||
<ng-container *ngIf="settingsForm.get('cacheSize')?.errors as errors">
|
||||
<p class="invalid-feedback" *ngIf="errors.min">
|
||||
You must have at least 50 MB.
|
||||
</p>
|
||||
<p class="invalid-feedback" *ngIf="errors.required">
|
||||
This field is required
|
||||
</p>
|
||||
</ng-container>
|
||||
</div>
|
||||
<div class="col-md-4 col-sm-12 pe-2">
|
||||
<label for="on-deck-progress-days" class="form-label">On Deck Last Progress (days)</label> <i class="fa fa-info-circle" placement="right" [ngbTooltip]="onDeckProgressDaysTooltip" role="button" tabindex="0"></i>
|
||||
<ng-template #onDeckProgressDaysTooltip>The number of days since last progress before kicking something off On Deck.</ng-template>
|
||||
<span class="visually-hidden" id="on-deck-progress-days-help">The number of days since last progress before kicking something off On Deck.</span>
|
||||
<input id="on-deck-progress-days" aria-describedby="on-deck-progress-days-help" class="form-control" formControlName="onDeckProgressDays"
|
||||
type="number" inputmode="numeric" step="1" min="1"
|
||||
[class.is-invalid]="settingsForm.get('onDeckProgressDays')?.invalid && settingsForm.get('onDeckProgressDays')?.touched">
|
||||
<ng-container *ngIf="settingsForm.get('onDeckProgressDays')?.errors as errors">
|
||||
<p class="invalid-feedback" *ngIf="errors.min">
|
||||
Must be at least 1 day
|
||||
</p>
|
||||
<p class="invalid-feedback" *ngIf="errors.required">
|
||||
This field is required
|
||||
</p>
|
||||
</ng-container>
|
||||
</div>
|
||||
<div class="col-md-4 col-sm-12 pe-2">
|
||||
<label for="on-deck-update-days" class="form-label">On Deck Last Chapter Add (days)</label> <i class="fa fa-info-circle" placement="right" [ngbTooltip]="onDeckUpdateDaysTooltip" role="button" tabindex="0"></i>
|
||||
<ng-template #onDeckUpdateDaysTooltip>The number of days since last chapter was added to include something On Deck.</ng-template>
|
||||
<span class="visually-hidden" id="on-deck-update-days-help">The number of days since last chapter was added to include something On Deck.</span>
|
||||
<input id="on-deck-update-days" aria-describedby="on-deck-update-days-help" class="form-control" formControlName="onDeckUpdateDays"
|
||||
type="number" inputmode="numeric" step="1" min="1"
|
||||
[class.is-invalid]="settingsForm.get('onDeckUpdateDays')?.invalid && settingsForm.get('onDeckUpdateDays')?.touched">
|
||||
<ng-container *ngIf="settingsForm.get('onDeckUpdateDays')?.errors as errors">
|
||||
<p class="invalid-feedback" *ngIf="errors.min">
|
||||
Must be at least 1 day
|
||||
</p>
|
||||
<p class="invalid-feedback" *ngIf="errors.required">
|
||||
This field is required
|
||||
</p>
|
||||
</ng-container>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3 mt-3">
|
||||
<label for="stat-collection" class="form-label" aria-describedby="collection-info">Allow Anonymous Usage Collection</label>
|
||||
<p class="accent" id="collection-info">Send anonymous usage data to Kavita's servers. This includes information on certain features used, number of files, OS version, Kavita install version, CPU, and memory. We will use this information to prioritize features, bug fixes, and performance tuning. Requires restart to take effect. See the <a href="https://wiki.kavitareader.com/en/faq" rel="noopener noreferrer" target="_blank" referrerpolicy="no-refer">wiki</a> for what is collected.</p>
|
||||
<div class="form-check form-switch">
|
||||
|
@ -106,7 +157,6 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<!-- TODO: Move this to Plugins tab once we build out some basic tables -->
|
||||
<div class="mb-3">
|
||||
<label for="opds" aria-describedby="opds-info" class="form-label">OPDS</label>
|
||||
<p class="accent" id="opds-info">OPDS support will allow all users to use OPDS to read and download content from the server.</p>
|
||||
|
|
|
@ -25,10 +25,6 @@ export class ManageSettingsComponent implements OnInit {
|
|||
taskFrequencies: Array<string> = [];
|
||||
logLevels: Array<string> = [];
|
||||
|
||||
get TagBadgeCursor() {
|
||||
return TagBadgeCursor;
|
||||
}
|
||||
|
||||
constructor(private settingsService: SettingsService, private toastr: ToastrService,
|
||||
private serverService: ServerService) { }
|
||||
|
||||
|
@ -52,10 +48,13 @@ export class ManageSettingsComponent implements OnInit {
|
|||
this.settingsForm.addControl('baseUrl', new FormControl(this.serverSettings.baseUrl, [Validators.pattern(/^(\/[\w-]+)*\/$/)]));
|
||||
this.settingsForm.addControl('emailServiceUrl', new FormControl(this.serverSettings.emailServiceUrl, [Validators.required]));
|
||||
this.settingsForm.addControl('totalBackups', new FormControl(this.serverSettings.totalBackups, [Validators.required, Validators.min(1), Validators.max(30)]));
|
||||
this.settingsForm.addControl('cacheSize', new FormControl(this.serverSettings.cacheSize, [Validators.required, Validators.min(50)]));
|
||||
this.settingsForm.addControl('totalLogs', new FormControl(this.serverSettings.totalLogs, [Validators.required, Validators.min(1), Validators.max(30)]));
|
||||
this.settingsForm.addControl('enableFolderWatching', new FormControl(this.serverSettings.enableFolderWatching, [Validators.required]));
|
||||
this.settingsForm.addControl('encodeMediaAs', new FormControl(this.serverSettings.encodeMediaAs, []));
|
||||
this.settingsForm.addControl('hostName', new FormControl(this.serverSettings.hostName, [Validators.pattern(/^(http:|https:)+[^\s]+[\w]$/)]));
|
||||
this.settingsForm.addControl('onDeckProgressDays', new FormControl(this.serverSettings.onDeckProgressDays, [Validators.required]));
|
||||
this.settingsForm.addControl('onDeckUpdateDays', new FormControl(this.serverSettings.onDeckUpdateDays, [Validators.required]));
|
||||
|
||||
this.serverService.getServerInfo().subscribe(info => {
|
||||
if (info.isDocker) {
|
||||
|
@ -82,6 +81,9 @@ export class ManageSettingsComponent implements OnInit {
|
|||
this.settingsForm.get('enableFolderWatching')?.setValue(this.serverSettings.enableFolderWatching);
|
||||
this.settingsForm.get('encodeMediaAs')?.setValue(this.serverSettings.encodeMediaAs);
|
||||
this.settingsForm.get('hostName')?.setValue(this.serverSettings.hostName);
|
||||
this.settingsForm.get('cacheSize')?.setValue(this.serverSettings.cacheSize);
|
||||
this.settingsForm.get('onDeckProgressDays')?.setValue(this.serverSettings.onDeckProgressDays);
|
||||
this.settingsForm.get('onDeckUpdateDays')?.setValue(this.serverSettings.onDeckUpdateDays);
|
||||
this.settingsForm.markAsPristine();
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import { ToastrService } from 'ngx-toastr';
|
|||
import { take } from 'rxjs/operators';
|
||||
import { ServerService } from 'src/app/_services/server.service';
|
||||
import { SettingsService } from '../settings.service';
|
||||
import { ServerInfo } from '../_models/server-info';
|
||||
import {ServerInfoSlim} from '../_models/server-info';
|
||||
import { ServerSettings } from '../_models/server-settings';
|
||||
import { NgIf } from '@angular/common';
|
||||
|
||||
|
@ -19,7 +19,7 @@ export class ManageSystemComponent implements OnInit {
|
|||
|
||||
settingsForm: FormGroup = new FormGroup({});
|
||||
serverSettings!: ServerSettings;
|
||||
serverInfo!: ServerInfo;
|
||||
serverInfo!: ServerInfoSlim;
|
||||
|
||||
|
||||
constructor(private settingsService: SettingsService, private toastr: ToastrService,
|
||||
|
|
|
@ -60,6 +60,7 @@
|
|||
color: hsla(0,0%,100%,.7);
|
||||
height: 25px;
|
||||
text-align: center;
|
||||
padding: 0px 5px;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
background: none;
|
||||
border: 0;
|
||||
|
@ -68,7 +69,6 @@
|
|||
line-height: inherit;
|
||||
margin: 0;
|
||||
outline: none;
|
||||
padding: 0;
|
||||
text-align: inherit;
|
||||
text-decoration: none;
|
||||
touch-action: manipulation;
|
||||
|
|
|
@ -94,5 +94,14 @@
|
|||
</app-icon-and-title>
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
<ng-container *ngIf="(chapter.lastReadingProgress | date: 'shortDate') !== '1/1/01'">
|
||||
<div class="vr d-none d-lg-block m-2"></div>
|
||||
<div class="col-auto">
|
||||
<app-icon-and-title label="Last Read" [clickable]="false" fontClasses="fa-regular fa-clock" [ngbTooltip]="chapter.lastReadingProgress | date: 'medium'">
|
||||
{{chapter.lastReadingProgress | date: 'shortDate'}}
|
||||
</app-icon-and-title>
|
||||
</div>
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
</div>
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnDestroy, OnInit, inject } from '@angular/core';
|
||||
import { Subject } from 'rxjs';
|
||||
import {
|
||||
ChangeDetectionStrategy,
|
||||
ChangeDetectorRef,
|
||||
Component,
|
||||
Input,
|
||||
OnInit,
|
||||
inject,
|
||||
} from '@angular/core';
|
||||
import { UtilityService } from 'src/app/shared/_services/utility.service';
|
||||
import { Chapter } from 'src/app/_models/chapter';
|
||||
import { ChapterMetadata } from 'src/app/_models/metadata/chapter-metadata';
|
||||
|
@ -17,16 +23,17 @@ import {DefaultDatePipe} from "../../pipe/default-date.pipe";
|
|||
import {BytesPipe} from "../../pipe/bytes.pipe";
|
||||
import {CompactNumberPipe} from "../../pipe/compact-number.pipe";
|
||||
import {AgeRatingPipe} from "../../pipe/age-rating.pipe";
|
||||
import {NgbTooltip} from "@ng-bootstrap/ng-bootstrap";
|
||||
|
||||
@Component({
|
||||
selector: 'app-entity-info-cards',
|
||||
standalone: true,
|
||||
imports: [CommonModule, IconAndTitleComponent, SafeHtmlPipe, DefaultDatePipe, BytesPipe, CompactNumberPipe, AgeRatingPipe],
|
||||
imports: [CommonModule, IconAndTitleComponent, SafeHtmlPipe, DefaultDatePipe, BytesPipe, CompactNumberPipe, AgeRatingPipe, NgbTooltip],
|
||||
templateUrl: './entity-info-cards.component.html',
|
||||
styleUrls: ['./entity-info-cards.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
})
|
||||
export class EntityInfoCardsComponent implements OnInit, OnDestroy {
|
||||
export class EntityInfoCardsComponent implements OnInit {
|
||||
|
||||
@Input({required: true}) entity!: Volume | Chapter;
|
||||
/**
|
||||
|
@ -49,7 +56,6 @@ export class EntityInfoCardsComponent implements OnInit, OnDestroy {
|
|||
readingTime: HourEstimateRange = {maxHours: 1, minHours: 1, avgHours: 1};
|
||||
size: number = 0;
|
||||
|
||||
private readonly onDestroy: Subject<void> = new Subject();
|
||||
imageService = inject(ImageService);
|
||||
|
||||
get LibraryType() {
|
||||
|
@ -69,6 +75,8 @@ export class EntityInfoCardsComponent implements OnInit, OnDestroy {
|
|||
return this.chapter.webLinks.split(',');
|
||||
}
|
||||
|
||||
|
||||
|
||||
constructor(private utilityService: UtilityService, private seriesService: SeriesService, private readonly cdRef: ChangeDetectorRef) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
|
@ -119,8 +127,8 @@ export class EntityInfoCardsComponent implements OnInit, OnDestroy {
|
|||
this.cdRef.markForCheck();
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
this.onDestroy.next();
|
||||
this.onDestroy.complete();
|
||||
getTimezone(timezone: string): string {
|
||||
const localDate = new Date(timezone);
|
||||
return localDate.toLocaleString('en-US', { timeZoneName: 'short' }).split(' ')[3];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,19 +8,20 @@ import {
|
|||
OnInit,
|
||||
Output
|
||||
} from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { ToastrService } from 'ngx-toastr';
|
||||
import { Series } from 'src/app/_models/series';
|
||||
import { ImageService } from 'src/app/_services/image.service';
|
||||
import { ActionFactoryService, Action, ActionItem } from 'src/app/_services/action-factory.service';
|
||||
import { SeriesService } from 'src/app/_services/series.service';
|
||||
import { ActionService } from 'src/app/_services/action.service';
|
||||
import { EditSeriesModalComponent } from '../_modals/edit-series-modal/edit-series-modal.component';
|
||||
import { RelationKind } from 'src/app/_models/series-detail/relation-kind';
|
||||
import {Router} from '@angular/router';
|
||||
import {NgbModal} from '@ng-bootstrap/ng-bootstrap';
|
||||
import {ToastrService} from 'ngx-toastr';
|
||||
import {Series} from 'src/app/_models/series';
|
||||
import {ImageService} from 'src/app/_services/image.service';
|
||||
import {Action, ActionFactoryService, ActionItem} from 'src/app/_services/action-factory.service';
|
||||
import {SeriesService} from 'src/app/_services/series.service';
|
||||
import {ActionService} from 'src/app/_services/action.service';
|
||||
import {EditSeriesModalComponent} from '../_modals/edit-series-modal/edit-series-modal.component';
|
||||
import {RelationKind} from 'src/app/_models/series-detail/relation-kind';
|
||||
import {CommonModule} from "@angular/common";
|
||||
import {CardItemComponent} from "../card-item/card-item.component";
|
||||
import {RelationshipPipe} from "../../pipe/relationship.pipe";
|
||||
import {Device} from "../../_models/device/device";
|
||||
|
||||
@Component({
|
||||
selector: 'app-series-card',
|
||||
|
@ -46,6 +47,10 @@ export class SeriesCardComponent implements OnInit, OnChanges {
|
|||
* If the Series has a relationship to display
|
||||
*/
|
||||
@Input() relation: RelationKind | undefined = undefined;
|
||||
/**
|
||||
* When a series card is shown on deck, a special actionable is added to the list
|
||||
*/
|
||||
@Input() isOnDeck: boolean = false;
|
||||
|
||||
@Output() clicked = new EventEmitter<Series>();
|
||||
/**
|
||||
|
@ -78,6 +83,19 @@ export class SeriesCardComponent implements OnInit, OnChanges {
|
|||
ngOnChanges(changes: any) {
|
||||
if (this.data) {
|
||||
this.actions = this.actionFactoryService.getSeriesActions((action: ActionItem<Series>, series: Series) => this.handleSeriesActionCallback(action, series));
|
||||
if (this.isOnDeck) {
|
||||
const othersIndex = this.actions.findIndex(obj => obj.title === 'Others');
|
||||
if (this.actions[othersIndex].children.findIndex(o => o.action === Action.RemoveFromOnDeck) < 0) {
|
||||
this.actions[othersIndex].children.push({
|
||||
action: Action.RemoveFromOnDeck,
|
||||
title: 'Remove From On Deck',
|
||||
callback: (action: ActionItem<Series>, series: Series) => this.handleSeriesActionCallback(action, series),
|
||||
class: 'danger',
|
||||
requiresAdmin: false,
|
||||
children: [],
|
||||
});
|
||||
}
|
||||
}
|
||||
this.cdRef.markForCheck();
|
||||
}
|
||||
}
|
||||
|
@ -120,6 +138,13 @@ export class SeriesCardComponent implements OnInit, OnChanges {
|
|||
case (Action.AnalyzeFiles):
|
||||
this.actionService.analyzeFilesForSeries(series);
|
||||
break;
|
||||
case Action.SendTo:
|
||||
const device = (action._extra!.data as Device);
|
||||
this.actionService.sendSeriesToDevice(series.id, device);
|
||||
break;
|
||||
case Action.RemoveFromOnDeck:
|
||||
this.seriesService.removeFromOnDeck(series.id).subscribe(() => this.reload.emit(series.id));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -15,7 +15,8 @@
|
|||
|
||||
<app-carousel-reel [items]="inProgress" title="On Deck" (sectionClick)="handleSectionClick($event)">
|
||||
<ng-template #carouselItem let-item let-position="idx">
|
||||
<app-series-card [data]="item" [libraryId]="item.libraryId" [suppressLibraryLink]="libraryId !== 0" (reload)="reloadInProgress(item)" (dataChanged)="reloadInProgress($event)"></app-series-card>
|
||||
<app-series-card [data]="item" [libraryId]="item.libraryId" [suppressLibraryLink]="libraryId !== 0" [isOnDeck]="true"
|
||||
(reload)="reloadInProgress($event)" (dataChanged)="reloadInProgress($event)"></app-series-card>
|
||||
</ng-template>
|
||||
</app-carousel-reel>
|
||||
|
||||
|
|
|
@ -120,16 +120,7 @@ export class DashboardComponent implements OnInit {
|
|||
this.loadRecentlyAddedSeries();
|
||||
}
|
||||
|
||||
reloadInProgress(series: Series | boolean) {
|
||||
if (series === true || series === false) {
|
||||
if (!series) {return;}
|
||||
}
|
||||
// If the update to Series doesn't affect the requirement to be in this stream, then ignore update request
|
||||
const seriesObj = (series as Series);
|
||||
if (seriesObj.pagesRead !== seriesObj.pages && seriesObj.pagesRead !== 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
reloadInProgress(series: Series | number) {
|
||||
this.loadOnDeck();
|
||||
}
|
||||
|
||||
|
|
|
@ -5,13 +5,11 @@ import {
|
|||
EventEmitter,
|
||||
HostListener,
|
||||
inject,
|
||||
OnDestroy,
|
||||
OnInit
|
||||
} from '@angular/core';
|
||||
import { Title } from '@angular/platform-browser';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { Subject } from 'rxjs';
|
||||
import { debounceTime, take, takeUntil } from 'rxjs/operators';
|
||||
import { take } from 'rxjs/operators';
|
||||
import { BulkSelectionService } from '../cards/bulk-selection.service';
|
||||
import { KEY_CODES, UtilityService } from '../shared/_services/utility.service';
|
||||
import { SeriesAddedEvent } from '../_models/events/series-added-event';
|
||||
|
@ -39,6 +37,7 @@ import { NgFor, NgIf, DecimalPipe } from '@angular/common';
|
|||
import { NgbNav, NgbNavItem, NgbNavItemRole, NgbNavLink, NgbNavContent, NgbNavOutlet } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { CardActionablesComponent } from '../cards/card-item/card-actionables/card-actionables.component';
|
||||
import { SideNavCompanionBarComponent } from '../sidenav/_components/side-nav-companion-bar/side-nav-companion-bar.component';
|
||||
import {Device} from "../_models/device/device";
|
||||
|
||||
@Component({
|
||||
selector: 'app-library-detail',
|
||||
|
@ -234,6 +233,8 @@ export class LibraryDetailComponent implements OnInit {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
performAction(action: ActionItem<any>) {
|
||||
if (typeof action.callback === 'function') {
|
||||
action.callback(action, undefined);
|
||||
|
|
|
@ -329,14 +329,14 @@
|
|||
<form [formGroup]="releaseYearRange" class="d-flex justify-content-between">
|
||||
<div class="mb-3">
|
||||
<label for="release-year-min" class="form-label">Release</label>
|
||||
<input type="text" id="release-year-min" formControlName="min" class="form-control" style="width: 62px" placeholder="Min" (keyup.enter)="apply()">
|
||||
<input type="number" id="release-year-min" formControlName="min" class="form-control custom-number" style="width: 62px" placeholder="Min" (keyup.enter)="apply()">
|
||||
</div>
|
||||
<div style="margin-top: 37px !important;">
|
||||
<i class="fa-solid fa-minus" aria-hidden="true"></i>
|
||||
</div>
|
||||
<div class="mb-3" style="margin-top: 0.5rem">
|
||||
<label for="release-year-max" class="form-label"><span class="visually-hidden">Max</span></label>
|
||||
<input type="text" id="release-year-max" formControlName="max" class="form-control" style="width: 62px" placeholder="Max" (keyup.enter)="apply()">
|
||||
<input type="number" id="release-year-max" formControlName="max" class="form-control custom-number" style="width: 62px" placeholder="Max" (keyup.enter)="apply()">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
/* Works for Chrome, Safari, Edge, Opera */
|
||||
input::-webkit-outer-spin-button,
|
||||
input::-webkit-inner-spin-button {
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* Works for Firefox */
|
||||
input[type="number"] {
|
||||
-moz-appearance: textfield;
|
||||
}
|
||||
|
|
@ -137,8 +137,8 @@ export class MetadataFilterComponent implements OnInit {
|
|||
});
|
||||
|
||||
this.releaseYearRange = new FormGroup({
|
||||
min: new FormControl({value: undefined, disabled: this.filterSettings.releaseYearDisabled}, [Validators.min(1000), Validators.max(9999)]),
|
||||
max: new FormControl({value: undefined, disabled: this.filterSettings.releaseYearDisabled}, [Validators.min(1000), Validators.max(9999)])
|
||||
min: new FormControl({value: undefined, disabled: this.filterSettings.releaseYearDisabled}, [Validators.min(1000), Validators.max(9999), Validators.maxLength(4), Validators.minLength(4)]),
|
||||
max: new FormControl({value: undefined, disabled: this.filterSettings.releaseYearDisabled}, [Validators.min(1000), Validators.max(9999), Validators.maxLength(4), Validators.minLength(4)])
|
||||
});
|
||||
|
||||
this.readProgressGroup.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(changes => {
|
||||
|
|
|
@ -13,6 +13,8 @@ export class ProviderImagePipe implements PipeTransform {
|
|||
return 'assets/images/ExternalServices/AniList.png';
|
||||
case ScrobbleProvider.Mal:
|
||||
return 'assets/images/ExternalServices/MAL.png';
|
||||
case ScrobbleProvider.Kavita:
|
||||
return 'assets/images/logo-32.png';
|
||||
}
|
||||
|
||||
return '';
|
||||
|
|
23
UI/Web/src/app/pipe/provider-name.pipe.ts
Normal file
23
UI/Web/src/app/pipe/provider-name.pipe.ts
Normal file
|
@ -0,0 +1,23 @@
|
|||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
import {ScrobbleProvider} from "../_services/scrobbling.service";
|
||||
|
||||
@Pipe({
|
||||
name: 'providerName',
|
||||
standalone: true
|
||||
})
|
||||
export class ProviderNamePipe implements PipeTransform {
|
||||
|
||||
transform(value: ScrobbleProvider): string {
|
||||
switch (value) {
|
||||
case ScrobbleProvider.AniList:
|
||||
return 'AniList';
|
||||
case ScrobbleProvider.Mal:
|
||||
return 'MAL';
|
||||
case ScrobbleProvider.Kavita:
|
||||
return 'Kavita';
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
}
|
|
@ -1,13 +1,16 @@
|
|||
<div class="row">
|
||||
<div class="col-auto custom-col" style="cursor: pointer" [ngbPopover]="popContent"
|
||||
popoverTitle="Series Rating">
|
||||
<div class="col-auto custom-col clickable" [ngbPopover]="popContent"
|
||||
popoverTitle="Your Rating + Overall" popoverClass="md-popover">
|
||||
<span class="badge rounded-pill me-1">
|
||||
<img class="me-1" ngSrc="assets/images/logo-32.png" width="24" height="24" alt="">
|
||||
{{userRating * 20}}%
|
||||
{{userRating * 20}}
|
||||
<ng-container *ngIf="overallRating > 0; else noOverallRating"> + {{overallRating}}%</ng-container>
|
||||
<ng-template #noOverallRating>%</ng-template>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="col-auto custom-col" *ngFor="let rating of ratings">
|
||||
<div class="col-auto custom-col clickable" *ngFor="let rating of ratings" [ngbPopover]="externalPopContent" [popoverContext]="{rating: rating}"
|
||||
[popoverTitle]="rating.provider | providerName" popoverClass="sm-popover">
|
||||
<span class="badge rounded-pill me-1">
|
||||
<img class="me-1" [ngSrc]="rating.provider | providerImage" width="24" height="24" alt="">
|
||||
{{rating.averageScore}}%
|
||||
|
@ -23,5 +26,9 @@
|
|||
<ng-template let-fill="fill" let-index="index">
|
||||
<span class="star" [class.filled]="(index < userRating) && userRating > 0">★</span>
|
||||
</ng-template>
|
||||
</ngb-rating>
|
||||
</ngb-rating> {{userRating * 20}}%
|
||||
</ng-template>
|
||||
|
||||
<ng-template #externalPopContent let-rating="rating">
|
||||
<i class="fa-solid fa-heart" aria-hidden="true"></i> {{rating.favoriteCount}}
|
||||
</ng-template>
|
||||
|
|
|
@ -2,3 +2,21 @@
|
|||
padding-left: 0px;
|
||||
padding-right: 0px;
|
||||
}
|
||||
|
||||
.sm-popover {
|
||||
width: 150px;
|
||||
|
||||
> .popover-body {
|
||||
padding-top: 0px;
|
||||
}
|
||||
}
|
||||
|
||||
.md-popover {
|
||||
width: 214px;
|
||||
|
||||
> .popover-body {
|
||||
padding-top: 0px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,12 @@
|
|||
import {ChangeDetectionStrategy, ChangeDetectorRef, Component, inject, Input, OnInit} from '@angular/core';
|
||||
import {
|
||||
ChangeDetectionStrategy,
|
||||
ChangeDetectorRef,
|
||||
Component,
|
||||
inject,
|
||||
Input,
|
||||
OnInit,
|
||||
ViewEncapsulation
|
||||
} from '@angular/core';
|
||||
import {CommonModule, NgOptimizedImage} from '@angular/common';
|
||||
import {SeriesService} from "../../../_services/series.service";
|
||||
import {Rating} from "../../../_models/rating";
|
||||
|
@ -7,14 +15,16 @@ import {NgbPopover, NgbRating} from "@ng-bootstrap/ng-bootstrap";
|
|||
import {LoadingComponent} from "../../../shared/loading/loading.component";
|
||||
import {AccountService} from "../../../_services/account.service";
|
||||
import {LibraryType} from "../../../_models/library";
|
||||
import {ProviderNamePipe} from "../../../pipe/provider-name.pipe";
|
||||
|
||||
@Component({
|
||||
selector: 'app-external-rating',
|
||||
standalone: true,
|
||||
imports: [CommonModule, ProviderImagePipe, NgOptimizedImage, NgbRating, NgbPopover, LoadingComponent],
|
||||
imports: [CommonModule, ProviderImagePipe, NgOptimizedImage, NgbRating, NgbPopover, LoadingComponent, ProviderNamePipe],
|
||||
templateUrl: './external-rating.component.html',
|
||||
styleUrls: ['./external-rating.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class ExternalRatingComponent implements OnInit {
|
||||
@Input({required: true}) seriesId!: number;
|
||||
|
@ -26,10 +36,13 @@ export class ExternalRatingComponent implements OnInit {
|
|||
|
||||
ratings: Array<Rating> = [];
|
||||
isLoading: boolean = false;
|
||||
overallRating: number = -1;
|
||||
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
this.seriesService.getOverallRating(this.seriesId).subscribe(r => this.overallRating = r.averageScore);
|
||||
|
||||
this.accountService.hasValidLicense$.subscribe((res) => {
|
||||
if (!res) return;
|
||||
this.isLoading = true;
|
||||
|
|
|
@ -22,8 +22,6 @@ export class ChangeEmailComponent implements OnInit {
|
|||
|
||||
form: FormGroup = new FormGroup({});
|
||||
user: User | undefined = undefined;
|
||||
hasChangePasswordAbility: Observable<boolean> = of(false);
|
||||
passwordsMatch = false;
|
||||
errors: string[] = [];
|
||||
isViewMode: boolean = true;
|
||||
emailLink: string = '';
|
||||
|
|
|
@ -6,7 +6,7 @@ export const environment = {
|
|||
production: false,
|
||||
apiUrl: 'http://localhost:5000/api/',
|
||||
hubUrl: 'http://localhost:5000/hubs/',
|
||||
buyLink: 'https://buy.stripe.com/test_8wM4ie2dg5j77o4cMO?prefilled_promo_code=FREETRIAL',
|
||||
buyLink: 'https://buy.stripe.com/test_9AQ5mi058h1PcIo3cf?prefilled_promo_code=FREETRIAL',
|
||||
manageLink: 'https://billing.stripe.com/p/login/test_14kfZocuh6Tz5ag7ss'
|
||||
};
|
||||
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
.nav {
|
||||
--bs-nav-link-disabled-color: rgb(154 187 219 / 75%);
|
||||
}
|
||||
|
||||
.nav-link {
|
||||
color: var(--nav-link-text-color);
|
||||
|
||||
|
|
185
openapi.json
185
openapi.json
|
@ -7,7 +7,7 @@
|
|||
"name": "GPL-3.0",
|
||||
"url": "https://github.com/Kareadita/Kavita/blob/develop/LICENSE"
|
||||
},
|
||||
"version": "0.7.4.0"
|
||||
"version": "0.7.4.5"
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
|
@ -1643,6 +1643,37 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"/api/Device/send-series-to": {
|
||||
"post": {
|
||||
"tags": [
|
||||
"Device"
|
||||
],
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/SendSeriesToDeviceDto"
|
||||
}
|
||||
},
|
||||
"text/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/SendSeriesToDeviceDto"
|
||||
}
|
||||
},
|
||||
"application/*+json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/SendSeriesToDeviceDto"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Success"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/Download/volume-size": {
|
||||
"get": {
|
||||
"tags": [
|
||||
|
@ -2796,7 +2827,7 @@
|
|||
"tags": [
|
||||
"License"
|
||||
],
|
||||
"summary": "Updates server license. Returns true if updated and valid",
|
||||
"summary": "Updates server license",
|
||||
"description": "Caches the result",
|
||||
"requestBody": {
|
||||
"content": {
|
||||
|
@ -3916,6 +3947,45 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"/api/Rating/overall": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"Rating"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"name": "seriesId",
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Success",
|
||||
"content": {
|
||||
"text/plain": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/RatingDto"
|
||||
}
|
||||
},
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/RatingDto"
|
||||
}
|
||||
},
|
||||
"text/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/RatingDto"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/Reader/pdf": {
|
||||
"get": {
|
||||
"tags": [
|
||||
|
@ -6494,9 +6564,12 @@
|
|||
"in": "query",
|
||||
"schema": {
|
||||
"enum": [
|
||||
1
|
||||
0,
|
||||
1,
|
||||
2
|
||||
],
|
||||
"type": "integer",
|
||||
"description": "Misleading name but is the source of data (like a review coming from AniList)",
|
||||
"format": "int32"
|
||||
}
|
||||
}
|
||||
|
@ -7676,6 +7749,30 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"/api/Series/remove-from-on-deck": {
|
||||
"post": {
|
||||
"tags": [
|
||||
"Series"
|
||||
],
|
||||
"summary": "Removes a series from displaying on deck until the next read event on that series",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "seriesId",
|
||||
"in": "query",
|
||||
"description": "",
|
||||
"schema": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Success"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/Series/refresh-metadata": {
|
||||
"post": {
|
||||
"tags": [
|
||||
|
@ -8287,6 +8384,37 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"/api/Server/server-info-slim": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"Server"
|
||||
],
|
||||
"summary": "Returns non-sensitive information about the current system",
|
||||
"description": "This is just for the UI and is extremly lightweight",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Success",
|
||||
"content": {
|
||||
"text/plain": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ServerInfoDto"
|
||||
}
|
||||
},
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ServerInfoDto"
|
||||
}
|
||||
},
|
||||
"text/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ServerInfoDto"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/Server/convert-media": {
|
||||
"post": {
|
||||
"tags": [
|
||||
|
@ -8509,7 +8637,7 @@
|
|||
"tags": [
|
||||
"Server"
|
||||
],
|
||||
"summary": "Bust Review and Recommendation Cache",
|
||||
"summary": "Bust Kavita+ Cache",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Success"
|
||||
|
@ -11643,6 +11771,11 @@
|
|||
"description": "The last time a chapter was read by current authenticated user",
|
||||
"format": "date-time"
|
||||
},
|
||||
"lastReadingProgress": {
|
||||
"type": "string",
|
||||
"description": "The last time a chapter was read by current authenticated user",
|
||||
"format": "date-time"
|
||||
},
|
||||
"coverImageLocked": {
|
||||
"type": "boolean",
|
||||
"description": "If the Cover Image is locked for this entity"
|
||||
|
@ -13700,9 +13833,12 @@
|
|||
},
|
||||
"provider": {
|
||||
"enum": [
|
||||
1
|
||||
0,
|
||||
1,
|
||||
2
|
||||
],
|
||||
"type": "integer",
|
||||
"description": "Misleading name but is the source of data (like a review coming from AniList)",
|
||||
"format": "int32"
|
||||
}
|
||||
},
|
||||
|
@ -14650,6 +14786,20 @@
|
|||
"additionalProperties": false,
|
||||
"description": "Represents all Search results for a query"
|
||||
},
|
||||
"SendSeriesToDeviceDto": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"deviceId": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"seriesId": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"SendToDeviceDto": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
@ -15782,6 +15932,21 @@
|
|||
"type": "string",
|
||||
"description": "The Host name (ie Reverse proxy domain name) for the server",
|
||||
"nullable": true
|
||||
},
|
||||
"cacheSize": {
|
||||
"type": "integer",
|
||||
"description": "The size in MB for Caching API data",
|
||||
"format": "int64"
|
||||
},
|
||||
"onDeckProgressDays": {
|
||||
"type": "integer",
|
||||
"description": "How many Days since today in the past for reading progress, should content be considered for On Deck, before it gets removed automatically",
|
||||
"format": "int32"
|
||||
},
|
||||
"onDeckUpdateDays": {
|
||||
"type": "integer",
|
||||
"description": "How many Days since today in the past for chapter updates, should content be considered for On Deck, before it gets removed automatically",
|
||||
"format": "int32"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
|
@ -17130,6 +17295,16 @@
|
|||
"type": "string",
|
||||
"description": "The main body with just text, for review preview",
|
||||
"nullable": true
|
||||
},
|
||||
"provider": {
|
||||
"enum": [
|
||||
0,
|
||||
1,
|
||||
2
|
||||
],
|
||||
"type": "integer",
|
||||
"description": "If this review is External, which Provider did it come from",
|
||||
"format": "int32"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue