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") id("lib-multisrc")
} }
baseVersionCode = 1 baseVersionCode = 2

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,7 @@
ext { ext {
extName = 'NineManga' extName = 'NineManga'
extClass = '.NineMangaFactory' extClass = '.NineMangaFactory'
extVersionCode = 20 extVersionCode = 21
} }
apply from: "$rootDir/common.gradle" 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") 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 -> .addInterceptor { chain ->
val request = chain.request() val request = chain.request()
val url = request.url.toString() val url = request.url.toString()

View File

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

View File

@ -34,7 +34,7 @@ class Photos18 : HttpSource(), ConfigurableSource {
private val baseUrlWithLang get() = if (useTrad) baseUrl else "$baseUrl/zh-hans" private val baseUrlWithLang get() = if (useTrad) baseUrl else "$baseUrl/zh-hans"
private fun String.stripLang() = removePrefix("/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 { override fun headersBuilder() = Headers.Builder().apply {
add("Referer", baseUrl) add("Referer", baseUrl)

View File

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

View File

@ -208,7 +208,7 @@ class ProjectSuki : HttpSource(), ConfigurableSource {
* (this is a permalink, check for updated version), * (this is a permalink, check for updated version),
* most client options are already set as they should be, including the [Cache][okhttp3.Cache]. * 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( .setRandomUserAgent(
userAgentType = preferences.shared.getPrefUAType(), userAgentType = preferences.shared.getPrefUAType(),
customUA = preferences.shared.getPrefCustomUA(), customUA = preferences.shared.getPrefCustomUA(),

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -60,7 +60,7 @@ class Taiyo : ParsedHttpSource() {
private var bearerToken: String = preferences.getString(BEARER_TOKEN_PREF, "").toString() 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(baseUrl.toHttpUrl(), 2)
.rateLimitHost(IMG_CDN.toHttpUrl(), 2) .rateLimitHost(IMG_CDN.toHttpUrl(), 2)
.addInterceptor(::authorizationInterceptor) .addInterceptor(::authorizationInterceptor)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -24,7 +24,7 @@ abstract class MDB(
override val lang: String = "zh", override val lang: String = "zh",
) : ParsedHttpSource() { ) : 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) override fun headersBuilder() = super.headersBuilder().add("Referer", baseUrl)

View File

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

View File

@ -32,7 +32,7 @@ class Roumanwu : ParsedHttpSource(), ConfigurableSource {
max(MIRRORS.size - 1, preferences.getString(MIRROR_PREF, MIRROR_DEFAULT)!!.toInt()), 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() private val imageUrlRegex = """\\"imageUrl\\":\\"(?<imageUrl>[^\\]+)""".toRegex()