From 597abdb20c4cd0387f921f3ac2f3df43ee5350b7 Mon Sep 17 00:00:00 2001 From: Koitharu Date: Sat, 17 Aug 2024 11:42:15 +0300 Subject: [PATCH] Update parsers and libraries --- app/build.gradle | 10 +++++----- .../org/koitharu/kotatsu/browser/BrowserActivity.kt | 2 +- .../kotatsu/core/network/CommonHeadersInterceptor.kt | 2 +- .../kotatsu/core/parser/ParserMangaRepository.kt | 6 ++---- .../settings/sources/auth/SourceAuthActivity.kt | 2 +- build.gradle | 6 +++--- 6 files changed, 13 insertions(+), 15 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 63d79d558..8de3b4353 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -16,8 +16,8 @@ android { applicationId 'org.koitharu.kotatsu' minSdk = 21 targetSdk = 35 - versionCode = 659 - versionName = '7.4.2' + versionCode = 660 + versionName = '7.4.3' generatedDensities = [] testInstrumentationRunner 'org.koitharu.kotatsu.HiltTestRunner' ksp { @@ -82,13 +82,13 @@ afterEvaluate { } dependencies { //noinspection GradleDependency - implementation('com.github.KotatsuApp:kotatsu-parsers:ca212ca692') { + implementation('com.github.KotatsuApp:kotatsu-parsers:98cbee11b9') { exclude group: 'org.json', module: 'json' } coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4' - implementation 'org.jetbrains.kotlin:kotlin-stdlib:2.0.10-RC' - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.9.0-RC' + implementation 'org.jetbrains.kotlin:kotlin-stdlib:2.0.10' + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.9.0-RC.2' implementation 'androidx.appcompat:appcompat:1.7.0' implementation 'androidx.core:core-ktx:1.13.1' diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/browser/BrowserActivity.kt b/app/src/main/kotlin/org/koitharu/kotatsu/browser/BrowserActivity.kt index a3a5bb1f0..1da50cefb 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/browser/BrowserActivity.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/browser/BrowserActivity.kt @@ -45,7 +45,7 @@ class BrowserActivity : BaseActivity(), BrowserCallback } val mangaSource = MangaSource(intent?.getStringExtra(EXTRA_SOURCE)) val repository = mangaRepositoryFactory.create(mangaSource) as? ParserMangaRepository - repository?.headers?.get(CommonHeaders.USER_AGENT) + repository?.getRequestHeaders()?.get(CommonHeaders.USER_AGENT) viewBinding.webView.configureForParser(userAgent) CookieManager.getInstance().setAcceptThirdPartyCookies(viewBinding.webView, true) viewBinding.webView.webViewClient = BrowserClient(this) diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/network/CommonHeadersInterceptor.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/network/CommonHeadersInterceptor.kt index a1aa3bf86..8a8094a14 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/network/CommonHeadersInterceptor.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/network/CommonHeadersInterceptor.kt @@ -38,7 +38,7 @@ class CommonHeadersInterceptor @Inject constructor( null } val headersBuilder = request.headers.newBuilder() - repository?.headers?.let { + repository?.getRequestHeaders()?.let { headersBuilder.mergeWith(it, replaceExisting = false) } if (headersBuilder[CommonHeaders.USER_AGENT] == null) { diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/parser/ParserMangaRepository.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/parser/ParserMangaRepository.kt index f2f3a7b42..c54e35d97 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/parser/ParserMangaRepository.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/parser/ParserMangaRepository.kt @@ -1,6 +1,5 @@ package org.koitharu.kotatsu.core.parser -import okhttp3.Headers import okhttp3.Interceptor import okhttp3.Response import org.koitharu.kotatsu.core.cache.MemoryContentCache @@ -65,9 +64,6 @@ class ParserMangaRepository( val domains: Array get() = parser.configKeyDomain.presetValues - val headers: Headers - get() = parser.headers - override fun intercept(chain: Interceptor.Chain): Response { return if (parser is Interceptor) { parser.intercept(chain) @@ -112,6 +108,8 @@ class ParserMangaRepository( fun getAuthProvider(): MangaParserAuthProvider? = parser as? MangaParserAuthProvider + fun getRequestHeaders() = parser.getRequestHeaders() + fun getConfigKeys(): List> = ArrayList>().also { parser.onCreateConfig(it) } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/settings/sources/auth/SourceAuthActivity.kt b/app/src/main/kotlin/org/koitharu/kotatsu/settings/sources/auth/SourceAuthActivity.kt index 588dda11a..6cf680fdf 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/settings/sources/auth/SourceAuthActivity.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/settings/sources/auth/SourceAuthActivity.kt @@ -66,7 +66,7 @@ class SourceAuthActivity : BaseActivity(), BrowserCallba setDisplayHomeAsUpEnabled(true) setHomeAsUpIndicator(materialR.drawable.abc_ic_clear_material) } - viewBinding.webView.configureForParser(repository.headers[CommonHeaders.USER_AGENT]) + viewBinding.webView.configureForParser(repository.getRequestHeaders()[CommonHeaders.USER_AGENT]) CookieManager.getInstance().setAcceptThirdPartyCookies(viewBinding.webView, true) viewBinding.webView.webViewClient = BrowserClient(this) viewBinding.webView.webChromeClient = ProgressChromeClient(viewBinding.progressBar) diff --git a/build.gradle b/build.gradle index 90d839085..08a13ca9b 100644 --- a/build.gradle +++ b/build.gradle @@ -4,10 +4,10 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:8.5.1' - classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.10-RC' + classpath 'com.android.tools.build:gradle:8.5.2' + classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.10' classpath 'com.google.dagger:hilt-android-gradle-plugin:2.51.1' - classpath 'com.google.devtools.ksp:symbol-processing-gradle-plugin:2.0.10-RC-1.0.23' + classpath 'com.google.devtools.ksp:symbol-processing-gradle-plugin:2.0.10-1.0.24' } }