Improve spoofing of X-Requested-With header to support newer WebView versions (mihonapp/mihon#2491)
Co-authored-by: Cuong-Tran <cuongtran.tm@gmail.com> (cherry picked from commit 065147472e8e683c47d11f3e00386aba2a7c1bac)
This commit is contained in:
parent
e6bddcab14
commit
136fb7652c
2 changed files with 9 additions and 2 deletions
|
|
@ -14,6 +14,9 @@ The format is a modified version of [Keep a Changelog](https://keepachangelog.co
|
||||||
### Changed
|
### Changed
|
||||||
- Delegate Suwayomi tracker authentication to extension ([@cpiber](https://github.com/cpiber)) ([#2476](https://github.com/mihonapp/mihon/pull/2476))
|
- Delegate Suwayomi tracker authentication to extension ([@cpiber](https://github.com/cpiber)) ([#2476](https://github.com/mihonapp/mihon/pull/2476))
|
||||||
|
|
||||||
|
### Improved
|
||||||
|
- Spoofing of `X-Requested-With` header to support newer WebView versions ([@Guzmazow](https://github.com/Guzmazow)) ([#2491](https://github.com/mihonapp/mihon/pull/2491))
|
||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
- Fix height of description not being calculated correctly if images are present ([@Secozzi](https://github.com/Secozzi)) ([#2382](https://github.com/mihonapp/mihon/pull/2382))
|
- Fix height of description not being calculated correctly if images are present ([@Secozzi](https://github.com/Secozzi)) ([#2382](https://github.com/mihonapp/mihon/pull/2382))
|
||||||
- Fix migration progress not updating after manual search ([@Secozzi](https://github.com/Secozzi)) ([#2484](https://github.com/mihonapp/mihon/pull/2484))
|
- Fix migration progress not updating after manual search ([@Secozzi](https://github.com/Secozzi)) ([#2484](https://github.com/mihonapp/mihon/pull/2484))
|
||||||
|
|
|
||||||
|
|
@ -303,9 +303,13 @@ class App : Application(), DefaultLifecycleObserver, SingletonImageLoader.Factor
|
||||||
try {
|
try {
|
||||||
// Override the value passed as X-Requested-With in WebView requests
|
// Override the value passed as X-Requested-With in WebView requests
|
||||||
val stackTrace = Looper.getMainLooper().thread.stackTrace
|
val stackTrace = Looper.getMainLooper().thread.stackTrace
|
||||||
|
// KMK -->
|
||||||
|
val chromiumClasses = setOf("org.chromium.base.buildinfo", "org.chromium.base.apkinfo")
|
||||||
|
val chromiumMethods = setOf("getall", "getpackagename", "<init>")
|
||||||
|
// KMK <--
|
||||||
val isChromiumCall = stackTrace.any { trace ->
|
val isChromiumCall = stackTrace.any { trace ->
|
||||||
trace.className.equals("org.chromium.base.BuildInfo", ignoreCase = true) &&
|
trace.className.lowercase() in chromiumClasses &&
|
||||||
setOf("getAll", "getPackageName", "<init>").any { trace.methodName.equals(it, ignoreCase = true) }
|
trace.methodName.lowercase() in chromiumMethods
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isChromiumCall) return WebViewUtil.spoofedPackageName(applicationContext)
|
if (isChromiumCall) return WebViewUtil.spoofedPackageName(applicationContext)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue