mirror of
https://github.com/gotson/komga.git
synced 2025-12-22 00:13:30 +01:00
fix(swagger): correct response type for thumbnails and file
This commit is contained in:
parent
b07e9b9728
commit
07f634e658
2 changed files with 31 additions and 2 deletions
|
|
@ -5,6 +5,9 @@ import com.github.klinq.jpaspec.likeLower
|
|||
import com.github.klinq.jpaspec.toJoin
|
||||
import io.swagger.v3.oas.annotations.Operation
|
||||
import io.swagger.v3.oas.annotations.Parameter
|
||||
import io.swagger.v3.oas.annotations.media.Content
|
||||
import io.swagger.v3.oas.annotations.media.Schema
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse
|
||||
import mu.KotlinLogging
|
||||
import org.gotson.komga.application.service.AsyncOrchestrator
|
||||
import org.gotson.komga.application.service.BookLifecycle
|
||||
|
|
@ -181,6 +184,10 @@ class BookController(
|
|||
} ?: throw ResponseStatusException(HttpStatus.NOT_FOUND)
|
||||
|
||||
|
||||
@ApiResponse(content = [Content(
|
||||
mediaType = MediaType.IMAGE_JPEG_VALUE,
|
||||
schema = Schema(type = "string", format = "binary")
|
||||
)])
|
||||
@GetMapping(value = [
|
||||
"api/v1/books/{bookId}/thumbnail",
|
||||
"opds/v1.2/books/{bookId}/thumbnail"
|
||||
|
|
@ -199,11 +206,15 @@ class BookController(
|
|||
} ?: throw ResponseStatusException(HttpStatus.NOT_FOUND)
|
||||
|
||||
@Operation(description = "Download the book file.")
|
||||
@ApiResponse(content = [Content(
|
||||
mediaType = MediaType.APPLICATION_OCTET_STREAM_VALUE,
|
||||
schema = Schema(type = "string", format = "binary")
|
||||
)])
|
||||
@GetMapping(value = [
|
||||
"api/v1/books/{bookId}/file",
|
||||
"api/v1/books/{bookId}/file/*",
|
||||
"opds/v1.2/books/{bookId}/file/*"
|
||||
])
|
||||
], produces = [MediaType.APPLICATION_OCTET_STREAM_VALUE])
|
||||
fun getBookFile(
|
||||
@AuthenticationPrincipal principal: KomgaPrincipal,
|
||||
@PathVariable bookId: Long
|
||||
|
|
@ -242,6 +253,10 @@ class BookController(
|
|||
it.media.pages.mapIndexed { index, s -> PageDto(index + 1, s.fileName, s.mediaType) }
|
||||
} ?: throw ResponseStatusException(HttpStatus.NOT_FOUND)
|
||||
|
||||
@ApiResponse(content = [Content(
|
||||
mediaType = "image/*",
|
||||
schema = Schema(type = "string", format = "binary")
|
||||
)])
|
||||
@GetMapping(value = [
|
||||
"api/v1/books/{bookId}/pages/{pageNumber}",
|
||||
"opds/v1.2/books/{bookId}/pages/{pageNumber}"
|
||||
|
|
@ -290,7 +305,14 @@ class BookController(
|
|||
}
|
||||
} ?: throw ResponseStatusException(HttpStatus.NOT_FOUND)
|
||||
|
||||
@GetMapping("api/v1/books/{bookId}/pages/{pageNumber}/thumbnail")
|
||||
@ApiResponse(content = [Content(
|
||||
mediaType = MediaType.IMAGE_JPEG_VALUE,
|
||||
schema = Schema(type = "string", format = "binary")
|
||||
)])
|
||||
@GetMapping(
|
||||
value = ["api/v1/books/{bookId}/pages/{pageNumber}/thumbnail"],
|
||||
produces = [MediaType.IMAGE_JPEG_VALUE]
|
||||
)
|
||||
fun getBookPageThumbnail(
|
||||
@AuthenticationPrincipal principal: KomgaPrincipal,
|
||||
request: WebRequest,
|
||||
|
|
|
|||
|
|
@ -5,6 +5,9 @@ import com.github.klinq.jpaspec.likeLower
|
|||
import com.github.klinq.jpaspec.toJoin
|
||||
import io.swagger.v3.oas.annotations.Operation
|
||||
import io.swagger.v3.oas.annotations.Parameter
|
||||
import io.swagger.v3.oas.annotations.media.Content
|
||||
import io.swagger.v3.oas.annotations.media.Schema
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse
|
||||
import mu.KotlinLogging
|
||||
import org.gotson.komga.application.service.AsyncOrchestrator
|
||||
import org.gotson.komga.domain.model.Library
|
||||
|
|
@ -173,6 +176,10 @@ class SeriesController(
|
|||
it.toDto(includeUrl = principal.user.isAdmin())
|
||||
} ?: throw ResponseStatusException(HttpStatus.NOT_FOUND)
|
||||
|
||||
@ApiResponse(content = [Content(
|
||||
mediaType = MediaType.IMAGE_JPEG_VALUE,
|
||||
schema = Schema(type = "string", format = "binary")
|
||||
)])
|
||||
@GetMapping(value = ["{seriesId}/thumbnail"], produces = [MediaType.IMAGE_JPEG_VALUE])
|
||||
fun getSeriesThumbnail(
|
||||
@AuthenticationPrincipal principal: KomgaPrincipal,
|
||||
|
|
|
|||
Loading…
Reference in a new issue