Adding masonry cover images to login page
- Added new public api: /api/Image/random-series-cover - Updated login bg color to black - If no cover images, use the default library background (for new installs) - Added a cover masonry component - updated the splash container
This commit is contained in:
parent
5c5b0df814
commit
28c968ac4d
10 changed files with 322 additions and 15 deletions
|
|
@ -116,6 +116,7 @@ public interface ISeriesRepository
|
|||
/// <returns></returns>
|
||||
Task AddSeriesModifiers(int userId, IList<SeriesDto> series);
|
||||
Task<string?> GetSeriesCoverImageAsync(int seriesId);
|
||||
Task<string?> GetRandomSeriesCoverImageAsync();
|
||||
Task<PagedList<SeriesDto>> GetOnDeck(int userId, int libraryId, UserParams userParams, FilterDto? filter);
|
||||
Task<PagedList<SeriesDto>> GetRecentlyAdded(int libraryId, int userId, UserParams userParams, FilterDto filter);
|
||||
Task<PagedList<SeriesDto>> GetRecentlyAddedV2(int userId, UserParams userParams, FilterV2Dto filter);
|
||||
|
|
@ -183,6 +184,8 @@ public class SeriesRepository : ISeriesRepository
|
|||
private readonly Regex _yearRegex = new Regex(@"\d{4}", RegexOptions.Compiled,
|
||||
Services.Tasks.Scanner.Parser.Parser.RegexTimeout);
|
||||
|
||||
private static readonly Random _random = new Random();
|
||||
|
||||
public SeriesRepository(DataContext context, IMapper mapper, UserManager<AppUser> userManager)
|
||||
{
|
||||
_context = context;
|
||||
|
|
@ -780,6 +783,19 @@ public class SeriesRepository : ISeriesRepository
|
|||
.SingleOrDefaultAsync();
|
||||
}
|
||||
|
||||
public async Task<string?> GetRandomSeriesCoverImageAsync()
|
||||
{
|
||||
var count = await _context.Series.CountAsync();
|
||||
if (count == 0) return null;
|
||||
|
||||
var skip = _random.Next(0, count);
|
||||
|
||||
return await _context.Series
|
||||
.Skip(skip)
|
||||
.Select(s => s.CoverImage)
|
||||
.FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of Series that were added, ordered by Created desc
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue