Explicit cloudflareClient if Cloudflare hosted (#6676)

This commit is contained in:
Cuong-Tran 2024-12-19 18:48:51 +07:00 committed by Draff
parent be9c14bcae
commit 7ec1dfaf48
No known key found for this signature in database
GPG Key ID: E8A89F3211677653
35 changed files with 36 additions and 34 deletions

View File

@ -2,4 +2,4 @@ plugins {
id("lib-multisrc")
}
baseVersionCode = 1
baseVersionCode = 2

View File

@ -22,6 +22,8 @@ abstract class MangaReader : HttpSource(), ConfigurableSource {
override val supportsLatest = true
override val client = network.cloudflareClient
final override fun latestUpdatesParse(response: Response) = searchMangaParse(response)
final override fun popularMangaParse(response: Response) = searchMangaParse(response)

View File

@ -1,7 +1,7 @@
ext {
extName = 'Comick'
extClass = '.ComickFactory'
extVersionCode = 50
extVersionCode = 51
isNsfw = true
}

View File

@ -177,7 +177,7 @@ abstract class Comick(
add("User-Agent", "Tachiyomi ${System.getProperty("http.agent")}")
}
override val client = network.client.newBuilder()
override val client = network.cloudflareClient.newBuilder()
.addNetworkInterceptor(::errorInterceptor)
.rateLimit(3, 1, TimeUnit.SECONDS)
.build()

View File

@ -1,7 +1,7 @@
ext {
extName = 'E-Hentai'
extClass = '.EHFactory'
extVersionCode = 22
extVersionCode = 23
isNsfw = true
}

View File

@ -398,7 +398,7 @@ abstract class EHentai(
.appendQueryParameter(param, value)
.toString()
override val client = network.client.newBuilder()
override val client = network.cloudflareClient.newBuilder()
.cookieJar(CookieJar.NO_COOKIES)
.addInterceptor { chain ->
val newReq = chain

View File

@ -33,7 +33,7 @@ open class MangaFire(
private val json: Json by injectLazy()
override val client = network.cloudflareClient.newBuilder()
override val client = super.client.newBuilder()
.addInterceptor(ImageInterceptor)
.build()

View File

@ -31,7 +31,7 @@ open class MangaReader(
override val baseUrl = "https://mangareader.to"
override val client = network.client.newBuilder()
override val client = super.client.newBuilder()
.addInterceptor(ImageInterceptor)
.build()

View File

@ -1,7 +1,7 @@
ext {
extName = 'NineManga'
extClass = '.NineMangaFactory'
extVersionCode = 20
extVersionCode = 21
}
apply from: "$rootDir/common.gradle"

View File

@ -29,7 +29,7 @@ open class NineManga(
private val cookieInterceptor = CookieInterceptor(baseUrl.substringAfter("://"), "ninemanga_list_num" to "1")
override val client: OkHttpClient = network.client.newBuilder()
override val client: OkHttpClient = network.cloudflareClient.newBuilder()
.addInterceptor { chain ->
val request = chain.request()
val url = request.url.toString()

View File

@ -1,7 +1,7 @@
ext {
extName = 'Photos18'
extClass = '.Photos18'
extVersionCode = 4
extVersionCode = 5
isNsfw = true
}

View File

@ -34,7 +34,7 @@ class Photos18 : HttpSource(), ConfigurableSource {
private val baseUrlWithLang get() = if (useTrad) baseUrl else "$baseUrl/zh-hans"
private fun String.stripLang() = removePrefix("/zh-hans")
override val client = network.client.newBuilder().followRedirects(false).build()
override val client = network.cloudflareClient.newBuilder().followRedirects(false).build()
override fun headersBuilder() = Headers.Builder().apply {
add("Referer", baseUrl)

View File

@ -1,7 +1,7 @@
ext {
extName = 'Project Suki'
extClass = '.ProjectSuki'
extVersionCode = 3
extVersionCode = 4
}
apply from: "$rootDir/common.gradle"

View File

@ -208,7 +208,7 @@ class ProjectSuki : HttpSource(), ConfigurableSource {
* (this is a permalink, check for updated version),
* most client options are already set as they should be, including the [Cache][okhttp3.Cache].
*/
override val client: OkHttpClient = network.client.newBuilder()
override val client: OkHttpClient = network.cloudflareClient.newBuilder()
.setRandomUserAgent(
userAgentType = preferences.shared.getPrefUAType(),
customUA = preferences.shared.getPrefCustomUA(),

View File

@ -1,7 +1,7 @@
ext {
extName = 'Xinmeitulu'
extClass = '.Xinmeitulu'
extVersionCode = 4
extVersionCode = 5
isNsfw = true
}

View File

@ -23,7 +23,7 @@ class Xinmeitulu : ParsedHttpSource() {
override val name = "Xinmeitulu"
override val supportsLatest = false
override val client = network.client.newBuilder().addInterceptor(::contentTypeIntercept).build()
override val client = network.cloudflareClient.newBuilder().addInterceptor(::contentTypeIntercept).build()
// Latest

View File

@ -1,7 +1,7 @@
ext {
extName = 'Cutie Comics'
extClass = '.CutieComics'
extVersionCode = 1
extVersionCode = 2
isNsfw = true
}

View File

@ -30,7 +30,7 @@ class CutieComics : ParsedHttpSource() {
override val supportsLatest = false
override val client = network.client.newBuilder()
override val client = network.cloudflareClient.newBuilder()
.rateLimitHost(baseUrl.toHttpUrl(), 2)
.build()

View File

@ -1,7 +1,7 @@
ext {
extName = 'HentaiMode'
extClass = '.HentaiMode'
extVersionCode = 2
extVersionCode = 3
isNsfw = true
}

View File

@ -28,7 +28,7 @@ class HentaiMode : ParsedHttpSource() {
override val supportsLatest = false
override val client = network.client.newBuilder()
override val client = network.cloudflareClient.newBuilder()
.rateLimitHost(baseUrl.toHttpUrl(), 2)
.build()

View File

@ -3,7 +3,7 @@ ext {
extClass = '.Nartag'
themePkg = 'madara'
baseUrl = 'https://traduccionesamistosas.eyudud.net'
overrideVersionCode = 0
overrideVersionCode = 1
isNsfw = true
}

View File

@ -12,7 +12,7 @@ class Nartag : Madara(
) {
override val versionId = 2
override val client: OkHttpClient = network.client.newBuilder()
override val client: OkHttpClient = super.client.newBuilder()
.rateLimitHost(baseUrl.toHttpUrl(), 2)
.build()

View File

@ -1,7 +1,7 @@
ext {
extName = 'Scan-Manga'
extClass = '.ScanManga'
extVersionCode = 7
extVersionCode = 8
isNsfw = true
}

View File

@ -34,7 +34,7 @@ class ScanManga : ParsedHttpSource() {
override val supportsLatest = true
override val client: OkHttpClient = network.client.newBuilder()
override val client: OkHttpClient = network.cloudflareClient.newBuilder()
.addNetworkInterceptor { chain ->
val originalCookies = chain.request().header("Cookie") ?: ""
val newReq = chain

View File

@ -32,7 +32,7 @@ class RawOtaku : MangaReader() {
override val baseUrl = "https://rawotaku.com"
override val client = network.cloudflareClient.newBuilder()
override val client = super.client.newBuilder()
.rateLimit(2)
.build()

View File

@ -1,7 +1,7 @@
ext {
extName = 'Taiyō'
extClass = '.Taiyo'
extVersionCode = 3
extVersionCode = 4
isNsfw = true
}

View File

@ -60,7 +60,7 @@ class Taiyo : ParsedHttpSource() {
private var bearerToken: String = preferences.getString(BEARER_TOKEN_PREF, "").toString()
override val client = network.client.newBuilder()
override val client = network.cloudflareClient.newBuilder()
.rateLimitHost(baseUrl.toHttpUrl(), 2)
.rateLimitHost(IMG_CDN.toHttpUrl(), 2)
.addInterceptor(::authorizationInterceptor)

View File

@ -1,7 +1,7 @@
ext {
extName = 'Tao Sect'
extClass = '.TaoSect'
extVersionCode = 19
extVersionCode = 20
isNsfw = true
}

View File

@ -35,7 +35,7 @@ class TaoSect : HttpSource() {
override val supportsLatest = true
override val client: OkHttpClient = network.client.newBuilder()
override val client: OkHttpClient = network.cloudflareClient.newBuilder()
.rateLimit(1, 2, TimeUnit.SECONDS)
.build()

View File

@ -3,7 +3,7 @@ ext {
extClass = '.MangaKings'
themePkg = 'mangathemesia'
baseUrl = 'https://mangakings.com.tr'
overrideVersionCode = 0
overrideVersionCode = 1
}
apply from: "$rootDir/common.gradle"

View File

@ -14,7 +14,7 @@ class MangaKings : MangaThemesia(
dateFormat = SimpleDateFormat("MMMM dd, yyyy", Locale("tr")),
) {
override val client = network.client.newBuilder()
override val client = super.client.newBuilder()
.rateLimitHost(baseUrl.toHttpUrl(), 2)
.build()

View File

@ -1,7 +1,7 @@
ext {
extName = 'ManhuaDB'
extClass = '.ManhuaDB'
extVersionCode = 6
extVersionCode = 7
}
apply from: "$rootDir/common.gradle"

View File

@ -24,7 +24,7 @@ abstract class MDB(
override val lang: String = "zh",
) : ParsedHttpSource() {
override val client = network.client.newBuilder().rateLimit(2).build()
override val client = network.cloudflareClient.newBuilder().rateLimit(2).build()
override fun headersBuilder() = super.headersBuilder().add("Referer", baseUrl)

View File

@ -1,7 +1,7 @@
ext {
extName = 'Roumanwu'
extClass = '.Roumanwu'
extVersionCode = 12
extVersionCode = 13
isNsfw = true
}

View File

@ -32,7 +32,7 @@ class Roumanwu : ParsedHttpSource(), ConfigurableSource {
max(MIRRORS.size - 1, preferences.getString(MIRROR_PREF, MIRROR_DEFAULT)!!.toInt()),
]
override val client = network.client.newBuilder().addInterceptor(ScrambledImageInterceptor).build()
override val client = network.cloudflareClient.newBuilder().addInterceptor(ScrambledImageInterceptor).build()
private val imageUrlRegex = """\\"imageUrl\\":\\"(?<imageUrl>[^\\]+)""".toRegex()