MadTheme: update rate limiting, add configurable image server (MangaBuddy only) (#12484)

* MadTheme: move rate limiting logic

For MangaBuddy: also rate limit baseUrl

* MangaBuddy: add configurable image server
This commit is contained in:
Vetle Ledaal 2022-07-09 03:50:42 +00:00 committed by GitHub
parent 0f384b0cf0
commit b09a89e22c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 66 additions and 795 deletions

View File

@ -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()
}

View File

@ -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()
}

View File

@ -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(
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)
),
ConfigurableSource {
override val client: OkHttpClient = super.client.newBuilder()
.rateLimitHost(baseUrl.toHttpUrl(), 1, 1)
.build()
private val preferences: SharedPreferences by lazy {
Injekt.get<Application>().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]
}
}

View File

@ -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()
}

View File

@ -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()
}

View File

@ -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()
}

View File

@ -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()
}

View File

@ -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()
}

View File

@ -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()
}

View File

@ -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()
}

View File

@ -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()
}

View File

@ -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()
}

View File

@ -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()
}

View File

@ -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()
}

View File

@ -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()
}

View File

@ -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()
}

View File

@ -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()
}

View File

@ -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()
}

View File

@ -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<String> = listOf()
private var CDN_PATH: String? = null
}

View File

@ -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),