HeanCms: Fix incorrect "Latest Manga" and some thumbnails not loading (#16108)

* Fixes

* Change function name

Co-authored-by: Alessandro Jean <14254807+alessandrojean@users.noreply.github.com>

* Change function name

---------

Co-authored-by: Alessandro Jean <14254807+alessandrojean@users.noreply.github.com>
This commit is contained in:
seew3l 2023-04-19 14:20:30 -05:00 committed by GitHub
parent 51d36e0cf0
commit 459019803e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 6 deletions

View File

@ -57,6 +57,7 @@ abstract class HeanCms(
orderBy = "total_views",
status = "Ongoing",
type = "Comic",
tagIds = emptyList(),
)
val payload = json.encodeToString(payloadObj).toRequestBody(JSON_MEDIA_TYPE)
@ -96,6 +97,7 @@ abstract class HeanCms(
orderBy = "latest",
status = "Ongoing",
type = "Comic",
tagIds = emptyList(),
)
val payload = json.encodeToString(payloadObj).toRequestBody(JSON_MEDIA_TYPE)
@ -325,8 +327,8 @@ abstract class HeanCms(
page = page,
order = "desc",
orderBy = "total_views",
status = "",
type = "Comic",
tagIds = emptyList(),
)
val payload = json.encodeToString(payloadObj).toRequestBody(JSON_MEDIA_TYPE)

View File

@ -41,7 +41,7 @@ data class HeanCmsSearchDto(
title = this@HeanCmsSearchDto.title
thumbnail_url = when {
thumbnailFileName.isNotEmpty() -> "$apiUrl/$coverPath$thumbnailFileName"
thumbnailFileName.isNotEmpty() -> createThumbnailUrl(apiUrl, coverPath, thumbnailFileName)
else -> ""
}
url = "/series/$slugOnly"
@ -75,12 +75,16 @@ data class HeanCmsSeriesDto(
genre = tags.orEmpty()
.sortedBy(HeanCmsTagDto::name)
.joinToString { it.name }
thumbnail_url = "$apiUrl/$coverPath$thumbnail"
thumbnail_url = createThumbnailUrl(apiUrl, coverPath, thumbnail)
status = this@HeanCmsSeriesDto.status?.toStatus() ?: SManga.UNKNOWN
url = "/series/${slug.replace(HeanCms.TIMESTAMP_REGEX, "")}"
}
}
private fun createThumbnailUrl(apiUrl: String, coverPath: String, thumbnail: String): String {
return if (thumbnail.startsWith("https://")) thumbnail else "$apiUrl/$coverPath$thumbnail"
}
@Serializable
data class HeanCmsTagDto(val name: String)
@ -116,9 +120,9 @@ data class HeanCmsQuerySearchPayloadDto(
val order: String,
val page: Int,
@SerialName("order_by") val orderBy: String,
@SerialName("series_status") val status: String,
@SerialName("series_status") val status: String? = null,
@SerialName("series_type") val type: String,
@SerialName("tags_ids") val tagIds: List<Int> = emptyList(),
@SerialName("tags_ids") val tagIds: List<Int>?,
)
@Serializable

View File

@ -9,7 +9,7 @@ class HeanCmsGenerator : ThemeSourceGenerator {
override val themeClass = "HeanCms"
override val baseVersionCode: Int = 10
override val baseVersionCode: Int = 11
override val sources = listOf(
SingleLang("Omega Scans", "https://omegascans.org", "en", isNsfw = true, overrideVersionCode = 16),