Explicit cloudflareClient if Cloudflare hosted (#6613)

* Explicit cloudflareClient if Cloudflare hosted

* avoid modifying multisrc sources
This commit is contained in:
Vetle Ledaal 2024-12-18 03:43:39 +01:00 committed by Draff
parent c432620356
commit 8b212ffdcd
No known key found for this signature in database
GPG Key ID: E8A89F3211677653
22 changed files with 26 additions and 18 deletions

View File

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

View File

@ -37,6 +37,8 @@ abstract class BlogTruyen(
override val supportsLatest = true
override val client = network.cloudflareClient
override fun headersBuilder() = super.headersBuilder()
.add("Referer", "$baseUrl/")

View File

@ -2,7 +2,7 @@ plugins {
id("lib-multisrc")
}
baseVersionCode = 28
baseVersionCode = 29
dependencies {
api(project(":lib:randomua"))

View File

@ -50,7 +50,7 @@ abstract class MangaHub(
private var baseApiUrl = "https://api.mghcdn.com"
private var baseCdnUrl = "https://imgx.mghcdn.com"
override val client: OkHttpClient = super.client.newBuilder()
override val client: OkHttpClient = network.cloudflareClient.newBuilder()
.setRandomUserAgent(
userAgentType = UserAgentType.DESKTOP,
filterInclude = listOf("chrome"),

View File

@ -2,7 +2,7 @@ plugins {
id("lib-multisrc")
}
baseVersionCode = 11
baseVersionCode = 12
dependencies {
api(project(":lib:i18n"))

View File

@ -67,6 +67,8 @@ constructor(
override val supportsLatest = true
override val client = network.cloudflareClient
override fun headersBuilder() = super.headersBuilder()
.add("Referer", "$baseUrl/")

View File

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

View File

@ -29,6 +29,8 @@ abstract class PizzaReader(
override val supportsLatest = true
override val client = network.cloudflareClient
open val apiUrl by lazy { "$baseUrl$apiPath" }
protected open val json: Json by injectLazy()

View File

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

View File

@ -27,6 +27,8 @@ abstract class ZeistManga(
override val supportsLatest = true
override val client = network.cloudflareClient
protected val json: Json by injectLazy()
private val intl by lazy { ZeistMangaIntl(lang) }

View File

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

View File

@ -38,7 +38,7 @@ open class Cubari(override val lang: String) : HttpSource() {
private val json: Json by injectLazy()
override val client = super.client.newBuilder()
override val client = network.cloudflareClient.newBuilder()
.addInterceptor { chain ->
val request = chain.request()
val headers = request.headers.newBuilder()

View File

@ -1,7 +1,7 @@
ext {
extName = 'Flame Comics'
extClass = '.FlameComics'
extVersionCode = 37
extVersionCode = 38
}
apply from: "$rootDir/common.gradle"

View File

@ -36,7 +36,7 @@ class FlameComics : HttpSource() {
private val json: Json by injectLazy()
override val client = super.client.newBuilder()
override val client = network.cloudflareClient.newBuilder()
.rateLimit(2, 7)
.addInterceptor(::buildIdOutdatedInterceptor)
.addInterceptor(::composedImageIntercept)

View File

@ -1,7 +1,7 @@
ext {
extName = 'Olympus Scanlation'
extClass = '.OlympusScanlation'
extVersionCode = 11
extVersionCode = 12
}
apply from: "$rootDir/common.gradle"

View File

@ -32,7 +32,7 @@ class OlympusScanlation : HttpSource() {
override val supportsLatest: Boolean = true
override val client = super.client.newBuilder()
override val client = network.cloudflareClient.newBuilder()
.rateLimitHost(baseUrl.toHttpUrl(), 1, 2)
.rateLimitHost(apiBaseUrl.toHttpUrl(), 2, 1)
.build()

View File

@ -1,7 +1,7 @@
ext {
extName = 'TMOHentai'
extClass = '.TMOHentai'
extVersionCode = 8
extVersionCode = 9
isNsfw = true
}

View File

@ -34,7 +34,7 @@ class TMOHentai : ConfigurableSource, ParsedHttpSource() {
override val supportsLatest = true
override val client: OkHttpClient = super.client.newBuilder()
override val client: OkHttpClient = network.cloudflareClient.newBuilder()
.rateLimitHost(baseUrl.toHttpUrl(), 1, 2)
.build()

View File

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

View File

@ -25,7 +25,7 @@ class HentaiArchive : ParsedHttpSource() {
.add("Referer", "$baseUrl/")
.build()
override val client = super.client.newBuilder()
override val client = network.cloudflareClient.newBuilder()
.addInterceptor { chain ->
val request = chain.request()
val url = request.url.toString()

View File

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

View File

@ -24,7 +24,7 @@ class SenManga : ParsedHttpSource() {
override val baseUrl = "https://raw.senmanga.com"
@SuppressLint("DefaultLocale")
override val client = super.client.newBuilder().addInterceptor {
override val client = network.cloudflareClient.newBuilder().addInterceptor {
// Intercept any image requests and add a referer to them
// Enables bandwidth stealing feature
val request = if (it.request().url.pathSegments.firstOrNull()?.trim()?.lowercase() == "viewer") {