From e5ab6fbb21fbcd10c9c1200d121131474cb1d1a3 Mon Sep 17 00:00:00 2001 From: Vetle Ledaal Date: Sat, 26 Jul 2025 20:46:52 +0200 Subject: [PATCH] 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> --- src/all/batoto/build.gradle | 2 +- .../tachiyomi/extension/all/batoto/BatoTo.kt | 26 +++++++++++-------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/all/batoto/build.gradle b/src/all/batoto/build.gradle index 6a68f55a0..64ca60632 100644 --- a/src/all/batoto/build.gradle +++ b/src/all/batoto/build.gradle @@ -1,7 +1,7 @@ ext { extName = 'Bato.to' extClass = '.BatoToFactory' - extVersionCode = 52 + extVersionCode = 53 isNsfw = true } diff --git a/src/all/batoto/src/eu/kanade/tachiyomi/extension/all/batoto/BatoTo.kt b/src/all/batoto/src/eu/kanade/tachiyomi/extension/all/batoto/BatoTo.kt index c925d2c49..880e7def0 100644 --- a/src/all/batoto/src/eu/kanade/tachiyomi/extension/all/batoto/BatoTo.kt +++ b/src/all/batoto/src/eu/kanade/tachiyomi/extension/all/batoto/BatoTo.kt @@ -53,7 +53,17 @@ open class BatoTo( private val preferences by getPreferencesLazy { migrateMirrorPref() } 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) { "zh-Hans" -> 2818874445640189582 "zh-Hant" -> 38886079663327225 @@ -70,7 +80,7 @@ open class BatoTo( setDefaultValue(MIRROR_PREF_DEFAULT_VALUE) summary = "%s" setOnPreferenceChangeListener { _, newValue -> - mirror = newValue as String + baseUrl = newValue as String true } } @@ -94,17 +104,11 @@ open class BatoTo( screen.addPreference(removeOfficialPref) } - private var mirror = "" - get() { - val current = field - if (current.isNotEmpty()) { - return current - } - field = getMirrorPref() - return field + private fun getMirrorPref(): String { + if (System.getenv("CI") == "true") { + return (MIRROR_PREF_ENTRY_VALUES.drop(1) + DEPRECATED_MIRRORS).joinToString("#, ") } - private fun getMirrorPref(): String { return preferences.getString("${MIRROR_PREF_KEY}_$lang", MIRROR_PREF_DEFAULT_VALUE) ?.takeUnless { it == MIRROR_PREF_DEFAULT_VALUE } ?: let {