Fix auto captcha opening when you dont have the option enabled (temp fix)
This commit is contained in:
parent
f3b6855684
commit
a311a3b497
@ -1,8 +1,11 @@
|
||||
package exh.patch
|
||||
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.Request
|
||||
import okhttp3.Response
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
|
||||
typealias EHInterceptor = (request: Request, response: Response, sourceId: Long) -> Response
|
||||
|
||||
@ -16,10 +19,9 @@ fun OkHttpClient.Builder.injectPatches(sourceIdProducer: () -> Long): OkHttpClie
|
||||
}
|
||||
|
||||
fun findAndApplyPatches(sourceId: Long): EHInterceptor {
|
||||
return (
|
||||
(EH_INTERCEPTORS[sourceId] ?: emptyList()) +
|
||||
(EH_INTERCEPTORS[EH_UNIVERSAL_INTERCEPTOR] ?: emptyList())
|
||||
).merge()
|
||||
// TODO make it so captcha doesnt auto open in manga eden while applying universal interceptors
|
||||
return if (Injekt.get<PreferencesHelper>().eh_autoSolveCaptchas().get()) ((EH_INTERCEPTORS[sourceId] ?: emptyList()) + (EH_INTERCEPTORS[EH_UNIVERSAL_INTERCEPTOR] ?: emptyList())).merge()
|
||||
else (EH_INTERCEPTORS[sourceId] ?: emptyList()).merge()
|
||||
}
|
||||
|
||||
fun List<EHInterceptor>.merge(): EHInterceptor {
|
||||
|
@ -51,12 +51,12 @@ class BrowserActionActivity : AppCompatActivity() {
|
||||
private var validateCurrentLoopId: String? = null
|
||||
private var strictValidationStartTime: Long? = null
|
||||
|
||||
lateinit var credentialsObservable: Observable<String>
|
||||
private lateinit var credentialsObservable: Observable<String>
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
setContentView(eu.kanade.tachiyomi.R.layout.eh_activity_captcha)
|
||||
setContentView(R.layout.eh_activity_captcha)
|
||||
|
||||
val sourceId = intent.getLongExtra(SOURCE_ID_EXTRA, -1)
|
||||
val originalSource = if (sourceId != -1L) sourceManager.get(sourceId) else null
|
||||
|
Loading…
x
Reference in New Issue
Block a user