Bato.to: fix auto mirror w/o restart, update mirror list (#11054)

* Bato.to: always call `getMirrorPref()` in `baseUrl`

You no longer need to restart after changing to the 'auto' mirror.

* Bato.to: update mirror list

* Bato.to: bump version
This commit is contained in:
Vetle Ledaal 2025-10-15 14:46:13 +02:00 committed by Draff
parent 3afb33fe4a
commit 039c241d33
Signed by: Draff
GPG Key ID: E8A89F3211677653
2 changed files with 53 additions and 35 deletions

View File

@ -1,7 +1,7 @@
ext {
extName = 'Bato.to'
extClass = '.BatoToFactory'
extVersionCode = 54
extVersionCode = 55
isNsfw = true
}

View File

@ -54,18 +54,7 @@ open class BatoTo(
override val name: String = "Bato.to"
override var baseUrl: String = ""
get() {
val current = field
if (current.isNotEmpty()) {
return when (current) {
"Auto" -> getMirrorPref()
else -> current
}
}
field = getMirrorPref()
return field
}
override val baseUrl: String get() = getMirrorPref()
override val id: Long = when (lang) {
"zh-Hans" -> 2818874445640189582
@ -82,10 +71,6 @@ open class BatoTo(
entryValues = MIRROR_PREF_ENTRY_VALUES
setDefaultValue(MIRROR_PREF_DEFAULT_VALUE)
summary = "%s"
setOnPreferenceChangeListener { _, newValue ->
baseUrl = newValue as String
true
}
}
val altChapterListPref = CheckBoxPreference(screen.context).apply {
key = "${ALT_CHAPTER_LIST_PREF_KEY}_$lang"
@ -1047,39 +1032,72 @@ open class BatoTo(
private const val REMOVE_TITLE_VERSION_PREF = "REMOVE_TITLE_VERSION"
private val MIRROR_PREF_ENTRIES = arrayOf(
"Auto",
"batocomic.com",
"batocomic.net",
"batocomic.org",
// https://batotomirrors.pages.dev/
"ato.to",
"dto.to",
"fto.to",
"hto.to",
"jto.to",
"lto.to",
"mto.to",
"nto.to",
"vto.to",
"wto.to",
"xto.to",
"yto.to",
"vba.to",
"wba.to",
"xba.to",
"yba.to",
"zba.to",
"bato.ac",
"bato.bz",
"bato.cc",
"bato.cx",
"bato.id",
"bato.pw",
"bato.sh",
"bato.to",
"bato.vc",
"bato.day",
"bato.red",
"bato.run",
"batoto.in",
"batoto.tv",
"batotoo.com",
"batotwo.com",
"batpub.com",
"batread.com",
"battwo.com",
"comiko.net",
"comiko.org",
"readtoto.com",
"readtoto.net",
"readtoto.org",
"xbato.com",
"xbato.net",
"xbato.org",
"zbato.com",
"zbato.net",
"zbato.org",
"dto.to",
"fto.to",
"hto.to",
"jto.to",
"mto.to",
"wto.to",
"comiko.net",
"comiko.org",
"mangatoto.com",
"mangatoto.net",
"mangatoto.org",
"batocomic.com",
"batocomic.net",
"batocomic.org",
"readtoto.com",
"readtoto.net",
"readtoto.org",
"kuku.to",
"okok.to",
"ruru.to",
"xdxd.to",
// "bato.si", // (v4)
// "bato.ing", // (v4)
)
private val MIRROR_PREF_ENTRY_VALUES = MIRROR_PREF_ENTRIES.map { "https://$it" }.toTypedArray()
private val MIRROR_PREF_DEFAULT_VALUE = MIRROR_PREF_ENTRY_VALUES[0]
private val DEPRECATED_MIRRORS = listOf(
"https://bato.to",
"https://batocc.com", // parked
"https://mangatoto.com",
"https://mangatoto.net",
"https://mangatoto.org",
)
private const val ALT_CHAPTER_LIST_PREF_KEY = "ALT_CHAPTER_LIST"