diff --git a/multisrc/overrides/madtheme/beehentai/src/BeeHentai.kt b/multisrc/overrides/madtheme/beehentai/src/BeeHentai.kt deleted file mode 100644 index 7b8f9cbd2..000000000 --- a/multisrc/overrides/madtheme/beehentai/src/BeeHentai.kt +++ /dev/null @@ -1,46 +0,0 @@ -package eu.kanade.tachiyomi.extension.en.beehentai - -import eu.kanade.tachiyomi.multisrc.madtheme.MadTheme -import eu.kanade.tachiyomi.network.interceptor.rateLimitHost -import okhttp3.HttpUrl.Companion.toHttpUrl -import okhttp3.OkHttpClient -import java.util.concurrent.TimeUnit - -class BeeHentai : MadTheme( - "BeeHentai", - "https://beehentai.com", - "en" -) { - override val client: OkHttpClient = network.cloudflareClient.newBuilder() - .rateLimitHost( - "https://s1.mbcdnv1.xyz".toHttpUrl(), - 5, - 1, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv2.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv3.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv4.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv5.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .build() -} diff --git a/multisrc/overrides/madtheme/boxmanhwa/src/BoxManhwa.kt b/multisrc/overrides/madtheme/boxmanhwa/src/BoxManhwa.kt deleted file mode 100644 index 8a71b3670..000000000 --- a/multisrc/overrides/madtheme/boxmanhwa/src/BoxManhwa.kt +++ /dev/null @@ -1,46 +0,0 @@ -package eu.kanade.tachiyomi.extension.en.boxmanhwa - -import eu.kanade.tachiyomi.multisrc.madtheme.MadTheme -import eu.kanade.tachiyomi.network.interceptor.rateLimitHost -import okhttp3.HttpUrl.Companion.toHttpUrl -import okhttp3.OkHttpClient -import java.util.concurrent.TimeUnit - -class BoxManhwa : MadTheme( - "BoxManhwa", - "https://boxmanhwa.com", - "en" -) { - override val client: OkHttpClient = network.cloudflareClient.newBuilder() - .rateLimitHost( - "https://s1.mbcdnv1.xyz".toHttpUrl(), - 5, - 1, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv2.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv3.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv4.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv5.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .build() -} diff --git a/multisrc/overrides/madtheme/mangabuddy/src/MangaBuddy.kt b/multisrc/overrides/madtheme/mangabuddy/src/MangaBuddy.kt index d1024305c..17a9eb9be 100644 --- a/multisrc/overrides/madtheme/mangabuddy/src/MangaBuddy.kt +++ b/multisrc/overrides/madtheme/mangabuddy/src/MangaBuddy.kt @@ -1,20 +1,62 @@ package eu.kanade.tachiyomi.extension.en.mangabuddy +import android.app.Application +import android.content.SharedPreferences +import androidx.preference.ListPreference +import androidx.preference.PreferenceScreen import eu.kanade.tachiyomi.multisrc.madtheme.MadTheme import eu.kanade.tachiyomi.network.interceptor.rateLimitHost +import eu.kanade.tachiyomi.source.ConfigurableSource import okhttp3.HttpUrl.Companion.toHttpUrl import okhttp3.OkHttpClient +import uy.kohesive.injekt.Injekt +import uy.kohesive.injekt.api.get -class MangaBuddy : MadTheme( - "MangaBuddy", - "https://mangabuddy.com", - "en" -) { - override val client: OkHttpClient = network.cloudflareClient.newBuilder() - .rateLimitHost("https://s1.mbcdnv1.xyz".toHttpUrl(), 1, 1) - .rateLimitHost("https://s1.mbcdnv2.xyz".toHttpUrl(), 1, 2) - .rateLimitHost("https://s1.mbcdnv3.xyz".toHttpUrl(), 1, 2) - .rateLimitHost("https://s1.mbcdnv4.xyz".toHttpUrl(), 1, 2) - .rateLimitHost("https://s1.mbcdnv5.xyz".toHttpUrl(), 1, 2) +class MangaBuddy : + MadTheme( + "MangaBuddy", + "https://mangabuddy.com", + "en" + ), + ConfigurableSource { + override val client: OkHttpClient = super.client.newBuilder() + .rateLimitHost(baseUrl.toHttpUrl(), 1, 1) .build() + + private val preferences: SharedPreferences by lazy { + Injekt.get().getSharedPreferences("source_$id", 0x0000) + } + + override fun setupPreferenceScreen(screen: PreferenceScreen) { + val imageServerPref = ListPreference(screen.context).apply { + key = "${IMAGE_SERVER_PREF_KEY}_$lang" + title = IMAGE_SERVER_PREF_TITLE + entries = IMAGE_SERVER_PREF_ENTRIES + entryValues = IMAGE_SERVER_PREF_ENTRY_VALUES + setDefaultValue(IMAGE_SERVER_PREF_DEFAULT_VALUE) + summary = "%s" + + setOnPreferenceChangeListener { _, newValue -> + val selected = newValue as String + val index = findIndexOfValue(selected) + val entry = entryValues[index] as String + preferences.edit().putString("${IMAGE_SERVER_PREF_KEY}_$lang", entry).commit() + } + } + screen.addPreference(imageServerPref) + } + + override var CDN_URL: String? = IMAGE_SERVER_PREF_DEFAULT_VALUE + get() = preferences.getString("${IMAGE_SERVER_PREF_KEY}_$lang", IMAGE_SERVER_PREF_DEFAULT_VALUE) + + companion object { + /* + * On the site Server 1 load balances between 5 hosts, and Server 2 uses the last host. + */ + private const val IMAGE_SERVER_PREF_KEY = "IMAGE_SERVER" + private const val IMAGE_SERVER_PREF_TITLE = "Image server" + private val IMAGE_SERVER_PREF_ENTRIES = arrayOf("Server 1", "Server 2") + private val IMAGE_SERVER_PREF_ENTRY_VALUES = arrayOf("https://s1.mbcdnv1.xyz", "https://s1.mbcdnv5.xyz") + private val IMAGE_SERVER_PREF_DEFAULT_VALUE = IMAGE_SERVER_PREF_ENTRY_VALUES[0] + } } diff --git a/multisrc/overrides/madtheme/mangacute/src/MangaCute.kt b/multisrc/overrides/madtheme/mangacute/src/MangaCute.kt deleted file mode 100644 index dd6a92274..000000000 --- a/multisrc/overrides/madtheme/mangacute/src/MangaCute.kt +++ /dev/null @@ -1,46 +0,0 @@ -package eu.kanade.tachiyomi.extension.en.mangacute - -import eu.kanade.tachiyomi.multisrc.madtheme.MadTheme -import eu.kanade.tachiyomi.network.interceptor.rateLimitHost -import okhttp3.HttpUrl.Companion.toHttpUrl -import okhttp3.OkHttpClient -import java.util.concurrent.TimeUnit - -class MangaCute : MadTheme( - "MangaCute", - "https://mangacute.com", - "en" -) { - override val client: OkHttpClient = network.cloudflareClient.newBuilder() - .rateLimitHost( - "https://s1.mbcdnv1.xyz".toHttpUrl(), - 5, - 1, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv2.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv3.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv4.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv5.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .build() -} diff --git a/multisrc/overrides/madtheme/mangafab/src/MangaFab.kt b/multisrc/overrides/madtheme/mangafab/src/MangaFab.kt deleted file mode 100644 index efc1246c5..000000000 --- a/multisrc/overrides/madtheme/mangafab/src/MangaFab.kt +++ /dev/null @@ -1,46 +0,0 @@ -package eu.kanade.tachiyomi.extension.en.mangafab - -import eu.kanade.tachiyomi.multisrc.madtheme.MadTheme -import eu.kanade.tachiyomi.network.interceptor.rateLimitHost -import okhttp3.HttpUrl.Companion.toHttpUrl -import okhttp3.OkHttpClient -import java.util.concurrent.TimeUnit - -class MangaFab : MadTheme( - "MangaFab", - "https://mangafab.com", - "en" -) { - override val client: OkHttpClient = network.cloudflareClient.newBuilder() - .rateLimitHost( - "https://s1.mbcdnv1.xyz".toHttpUrl(), - 5, - 1, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv2.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv3.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv4.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv5.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .build() -} diff --git a/multisrc/overrides/madtheme/mangaforest/src/MangaForest.kt b/multisrc/overrides/madtheme/mangaforest/src/MangaForest.kt deleted file mode 100644 index 3bcf8de68..000000000 --- a/multisrc/overrides/madtheme/mangaforest/src/MangaForest.kt +++ /dev/null @@ -1,46 +0,0 @@ -package eu.kanade.tachiyomi.extension.en.mangaforest - -import eu.kanade.tachiyomi.multisrc.madtheme.MadTheme -import eu.kanade.tachiyomi.network.interceptor.rateLimitHost -import okhttp3.HttpUrl.Companion.toHttpUrl -import okhttp3.OkHttpClient -import java.util.concurrent.TimeUnit - -class MangaForest : MadTheme( - "MangaForest", - "https://mangaforest.com", - "en" -) { - override val client: OkHttpClient = network.cloudflareClient.newBuilder() - .rateLimitHost( - "https://s1.mbcdnv1.xyz".toHttpUrl(), - 5, - 1, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv2.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv3.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv4.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv5.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .build() -} diff --git a/multisrc/overrides/madtheme/mangamad/src/MangaMad.kt b/multisrc/overrides/madtheme/mangamad/src/MangaMad.kt deleted file mode 100644 index bd0aafea9..000000000 --- a/multisrc/overrides/madtheme/mangamad/src/MangaMad.kt +++ /dev/null @@ -1,46 +0,0 @@ -package eu.kanade.tachiyomi.extension.en.mangamad - -import eu.kanade.tachiyomi.multisrc.madtheme.MadTheme -import eu.kanade.tachiyomi.network.interceptor.rateLimitHost -import okhttp3.HttpUrl.Companion.toHttpUrl -import okhttp3.OkHttpClient -import java.util.concurrent.TimeUnit - -class MangaMad : MadTheme( - "MangaMad", - "https://mangamad.com", - "en" -) { - override val client: OkHttpClient = network.cloudflareClient.newBuilder() - .rateLimitHost( - "https://s1.mbcdnv1.xyz".toHttpUrl(), - 5, - 1, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv2.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv3.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv4.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv5.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .build() -} diff --git a/multisrc/overrides/madtheme/mangamax/src/MangaMax.kt b/multisrc/overrides/madtheme/mangamax/src/MangaMax.kt deleted file mode 100644 index 8efb7f1c3..000000000 --- a/multisrc/overrides/madtheme/mangamax/src/MangaMax.kt +++ /dev/null @@ -1,46 +0,0 @@ -package eu.kanade.tachiyomi.extension.en.mangamax - -import eu.kanade.tachiyomi.multisrc.madtheme.MadTheme -import eu.kanade.tachiyomi.network.interceptor.rateLimitHost -import okhttp3.HttpUrl.Companion.toHttpUrl -import okhttp3.OkHttpClient -import java.util.concurrent.TimeUnit - -class MangaMax : MadTheme( - "MangaMax", - "https://mangamax.net", - "en" -) { - override val client: OkHttpClient = network.cloudflareClient.newBuilder() - .rateLimitHost( - "https://s1.mbcdnv1.xyz".toHttpUrl(), - 5, - 1, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv2.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv3.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv4.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv5.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .build() -} diff --git a/multisrc/overrides/madtheme/mangasaga/src/MangaSaga.kt b/multisrc/overrides/madtheme/mangasaga/src/MangaSaga.kt deleted file mode 100644 index 8d429e785..000000000 --- a/multisrc/overrides/madtheme/mangasaga/src/MangaSaga.kt +++ /dev/null @@ -1,46 +0,0 @@ -package eu.kanade.tachiyomi.extension.en.mangasaga - -import eu.kanade.tachiyomi.multisrc.madtheme.MadTheme -import eu.kanade.tachiyomi.network.interceptor.rateLimitHost -import okhttp3.HttpUrl.Companion.toHttpUrl -import okhttp3.OkHttpClient -import java.util.concurrent.TimeUnit - -class MangaSaga : MadTheme( - "MangaSaga", - "https://mangasaga.com", - "en" -) { - override val client: OkHttpClient = network.cloudflareClient.newBuilder() - .rateLimitHost( - "https://s1.mbcdnv1.xyz".toHttpUrl(), - 5, - 1, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv2.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv3.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv4.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv5.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .build() -} diff --git a/multisrc/overrides/madtheme/mangaspin/src/MangaSpin.kt b/multisrc/overrides/madtheme/mangaspin/src/MangaSpin.kt deleted file mode 100644 index 87dd77011..000000000 --- a/multisrc/overrides/madtheme/mangaspin/src/MangaSpin.kt +++ /dev/null @@ -1,46 +0,0 @@ -package eu.kanade.tachiyomi.extension.en.mangaspin - -import eu.kanade.tachiyomi.multisrc.madtheme.MadTheme -import eu.kanade.tachiyomi.network.interceptor.rateLimitHost -import okhttp3.HttpUrl.Companion.toHttpUrl -import okhttp3.OkHttpClient -import java.util.concurrent.TimeUnit - -class MangaSpin : MadTheme( - "MangaSpin", - "https://mangaspin.com", - "en" -) { - override val client: OkHttpClient = network.cloudflareClient.newBuilder() - .rateLimitHost( - "https://s1.mbcdnv1.xyz".toHttpUrl(), - 5, - 1, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv2.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv3.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv4.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv5.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .build() -} diff --git a/multisrc/overrides/madtheme/mangaxyz/src/MangaXYZ.kt b/multisrc/overrides/madtheme/mangaxyz/src/MangaXYZ.kt deleted file mode 100644 index 1b4b50bc5..000000000 --- a/multisrc/overrides/madtheme/mangaxyz/src/MangaXYZ.kt +++ /dev/null @@ -1,46 +0,0 @@ -package eu.kanade.tachiyomi.extension.en.mangaxyz - -import eu.kanade.tachiyomi.multisrc.madtheme.MadTheme -import eu.kanade.tachiyomi.network.interceptor.rateLimitHost -import okhttp3.HttpUrl.Companion.toHttpUrl -import okhttp3.OkHttpClient -import java.util.concurrent.TimeUnit - -class MangaXYZ : MadTheme( - "MangaXYZ", - "https://mangaxyz.com", - "en" -) { - override val client: OkHttpClient = network.cloudflareClient.newBuilder() - .rateLimitHost( - "https://s1.mbcdnv1.xyz".toHttpUrl(), - 5, - 1, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv2.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv3.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv4.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv5.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .build() -} diff --git a/multisrc/overrides/madtheme/manhuanow/src/ManhuaNow.kt b/multisrc/overrides/madtheme/manhuanow/src/ManhuaNow.kt deleted file mode 100644 index 7f8a7a99c..000000000 --- a/multisrc/overrides/madtheme/manhuanow/src/ManhuaNow.kt +++ /dev/null @@ -1,46 +0,0 @@ -package eu.kanade.tachiyomi.extension.en.manhuanow - -import eu.kanade.tachiyomi.multisrc.madtheme.MadTheme -import eu.kanade.tachiyomi.network.interceptor.rateLimitHost -import okhttp3.HttpUrl.Companion.toHttpUrl -import okhttp3.OkHttpClient -import java.util.concurrent.TimeUnit - -class ManhuaNow : MadTheme( - "ManhuaNow", - "https://manhuanow.com", - "en" -) { - override val client: OkHttpClient = network.cloudflareClient.newBuilder() - .rateLimitHost( - "https://s1.mbcdnv1.xyz".toHttpUrl(), - 5, - 1, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv2.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv3.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv4.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv5.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .build() -} diff --git a/multisrc/overrides/madtheme/manhuasite/src/ManhuaSite.kt b/multisrc/overrides/madtheme/manhuasite/src/ManhuaSite.kt deleted file mode 100644 index 7ee69bf72..000000000 --- a/multisrc/overrides/madtheme/manhuasite/src/ManhuaSite.kt +++ /dev/null @@ -1,46 +0,0 @@ -package eu.kanade.tachiyomi.extension.en.manhuasite - -import eu.kanade.tachiyomi.multisrc.madtheme.MadTheme -import eu.kanade.tachiyomi.network.interceptor.rateLimitHost -import okhttp3.HttpUrl.Companion.toHttpUrl -import okhttp3.OkHttpClient -import java.util.concurrent.TimeUnit - -class ManhuaSite : MadTheme( - "ManhuaSite", - "https://manhuasite.com", - "en" -) { - override val client: OkHttpClient = network.cloudflareClient.newBuilder() - .rateLimitHost( - "https://s1.mbcdnv1.xyz".toHttpUrl(), - 5, - 1, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv2.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv3.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv4.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv5.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .build() -} diff --git a/multisrc/overrides/madtheme/tooniclub/src/TooniClub.kt b/multisrc/overrides/madtheme/tooniclub/src/TooniClub.kt deleted file mode 100644 index 2ed755d33..000000000 --- a/multisrc/overrides/madtheme/tooniclub/src/TooniClub.kt +++ /dev/null @@ -1,46 +0,0 @@ -package eu.kanade.tachiyomi.extension.en.tooniclub - -import eu.kanade.tachiyomi.multisrc.madtheme.MadTheme -import eu.kanade.tachiyomi.network.interceptor.rateLimitHost -import okhttp3.HttpUrl.Companion.toHttpUrl -import okhttp3.OkHttpClient -import java.util.concurrent.TimeUnit - -class TooniClub : MadTheme( - "TooniClub", - "https://tooniclub.com", - "en" -) { - override val client: OkHttpClient = network.cloudflareClient.newBuilder() - .rateLimitHost( - "https://s1.mbcdnv1.xyz".toHttpUrl(), - 5, - 1, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv2.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv3.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv4.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv5.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .build() -} diff --git a/multisrc/overrides/madtheme/toonifab/src/TooniFab.kt b/multisrc/overrides/madtheme/toonifab/src/TooniFab.kt deleted file mode 100644 index 31410101e..000000000 --- a/multisrc/overrides/madtheme/toonifab/src/TooniFab.kt +++ /dev/null @@ -1,46 +0,0 @@ -package eu.kanade.tachiyomi.extension.en.toonifab - -import eu.kanade.tachiyomi.multisrc.madtheme.MadTheme -import eu.kanade.tachiyomi.network.interceptor.rateLimitHost -import okhttp3.HttpUrl.Companion.toHttpUrl -import okhttp3.OkHttpClient -import java.util.concurrent.TimeUnit - -class TooniFab : MadTheme( - "TooniFab", - "https://toonifab.com", - "en" -) { - override val client: OkHttpClient = network.cloudflareClient.newBuilder() - .rateLimitHost( - "https://s1.mbcdnv1.xyz".toHttpUrl(), - 5, - 1, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv2.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv3.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv4.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv5.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .build() -} diff --git a/multisrc/overrides/madtheme/toonilyme/src/ToonilyMe.kt b/multisrc/overrides/madtheme/toonilyme/src/ToonilyMe.kt deleted file mode 100644 index f7a9f27ad..000000000 --- a/multisrc/overrides/madtheme/toonilyme/src/ToonilyMe.kt +++ /dev/null @@ -1,46 +0,0 @@ -package eu.kanade.tachiyomi.extension.en.toonilyme - -import eu.kanade.tachiyomi.multisrc.madtheme.MadTheme -import eu.kanade.tachiyomi.network.interceptor.rateLimitHost -import okhttp3.HttpUrl.Companion.toHttpUrl -import okhttp3.OkHttpClient -import java.util.concurrent.TimeUnit - -class ToonilyMe : MadTheme( - "Toonily.me", - "https://toonily.me", - "en" -) { - override val client: OkHttpClient = network.cloudflareClient.newBuilder() - .rateLimitHost( - "https://s1.mbcdnv1.xyz".toHttpUrl(), - 5, - 1, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv2.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv3.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv4.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv5.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .build() -} diff --git a/multisrc/overrides/madtheme/toonitube/src/TooniTube.kt b/multisrc/overrides/madtheme/toonitube/src/TooniTube.kt deleted file mode 100644 index 60ca50949..000000000 --- a/multisrc/overrides/madtheme/toonitube/src/TooniTube.kt +++ /dev/null @@ -1,46 +0,0 @@ -package eu.kanade.tachiyomi.extension.en.toonitube - -import eu.kanade.tachiyomi.multisrc.madtheme.MadTheme -import eu.kanade.tachiyomi.network.interceptor.rateLimitHost -import okhttp3.HttpUrl.Companion.toHttpUrl -import okhttp3.OkHttpClient -import java.util.concurrent.TimeUnit - -class TooniTube : MadTheme( - "TooniTube", - "https://toonitube.com", - "en" -) { - override val client: OkHttpClient = network.cloudflareClient.newBuilder() - .rateLimitHost( - "https://s1.mbcdnv1.xyz".toHttpUrl(), - 5, - 1, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv2.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv3.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv4.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv5.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .build() -} diff --git a/multisrc/overrides/madtheme/truemanga/src/TrueManga.kt b/multisrc/overrides/madtheme/truemanga/src/TrueManga.kt deleted file mode 100644 index b5852735f..000000000 --- a/multisrc/overrides/madtheme/truemanga/src/TrueManga.kt +++ /dev/null @@ -1,46 +0,0 @@ -package eu.kanade.tachiyomi.extension.en.truemanga - -import eu.kanade.tachiyomi.multisrc.madtheme.MadTheme -import eu.kanade.tachiyomi.network.interceptor.rateLimitHost -import okhttp3.HttpUrl.Companion.toHttpUrl -import okhttp3.OkHttpClient -import java.util.concurrent.TimeUnit - -class TrueManga : MadTheme( - "TrueManga", - "https://truemanga.com", - "en" -) { - override val client: OkHttpClient = network.cloudflareClient.newBuilder() - .rateLimitHost( - "https://s1.mbcdnv1.xyz".toHttpUrl(), - 5, - 1, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv2.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv3.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv4.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .rateLimitHost( - "https://s1.mbcdnv5.xyz".toHttpUrl(), - 1, - 2, - TimeUnit.SECONDS - ) - .build() -} diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madtheme/MadTheme.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madtheme/MadTheme.kt index d96d5f7e0..54d190787 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madtheme/MadTheme.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madtheme/MadTheme.kt @@ -1,6 +1,7 @@ package eu.kanade.tachiyomi.multisrc.madtheme import eu.kanade.tachiyomi.network.GET +import eu.kanade.tachiyomi.network.interceptor.rateLimitHost import eu.kanade.tachiyomi.source.model.Filter import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.MangasPage @@ -13,6 +14,7 @@ import kotlinx.serialization.decodeFromString import kotlinx.serialization.json.Json import okhttp3.Headers import okhttp3.HttpUrl.Companion.toHttpUrl +import okhttp3.OkHttpClient import okhttp3.Request import okhttp3.Response import org.jsoup.nodes.Document @@ -32,6 +34,14 @@ abstract class MadTheme( override val supportsLatest = true + override val client: OkHttpClient = network.cloudflareClient.newBuilder() + .rateLimitHost("https://s1.mbcdnv1.xyz".toHttpUrl(), 1, 1) + .rateLimitHost("https://s1.mbcdnv2.xyz".toHttpUrl(), 1, 1) + .rateLimitHost("https://s1.mbcdnv3.xyz".toHttpUrl(), 1, 1) + .rateLimitHost("https://s1.mbcdnv4.xyz".toHttpUrl(), 1, 1) + .rateLimitHost("https://s1.mbcdnv5.xyz".toHttpUrl(), 1, 1) + .build() + override fun headersBuilder() = Headers.Builder().apply { add("Referer", "$baseUrl/") } @@ -295,8 +305,9 @@ abstract class MadTheme( fun toUriPart() = vals[state].second } + open var CDN_URL: String? = null + companion object { - private var CDN_URL: String? = null private var CDN_URL_ALT: List = listOf() private var CDN_PATH: String? = null } diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madtheme/MadThemeGenerator.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madtheme/MadThemeGenerator.kt index b00268dec..4d14817b4 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madtheme/MadThemeGenerator.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madtheme/MadThemeGenerator.kt @@ -9,7 +9,7 @@ class MadThemeGenerator : ThemeSourceGenerator { override val themeClass = "MadTheme" - override val baseVersionCode: Int = 7 + override val baseVersionCode: Int = 8 override val sources = listOf( SingleLang("BeeHentai", "https://beehentai.com", "en", isNsfw = true),