Bato.to: expose all mirrors for CI (#9810)
* Bato.to: expose all mirrors for CI * move CI check to `getMirrorPref()` Co-authored-by: stevenyomi <95685115+stevenyomi@users.noreply.github.com> * remove proxy variable `mirror` Co-authored-by: stevenyomi <95685115+stevenyomi@users.noreply.github.com> --------- Co-authored-by: stevenyomi <95685115+stevenyomi@users.noreply.github.com>
This commit is contained in:
parent
0730f24d95
commit
e5ab6fbb21
@ -1,7 +1,7 @@
|
|||||||
ext {
|
ext {
|
||||||
extName = 'Bato.to'
|
extName = 'Bato.to'
|
||||||
extClass = '.BatoToFactory'
|
extClass = '.BatoToFactory'
|
||||||
extVersionCode = 52
|
extVersionCode = 53
|
||||||
isNsfw = true
|
isNsfw = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,17 @@ open class BatoTo(
|
|||||||
private val preferences by getPreferencesLazy { migrateMirrorPref() }
|
private val preferences by getPreferencesLazy { migrateMirrorPref() }
|
||||||
|
|
||||||
override val name: String = "Bato.to"
|
override val name: String = "Bato.to"
|
||||||
override val baseUrl: String get() = mirror
|
|
||||||
|
override var baseUrl: String = ""
|
||||||
|
get() {
|
||||||
|
val current = field
|
||||||
|
if (current.isNotEmpty()) {
|
||||||
|
return current
|
||||||
|
}
|
||||||
|
field = getMirrorPref()
|
||||||
|
return field
|
||||||
|
}
|
||||||
|
|
||||||
override val id: Long = when (lang) {
|
override val id: Long = when (lang) {
|
||||||
"zh-Hans" -> 2818874445640189582
|
"zh-Hans" -> 2818874445640189582
|
||||||
"zh-Hant" -> 38886079663327225
|
"zh-Hant" -> 38886079663327225
|
||||||
@ -70,7 +80,7 @@ open class BatoTo(
|
|||||||
setDefaultValue(MIRROR_PREF_DEFAULT_VALUE)
|
setDefaultValue(MIRROR_PREF_DEFAULT_VALUE)
|
||||||
summary = "%s"
|
summary = "%s"
|
||||||
setOnPreferenceChangeListener { _, newValue ->
|
setOnPreferenceChangeListener { _, newValue ->
|
||||||
mirror = newValue as String
|
baseUrl = newValue as String
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -94,17 +104,11 @@ open class BatoTo(
|
|||||||
screen.addPreference(removeOfficialPref)
|
screen.addPreference(removeOfficialPref)
|
||||||
}
|
}
|
||||||
|
|
||||||
private var mirror = ""
|
private fun getMirrorPref(): String {
|
||||||
get() {
|
if (System.getenv("CI") == "true") {
|
||||||
val current = field
|
return (MIRROR_PREF_ENTRY_VALUES.drop(1) + DEPRECATED_MIRRORS).joinToString("#, ")
|
||||||
if (current.isNotEmpty()) {
|
|
||||||
return current
|
|
||||||
}
|
|
||||||
field = getMirrorPref()
|
|
||||||
return field
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getMirrorPref(): String {
|
|
||||||
return preferences.getString("${MIRROR_PREF_KEY}_$lang", MIRROR_PREF_DEFAULT_VALUE)
|
return preferences.getString("${MIRROR_PREF_KEY}_$lang", MIRROR_PREF_DEFAULT_VALUE)
|
||||||
?.takeUnless { it == MIRROR_PREF_DEFAULT_VALUE }
|
?.takeUnless { it == MIRROR_PREF_DEFAULT_VALUE }
|
||||||
?: let {
|
?: let {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user