request converted image from server if format is not supported (#1453)
This commit is contained in:
parent
ed870c659f
commit
926ba3c6ce
|
@ -5,7 +5,7 @@ ext {
|
||||||
appName = 'Tachiyomi: Komga'
|
appName = 'Tachiyomi: Komga'
|
||||||
pkgNameSuffix = 'all.komga'
|
pkgNameSuffix = 'all.komga'
|
||||||
extClass = '.Komga'
|
extClass = '.Komga'
|
||||||
extVersionCode = 1
|
extVersionCode = 2
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,12 @@ open class Komga : ConfigurableSource, HttpSource() {
|
||||||
override fun pageListParse(response: Response): List<Page> {
|
override fun pageListParse(response: Response): List<Page> {
|
||||||
val pages = gson.fromJson<List<PageDto>>(response.body()?.charStream()!!)
|
val pages = gson.fromJson<List<PageDto>>(response.body()?.charStream()!!)
|
||||||
return pages.map {
|
return pages.map {
|
||||||
val url = "${response.request().url()}/${it.number}"
|
val url = "${response.request().url()}/${it.number}" +
|
||||||
|
if (!supportedImageTypes.contains(it.mediaType)) {
|
||||||
|
"?convert=png"
|
||||||
|
} else {
|
||||||
|
""
|
||||||
|
}
|
||||||
Page(
|
Page(
|
||||||
index = it.number - 1,
|
index = it.number - 1,
|
||||||
imageUrl = url
|
imageUrl = url
|
||||||
|
@ -177,5 +182,7 @@ open class Komga : ConfigurableSource, HttpSource() {
|
||||||
private const val USERNAME_DEFAULT = ""
|
private const val USERNAME_DEFAULT = ""
|
||||||
private const val PASSWORD_TITLE = "Password"
|
private const val PASSWORD_TITLE = "Password"
|
||||||
private const val PASSWORD_DEFAULT = ""
|
private const val PASSWORD_DEFAULT = ""
|
||||||
|
|
||||||
|
private val supportedImageTypes = listOf("image/jpeg", "image/png", "image/gif", "image/webp")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,5 +20,6 @@ data class BookMetadataDto(
|
||||||
|
|
||||||
data class PageDto(
|
data class PageDto(
|
||||||
val number: Int,
|
val number: Int,
|
||||||
val fileName: String
|
val fileName: String,
|
||||||
|
val mediaType: String
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue