[CuuTruyen] Make cover URLs nullable (#15084)
* [CuuTruyen] Make cover URLs nullable * bump * final newline
This commit is contained in:
parent
731a406861
commit
c3f56aa521
|
@ -6,7 +6,7 @@ ext {
|
|||
extName = 'Cứu Truyện'
|
||||
pkgNameSuffix = 'vi.cuutruyen'
|
||||
extClass = '.CuuTruyen'
|
||||
extVersionCode = 2
|
||||
extVersionCode = 3
|
||||
}
|
||||
|
||||
apply from: "$rootDir/common.gradle"
|
||||
apply from: "$rootDir/common.gradle"
|
||||
|
|
|
@ -25,7 +25,10 @@ class CuuTruyenImageInterceptor : Interceptor {
|
|||
override fun intercept(chain: Interceptor.Chain): Response {
|
||||
val response = chain.proceed(chain.request())
|
||||
|
||||
var drmData = chain.request().url.queryParameter(KEY) ?: return response
|
||||
if (response.request.url.fragment?.contains(KEY) != true) {
|
||||
return response
|
||||
}
|
||||
var drmData = response.request.url.fragment!!.substringAfter("$KEY=")
|
||||
drmData = drmData.replace("\n", "\\n")
|
||||
|
||||
val image = unscrambleImage(response.body!!.byteStream(), drmData)
|
||||
|
|
|
@ -52,9 +52,10 @@ data class PageDto(
|
|||
) {
|
||||
fun toPage(): Page {
|
||||
val dto = this@PageDto
|
||||
val url = imageUrl.toHttpUrl().newBuilder().apply {
|
||||
addQueryParameter(CuuTruyenImageInterceptor.KEY, dto.drmData)
|
||||
}.build().toString()
|
||||
val url = imageUrl.toHttpUrl().newBuilder()
|
||||
.fragment("${CuuTruyenImageInterceptor.KEY}=$drmData")
|
||||
.build()
|
||||
.toString()
|
||||
return Page(dto.order, imageUrl = url)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,11 +20,11 @@ data class TeamDto(
|
|||
data class MangaDto(
|
||||
val id: Int,
|
||||
val name: String,
|
||||
@SerialName("cover_url") val coverUrl: String,
|
||||
@SerialName("cover_mobile_url") val coverMobileUrl: String,
|
||||
@SerialName("cover_url") val coverUrl: String? = null,
|
||||
@SerialName("cover_mobile_url") val coverMobileUrl: String? = null,
|
||||
|
||||
val author: AuthorDto? = null,
|
||||
val author_name: String? = null,
|
||||
@SerialName("author_name") val authorName: String? = null,
|
||||
|
||||
val description: String? = null,
|
||||
val team: TeamDto? = null,
|
||||
|
@ -33,7 +33,7 @@ data class MangaDto(
|
|||
val dto = this@MangaDto
|
||||
url = "/mangas/${dto.id}"
|
||||
title = dto.name
|
||||
author = dto.author?.name ?: dto.author_name
|
||||
author = dto.author?.name ?: dto.authorName
|
||||
|
||||
description = ""
|
||||
if (dto.team != null) {
|
||||
|
|
Loading…
Reference in New Issue