Jiangzaitoon: update domain, fix blurry thumbnails (#9815)

* Jiangzaitoon: update domain, fix blurry thumbnails

Madara was also updated to allow overriding `String.getSrcSetImage()`, not bumping.

* guard against malformed srcset candiate

* remove duplicate trim
This commit is contained in:
Vetle Ledaal 2025-07-28 12:42:08 +02:00 committed by Draff
parent 8361f4774f
commit e6b34e2b2d
Signed by: Draff
GPG Key ID: E8A89F3211677653
3 changed files with 27 additions and 4 deletions

View File

@ -788,7 +788,7 @@ abstract class Madara(
/**
* Get the best image quality available from srcset
*/
protected fun String.getSrcSetImage(): String? {
protected open fun String.getSrcSetImage(): String? {
return this.split(" ")
.filter(URL_REGEX::matches)
.maxOfOrNull(String::toString)

View File

@ -2,8 +2,8 @@ ext {
extName = 'Jiangzaitoon'
extClass = '.Jiangzaitoon'
themePkg = 'madara'
baseUrl = 'https://jiangzaitoon.wtf'
overrideVersionCode = 11
baseUrl = 'https://jiangzaitoon.lgbt'
overrideVersionCode = 12
isNsfw = true
}

View File

@ -8,7 +8,7 @@ import java.util.concurrent.TimeUnit
class Jiangzaitoon : Madara(
"Jiangzaitoon",
"https://jiangzaitoon.wtf",
"https://jiangzaitoon.lgbt",
"tr",
SimpleDateFormat("d MMM yyy", Locale("tr")),
) {
@ -22,4 +22,27 @@ class Jiangzaitoon : Madara(
}
override val chapterUrlSelector = "> a"
override fun String.getSrcSetImage(): String? {
/* Assumption: URL is absolute
* Assumption: descriptor is always in width
*/
return this
.split(",")
.mapNotNull { candidate ->
candidate
.trim()
.split(" ", limit = 2)
.takeIf { it.size == 2 }
?.let { (url, desc) ->
desc
.takeIf { it.endsWith("w") }
?.removeSuffix("w")
?.toIntOrNull()
?.let { size -> url to size }
}
}
.maxByOrNull { it.second }
?.first
}
}