mirror of
https://github.com/gotson/komga.git
synced 2025-12-16 13:33:49 +01:00
fix(api): properly set layout property in webpub manifest
This commit is contained in:
parent
117291170a
commit
e11ce465ad
2 changed files with 10 additions and 7 deletions
|
|
@ -136,7 +136,14 @@ class WebPubGenerator(
|
|||
return bookDto.toBasePublicationDto().let { publication ->
|
||||
publication.copy(
|
||||
mediaType = MEDIATYPE_WEBPUB_JSON,
|
||||
metadata = publication.metadata.withSeriesMetadata(seriesMetadata).copy(conformsTo = PROFILE_EPUB),
|
||||
metadata = publication.metadata.withSeriesMetadata(seriesMetadata).copy(
|
||||
conformsTo = PROFILE_EPUB,
|
||||
rendition = when (extension?.isFixedLayout) {
|
||||
true -> mapOf("layout" to "fixed")
|
||||
false -> mapOf("layout" to "reflowable")
|
||||
else -> emptyMap()
|
||||
},
|
||||
),
|
||||
readingOrder = media.files.filter { it.subType == MediaFile.SubType.EPUB_PAGE }.map {
|
||||
WPLinkDto(
|
||||
href = uriBuilder.cloneBuilder().path("books/${bookDto.id}/resource/").path(it.fileName).toUriString(),
|
||||
|
|
@ -152,11 +159,6 @@ class WebPubGenerator(
|
|||
toc = extension?.toc?.map { it.toWPLinkDto(uriBuilder.cloneBuilder().path("books/${bookDto.id}/resource/")) } ?: emptyList(),
|
||||
landmarks = extension?.landmarks?.map { it.toWPLinkDto(uriBuilder.cloneBuilder().path("books/${bookDto.id}/resource/")) } ?: emptyList(),
|
||||
pageList = extension?.pageList?.map { it.toWPLinkDto(uriBuilder.cloneBuilder().path("books/${bookDto.id}/resource/")) } ?: emptyList(),
|
||||
layout = when (extension?.isFixedLayout) {
|
||||
true -> "fixed"
|
||||
false -> "reflowable"
|
||||
else -> null
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ data class WPPublicationDto(
|
|||
val toc: List<WPLinkDto> = emptyList(),
|
||||
val landmarks: List<WPLinkDto> = emptyList(),
|
||||
val pageList: List<WPLinkDto> = emptyList(),
|
||||
val layout: String? = null,
|
||||
)
|
||||
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
|
|
@ -71,6 +70,8 @@ data class WPMetadataDto(
|
|||
@Positive
|
||||
val numberOfPages: Int? = null,
|
||||
val belongsTo: WPBelongsToDto? = null,
|
||||
// epub specific fields
|
||||
val rendition: Map<String, Any> = emptyMap(),
|
||||
)
|
||||
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
|
|
|
|||
Loading…
Reference in a new issue