mirror of
				https://github.com/Kareadita/Kavita.git
				synced 2025-10-31 10:37:04 -04:00 
			
		
		
		
	# Added - Added: Added series format information to the search typeahead to help identify duplicate series in libraries # Fixed - Fixed: Fixed accent color not looking well on light theme - Fixed: Attempted to fix the memory issues with PDF reading on Docker. Uses a Memory Pool for streams and removes a bitmap operation for fixing books with transparent backgrounds (#424) # Changed - Changed: Refactored download logs to use the same download code as rest of Kavita # Dev stuff - Added timeout for Regex's to make sure during matching, malicious filenames doesn't crash user system - Refactored a missing GetCoverImage to use Series Format rather than old Library Type ================================================== * Added Timeout for Regex matching to ensure malicious filenames don't crash system * Refactored GetCoverImage to use series format rather than library type * Refactored download logs to use the download service * Fixed accent color not looking well on light theme * Refactored series format into dedicated component and added to search results * Switch to using MemoryManager for Streams to attempt to minimize GC pressure and reduced bitmap manipulation for transparency hack.
		
			
				
	
	
		
			39 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| using System.Collections.Generic;
 | |
| using System.Linq;
 | |
| using API.Entities;
 | |
| using API.Entities.Enums;
 | |
| 
 | |
| namespace API.Extensions
 | |
| {
 | |
|     public static class VolumeListExtensions
 | |
|     {
 | |
|         public static Volume FirstWithChapters(this IList<Volume> volumes, bool inBookSeries)
 | |
|         {
 | |
|             return inBookSeries
 | |
|                 ? volumes.FirstOrDefault(v => v.Chapters.Any())
 | |
|                 : volumes.FirstOrDefault(v => v.Chapters.Any() && (v.Number == 1));
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// Selects the first Volume to get the cover image from. For a book with only a special, the special will be returned.
 | |
|         /// If there are both specials and non-specials, then the first non-special will be returned.
 | |
|         /// </summary>
 | |
|         /// <param name="volumes"></param>
 | |
|         /// <param name="seriesFormat"></param>
 | |
|         /// <returns></returns>
 | |
|         public static Volume GetCoverImage(this IList<Volume> volumes, MangaFormat seriesFormat)
 | |
|         {
 | |
|             if (seriesFormat is MangaFormat.Epub or MangaFormat.Pdf)
 | |
|             {
 | |
|                 return volumes.OrderBy(x => x.Number).FirstOrDefault();
 | |
|             }
 | |
| 
 | |
|             if (volumes.Any(x => x.Number != 0))
 | |
|             {
 | |
|                 return volumes.OrderBy(x => x.Number).FirstOrDefault(x => x.Number != 0);
 | |
|             }
 | |
|             return volumes.OrderBy(x => x.Number).FirstOrDefault();
 | |
|         }
 | |
|     }
 | |
| }
 |