Junmeitu: remove broken mirror (#13231)

This commit is contained in:
stevenyomi 2022-08-28 03:38:06 +08:00 committed by GitHub
parent 6fae0d3f7a
commit 9f6f67c676
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 37 deletions

View File

@ -6,7 +6,7 @@ ext {
extName = 'Junmeitu'
pkgNameSuffix = 'all.junmeitu'
extClass = '.Junmeitu'
extVersionCode = 3
extVersionCode = 4
isNsfw = true
}

View File

@ -1,11 +1,6 @@
package eu.kanade.tachiyomi.extension.all.junmeitu
import android.app.Application
import android.content.SharedPreferences
import androidx.preference.ListPreference
import androidx.preference.PreferenceScreen
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.source.ConfigurableSource
import eu.kanade.tachiyomi.source.model.Filter
import eu.kanade.tachiyomi.source.model.FilterList
import eu.kanade.tachiyomi.source.model.Page
@ -20,11 +15,9 @@ import org.jsoup.Jsoup
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
import org.jsoup.select.Evaluator
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
import uy.kohesive.injekt.injectLazy
class Junmeitu : ConfigurableSource, ParsedHttpSource() {
class Junmeitu : ParsedHttpSource() {
override val lang = "all"
override val name = "Junmeitu"
override val supportsLatest = true
@ -32,34 +25,8 @@ class Junmeitu : ConfigurableSource, ParsedHttpSource() {
private val json: Json by injectLazy()
// Preference
private val preferences: SharedPreferences by lazy {
Injekt.get<Application>().getSharedPreferences("source_$id", 0x0000)
}
override val baseUrl: String = getMirrorPref()!!
override fun setupPreferenceScreen(screen: PreferenceScreen) {
val mirrorPref = ListPreference(screen.context).apply {
key = "${MIRROR_PREF_KEY}_$lang"
title = MIRROR_PREF_TITLE
entries = MIRROR_PREF_ENTRIES
entryValues = MIRROR_PREF_ENTRY_VALUES
setDefaultValue(MIRROR_PREF_DEFAULT_VALUE)
summary = "%s"
}
screen.addPreference(mirrorPref)
}
private fun getMirrorPref(): String? = preferences.getString("${MIRROR_PREF_KEY}_$lang", MIRROR_PREF_DEFAULT_VALUE)
companion object {
private const val MIRROR_PREF_KEY = "MIRROR"
private const val MIRROR_PREF_TITLE = "Mirror"
private val MIRROR_PREF_ENTRIES = arrayOf("Junmeitu.com", "Meijuntu.com")
private val MIRROR_PREF_ENTRY_VALUES = arrayOf("https://junmeitu.com", "https://meijuntu.com")
private val MIRROR_PREF_DEFAULT_VALUE = MIRROR_PREF_ENTRY_VALUES[0]
}
// old pref ["MIRROR_all" => arrayOf("https://junmeitu.com", "https://meijuntu.com")]
override val baseUrl = "https://junmeitu.com"
// Latest
override fun latestUpdatesFromElement(element: Element): SManga {