Filtering Bugs + OPDS Want To Read (#2210)

* Fixed Summary not allowing an empty field, as it should allow that.

* Cleaned up some localization wording and put a todo for a bug with library filtering not working.

* Added Want to Read to OPDS stream

* Implemented the ability to disable adding filter rows for bookmarks page which only supports one filter type.

* Fixed the library filtering code

* Fixed a bunch of titles across the app. Fixed about system page not showing data quick enough.

* Hide API key by default and show a button to unhide. Fixed a styling issue with input group buttons.

* Fixed a hack to support zh_Hans language code to work for things like pt-br as well.

* Fixed transloco not supporting same language scheme as Weblate, but somehow needs all languages.

* Fixed the rating on series detail not being inline with other sections
This commit is contained in:
Joe Milazzo 2023-08-13 12:39:28 -05:00 committed by GitHub
parent f472745ae4
commit 59c7ef5aa5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 217 additions and 111 deletions

View file

@ -142,6 +142,19 @@ public class OpdsController : BaseApiController
}
});
feed.Entries.Add(new FeedEntry()
{
Id = "wantToRead",
Title = await _localizationService.Translate(userId, "want-to-read"),
Content = new FeedEntryContent()
{
Text = await _localizationService.Translate(userId, "browse-want-to-read")
},
Links = new List<FeedLink>()
{
CreateLink(FeedLinkRelation.SubSection, FeedLinkType.AtomNavigation, $"{prefix}{apiKey}/want-to-read"),
}
});
feed.Entries.Add(new FeedEntry()
{
Id = "allLibraries",
Title = await _localizationService.Translate(userId, "libraries"),
@ -213,6 +226,27 @@ public class OpdsController : BaseApiController
return CreateXmlResult(SerializeXml(feed));
}
[HttpGet("{apiKey}/want-to-read")]
[Produces("application/xml")]
public async Task<IActionResult> GetWantToRead(string apiKey, [FromQuery] int pageNumber = 0)
{
var userId = await GetUser(apiKey);
if (!(await _unitOfWork.SettingsRepository.GetSettingsDtoAsync()).EnableOpds)
return BadRequest(await _localizationService.Translate(userId, "opds-disabled"));
var (baseUrl, prefix) = await GetPrefix();
var wantToReadSeries = await _unitOfWork.SeriesRepository.GetWantToReadForUserV2Async(userId, GetUserParams(pageNumber), _filterV2Dto);
var seriesMetadatas = await _unitOfWork.SeriesRepository.GetSeriesMetadataForIds(wantToReadSeries.Select(s => s.Id));
var feed = CreateFeed(await _localizationService.Translate(userId, "want-to-read"), $"{apiKey}/want-to-read", apiKey, prefix);
SetFeedId(feed, $"want-to-read");
AddPagination(feed, wantToReadSeries, $"{prefix}{apiKey}/want-to-read");
feed.Entries.AddRange(wantToReadSeries.Select(seriesDto =>
CreateSeries(seriesDto, seriesMetadatas.First(s => s.SeriesId == seriesDto.Id), apiKey, prefix, baseUrl)));
return CreateXmlResult(SerializeXml(feed));
}
[HttpGet("{apiKey}/collections")]
[Produces("application/xml")]
public async Task<IActionResult> GetCollections(string apiKey)