Stop overwriting request user-agent when bypassing Cloudflare (#8771)

* Bypass cloudflare WAF using webview

* MyReadingManga: remove single cookie when bypassing Cloudflare

* Don't overwrite request header when bypassing Cloudflare
This commit is contained in:
mountfox 2021-08-23 07:21:18 -04:00 committed by GitHub
parent fcc13cdfb0
commit 67bde7f28c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 5 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'MyReadingManga' extName = 'MyReadingManga'
pkgNameSuffix = 'all.myreadingmanga' pkgNameSuffix = 'all.myreadingmanga'
extClass = '.MyReadingMangaFactory' extClass = '.MyReadingMangaFactory'
extVersionCode = 42 extVersionCode = 43
libVersion = '1.2' libVersion = '1.2'
containsNsfw = true containsNsfw = true
} }

View File

@ -32,10 +32,7 @@ class CloudflareWafInterceptor(private val cookieDomain: String) : Interceptor {
override fun intercept(chain: Interceptor.Chain): Response { override fun intercept(chain: Interceptor.Chain): Response {
initWebView initWebView
val originalRequest = chain.request() val request = chain.request()
val request = originalRequest.newBuilder()
.header("User-Agent", initWebView)
.build()
val response = chain.proceed(request) val response = chain.proceed(request)
if (response.code != 403 || response.header("Server") !in SERVER_CHECK) { if (response.code != 403 || response.header("Server") !in SERVER_CHECK) {