Komga: Update to extension-lib 1.4 (#15557)
* Komga: Update to extension-lib 1.4 * Simplify OkHttp responses
This commit is contained in:
parent
52d39a63be
commit
dcb8be1157
|
@ -1,3 +1,12 @@
|
||||||
|
## 1.4.46
|
||||||
|
|
||||||
|
Minimum Komga version required: `0.151.0`
|
||||||
|
|
||||||
|
### Feat
|
||||||
|
|
||||||
|
* Update to extension-lib 1.4
|
||||||
|
- Clicking on chapter WebView should now open the chapter/book page.
|
||||||
|
|
||||||
## 1.3.45
|
## 1.3.45
|
||||||
|
|
||||||
Minimum Komga version required: `0.151.0`
|
Minimum Komga version required: `0.151.0`
|
||||||
|
|
|
@ -6,7 +6,7 @@ ext {
|
||||||
extName = 'Komga'
|
extName = 'Komga'
|
||||||
pkgNameSuffix = 'all.komga'
|
pkgNameSuffix = 'all.komga'
|
||||||
extClass = '.KomgaFactory'
|
extClass = '.KomgaFactory'
|
||||||
extVersionCode = 45
|
extVersionCode = 46
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
|
@ -243,6 +243,10 @@ open class Komga(private val suffix: String = "") : ConfigurableSource, Unmetere
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun getMangaUrl(manga: SManga) = manga.url.replace("/api/v1", "")
|
||||||
|
|
||||||
|
override fun getChapterUrl(chapter: SChapter) = chapter.url.replace("/api/v1/books", "/book")
|
||||||
|
|
||||||
private fun processSeriesPage(response: Response): MangasPage {
|
private fun processSeriesPage(response: Response): MangasPage {
|
||||||
val responseBody = response.body
|
val responseBody = response.body
|
||||||
return responseBody.use { body ->
|
return responseBody.use { body ->
|
||||||
|
@ -525,12 +529,7 @@ open class Komga(private val suffix: String = "") : ConfigurableSource, Unmetere
|
||||||
client.newCall(GET("$baseUrl/api/v1/libraries", headers)).execute().use { response ->
|
client.newCall(GET("$baseUrl/api/v1/libraries", headers)).execute().use { response ->
|
||||||
libraries = try {
|
libraries = try {
|
||||||
val responseBody = response.body
|
val responseBody = response.body
|
||||||
if (responseBody != null) {
|
|
||||||
responseBody.use { json.decodeFromString(it.string()) }
|
responseBody.use { json.decodeFromString(it.string()) }
|
||||||
} else {
|
|
||||||
Log.e(LOG_TAG, "error while decoding JSON for libraries filter: response body is null. Response code: ${response.code}")
|
|
||||||
emptyList()
|
|
||||||
}
|
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Log.e(LOG_TAG, "error while decoding JSON for libraries filter", e)
|
Log.e(LOG_TAG, "error while decoding JSON for libraries filter", e)
|
||||||
emptyList()
|
emptyList()
|
||||||
|
@ -544,12 +543,7 @@ open class Komga(private val suffix: String = "") : ConfigurableSource, Unmetere
|
||||||
client.newCall(GET("$baseUrl/api/v1/collections?unpaged=true", headers)).execute().use { response ->
|
client.newCall(GET("$baseUrl/api/v1/collections?unpaged=true", headers)).execute().use { response ->
|
||||||
collections = try {
|
collections = try {
|
||||||
val responseBody = response.body
|
val responseBody = response.body
|
||||||
if (responseBody != null) {
|
|
||||||
responseBody.use { json.decodeFromString<PageWrapperDto<CollectionDto>>(it.string()).content }
|
responseBody.use { json.decodeFromString<PageWrapperDto<CollectionDto>>(it.string()).content }
|
||||||
} else {
|
|
||||||
Log.e(LOG_TAG, "error while decoding JSON for collections filter: response body is null. Response code: ${response.code}")
|
|
||||||
emptyList()
|
|
||||||
}
|
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Log.e(LOG_TAG, "error while decoding JSON for collections filter", e)
|
Log.e(LOG_TAG, "error while decoding JSON for collections filter", e)
|
||||||
emptyList()
|
emptyList()
|
||||||
|
@ -563,12 +557,7 @@ open class Komga(private val suffix: String = "") : ConfigurableSource, Unmetere
|
||||||
client.newCall(GET("$baseUrl/api/v1/genres", headers)).execute().use { response ->
|
client.newCall(GET("$baseUrl/api/v1/genres", headers)).execute().use { response ->
|
||||||
genres = try {
|
genres = try {
|
||||||
val responseBody = response.body
|
val responseBody = response.body
|
||||||
if (responseBody != null) {
|
|
||||||
responseBody.use { json.decodeFromString(it.string()) }
|
responseBody.use { json.decodeFromString(it.string()) }
|
||||||
} else {
|
|
||||||
Log.e(LOG_TAG, "error while decoding JSON for genres filter: response body is null. Response code: ${response.code}")
|
|
||||||
emptySet()
|
|
||||||
}
|
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Log.e(LOG_TAG, "error while decoding JSON for genres filter", e)
|
Log.e(LOG_TAG, "error while decoding JSON for genres filter", e)
|
||||||
emptySet()
|
emptySet()
|
||||||
|
|
Loading…
Reference in New Issue