BoyLove: update URL (#14515)
This commit is contained in:
parent
853b3bc16c
commit
f65b75d010
@ -6,7 +6,7 @@ ext {
|
|||||||
extName = 'BoyLove'
|
extName = 'BoyLove'
|
||||||
pkgNameSuffix = 'zh.boylove'
|
pkgNameSuffix = 'zh.boylove'
|
||||||
extClass = '.BoyLove'
|
extClass = '.BoyLove'
|
||||||
extVersionCode = 6
|
extVersionCode = 7
|
||||||
isNsfw = true
|
isNsfw = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,11 +37,14 @@ class BoyLove : HttpSource(), ConfigurableSource {
|
|||||||
|
|
||||||
private val json: Json by injectLazy()
|
private val json: Json by injectLazy()
|
||||||
|
|
||||||
private val preferences: SharedPreferences =
|
override val baseUrl = run {
|
||||||
Injekt.get<Application>().getSharedPreferences("source_$id", 0x0000)
|
val preferences: SharedPreferences =
|
||||||
|
Injekt.get<Application>().getSharedPreferences("source_$id", 0x0000)
|
||||||
|
|
||||||
override val baseUrl = "https://" + preferences.getString(MIRROR_PREF, "0")!!.toInt()
|
val mirrors = MIRRORS
|
||||||
.coerceIn(0, MIRRORS.size - 1).let { MIRRORS[it] }
|
val index = preferences.getString(MIRROR_PREF, "0")!!.toInt().coerceIn(0, mirrors.size - 1)
|
||||||
|
"https://" + mirrors[index]
|
||||||
|
}
|
||||||
|
|
||||||
override val client = network.cloudflareClient.newBuilder()
|
override val client = network.cloudflareClient.newBuilder()
|
||||||
.rateLimit(2)
|
.rateLimit(2)
|
||||||
@ -112,6 +115,7 @@ class BoyLove : HttpSource(), ConfigurableSource {
|
|||||||
val images = root.select(Evaluator.Class("reader-cartoon-image"))
|
val images = root.select(Evaluator.Class("reader-cartoon-image"))
|
||||||
val urlList = if (images.isEmpty()) {
|
val urlList = if (images.isEmpty()) {
|
||||||
root.select(Evaluator.Tag("img")).map { it.attr("src").trim().toImageUrl() }
|
root.select(Evaluator.Tag("img")).map { it.attr("src").trim().toImageUrl() }
|
||||||
|
.filterNot { it.endsWith(".gif") }
|
||||||
} else {
|
} else {
|
||||||
images.map { it.child(0) }
|
images.map { it.child(0) }
|
||||||
.filter { it.attr("src").endsWith("load.png") }
|
.filter { it.attr("src").endsWith("load.png") }
|
||||||
@ -166,8 +170,9 @@ class BoyLove : HttpSource(), ConfigurableSource {
|
|||||||
key = MIRROR_PREF
|
key = MIRROR_PREF
|
||||||
title = "镜像网址"
|
title = "镜像网址"
|
||||||
summary = "选择要使用的镜像网址,重启生效"
|
summary = "选择要使用的镜像网址,重启生效"
|
||||||
entries = MIRRORS_DESC
|
val desc = MIRRORS_DESC
|
||||||
entryValues = MIRROR_INDICES
|
entries = desc
|
||||||
|
entryValues = Array(desc.size, Int::toString)
|
||||||
setDefaultValue("0")
|
setDefaultValue("0")
|
||||||
}.let { screen.addPreference(it) }
|
}.let { screen.addPreference(it) }
|
||||||
}
|
}
|
||||||
@ -176,8 +181,7 @@ class BoyLove : HttpSource(), ConfigurableSource {
|
|||||||
private const val MIRROR_PREF = "MIRROR"
|
private const val MIRROR_PREF = "MIRROR"
|
||||||
|
|
||||||
// redirect URL: https://fuhouse.club/bl
|
// redirect URL: https://fuhouse.club/bl
|
||||||
private val MIRRORS = arrayOf("boylove.live", "boylove3.cc", "boylove.cc")
|
private val MIRRORS get() = arrayOf("boylov.xyz", "boylove3.cc", "boylove.cc")
|
||||||
private val MIRRORS_DESC = arrayOf("boylove.live (大陆地区)", "boylove3.cc", "boylove.cc (非大陆地区)")
|
private val MIRRORS_DESC get() = arrayOf("boylov.xyz (大陆地区)", "boylove3.cc", "boylove.cc (非大陆地区)")
|
||||||
private val MIRROR_INDICES = arrayOf("0", "1", "2")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,8 +49,7 @@ fun String.toImageUrl() =
|
|||||||
if (startsWith("http")) {
|
if (startsWith("http")) {
|
||||||
this
|
this
|
||||||
} else {
|
} else {
|
||||||
val i = (hashCode() and 1) + 1 // 1 or 2
|
"https://proxy.boylove3.cc$this"
|
||||||
"https://blcnimghost$i.cc$this"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
|
Loading…
x
Reference in New Issue
Block a user