Update dependencies

pull/185/head
Koitharu 3 years ago
parent 875b08b1fc
commit c2b79b55f8
No known key found for this signature in database
GPG Key ID: 8E861F8CE6E7CE27

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="KotlinJpsPluginSettings">
<option name="version" value="1.6.21" />
<option name="version" value="1.8.22" />
</component>
</project>

@ -18,10 +18,10 @@ compileKotlin {
kotlinOptions {
jvmTarget = '1.8'
freeCompilerArgs += [
'-opt-in=kotlin.RequiresOptIn',
'-opt-in=kotlin.contracts.ExperimentalContracts',
'-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi',
'-opt-in=org.koitharu.kotatsu.parsers.InternalParsersApi',
'-opt-in=kotlin.RequiresOptIn',
'-opt-in=kotlin.contracts.ExperimentalContracts',
'-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi',
'-opt-in=org.koitharu.kotatsu.parsers.InternalParsersApi',
]
}
}
@ -30,9 +30,9 @@ compileTestKotlin {
kotlinOptions {
jvmTarget = '1.8'
freeCompilerArgs += [
'-opt-in=kotlin.RequiresOptIn',
'-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi',
'-opt-in=org.koitharu.kotatsu.parsers.InternalParsersApi',
'-opt-in=kotlin.RequiresOptIn',
'-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi',
'-opt-in=org.koitharu.kotatsu.parsers.InternalParsersApi',
]
}
}
@ -54,19 +54,19 @@ afterEvaluate {
}
dependencies {
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4'
implementation 'com.squareup.okhttp3:okhttp:4.10.0'
implementation 'com.squareup.okio:okio:3.2.0'
api 'org.jsoup:jsoup:1.15.3'
implementation 'org.json:json:20220320'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1'
implementation 'com.squareup.okhttp3:okhttp:4.11.0'
implementation 'com.squareup.okio:okio:3.3.0'
api 'org.jsoup:jsoup:1.16.1'
implementation 'org.json:json:20230618'
implementation 'androidx.collection:collection-ktx:1.2.0'
ksp project(':kotatsu-parsers-ksp')
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.0'
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.9.0'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.9.0'
testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.4'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.3'
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.9.3'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.9.3'
testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.1'
testImplementation 'io.webfolder:quickjs:1.1.0'
}

@ -1,7 +1,7 @@
pluginManagement {
plugins {
id 'com.google.devtools.ksp' version '1.6.21-1.0.5'
id 'org.jetbrains.kotlin.jvm' version '1.6.21'
id 'com.google.devtools.ksp' version '1.8.22-1.0.11'
id 'org.jetbrains.kotlin.jvm' version '1.8.22'
}
repositories {
gradlePluginPortal()

@ -65,6 +65,7 @@ internal class BatoToParser(context: MangaLoaderContext) : PagedMangaParser(
SortOrder.POPULARITY -> append("views_a.za")
SortOrder.NEWEST -> append("create.za")
SortOrder.ALPHABETICAL -> append("title.az")
SortOrder.RATING -> Unit
}
if (!tags.isNullOrEmpty()) {
append("&genres=")

@ -8,27 +8,27 @@ import org.koitharu.kotatsu.parsers.util.runCatchingCancellable
class AuthCheckExtension : BeforeAllCallback {
private val loaderContext: MangaLoaderContext = MangaLoaderContextMock
private val loaderContext: MangaLoaderContext = MangaLoaderContextMock
override fun beforeAll(context: ExtensionContext) {
for (source in MangaSource.values()) {
if (source == MangaSource.LOCAL || source == MangaSource.DUMMY) {
continue
}
val parser = source.newParser(loaderContext)
if (parser is MangaParserAuthProvider) {
checkAuthorization(source, parser)
}
}
}
override fun beforeAll(context: ExtensionContext) {
for (source in MangaSource.values()) {
if (source == MangaSource.LOCAL || source == MangaSource.DUMMY) {
continue
}
val parser = loaderContext.newParserInstance(source)
if (parser is MangaParserAuthProvider) {
checkAuthorization(source, parser)
}
}
}
private fun checkAuthorization(source: MangaSource, parser: MangaParserAuthProvider) = runTest {
runCatchingCancellable {
parser.getUsername()
}.onSuccess { username ->
println("Signed in to ${source.name} as $username")
}.onFailure { error ->
System.err.println("Auth failed for ${source.name}: ${error.javaClass.name}(${error.message})")
}
}
private fun checkAuthorization(source: MangaSource, parser: MangaParserAuthProvider) = runTest {
runCatchingCancellable {
parser.getUsername()
}.onSuccess { username ->
println("Signed in to ${source.name} as $username")
}.onFailure { error ->
System.err.println("Auth failed for ${source.name}: ${error.javaClass.name}(${error.message})")
}
}
}

@ -11,37 +11,37 @@ private const val HEADER_USER_AGENT = "User-Agent"
private const val HEADER_REFERER = "Referer"
internal class CommonHeadersInterceptor(
private val userAgent: String,
private val userAgent: String,
) : Interceptor {
override fun intercept(chain: Interceptor.Chain): Response {
val request = chain.request()
val source = request.tag(MangaSource::class.java)
val parser = source?.newParser(MangaLoaderContextMock)
val sourceHeaders = parser?.headers
val headersBuilder = request.headers.newBuilder()
if (sourceHeaders != null) {
headersBuilder.mergeWith(sourceHeaders, replaceExisting = false)
}
if (headersBuilder[HEADER_USER_AGENT] == null) {
headersBuilder[HEADER_USER_AGENT] = userAgent
}
if (headersBuilder[HEADER_REFERER] == null && parser != null) {
headersBuilder[HEADER_REFERER] = "https://${parser.domain}/"
}
val newRequest = request.newBuilder().headers(headersBuilder.build()).build()
return if (parser is Interceptor) {
parser.intercept(ProxyChain(chain, newRequest))
} else {
return chain.proceed(newRequest)
}
}
override fun intercept(chain: Interceptor.Chain): Response {
val request = chain.request()
val source = request.tag(MangaSource::class.java)
val parser = source?.let { MangaLoaderContextMock.newParserInstance(it) }
val sourceHeaders = parser?.headers
val headersBuilder = request.headers.newBuilder()
if (sourceHeaders != null) {
headersBuilder.mergeWith(sourceHeaders, replaceExisting = false)
}
if (headersBuilder[HEADER_USER_AGENT] == null) {
headersBuilder[HEADER_USER_AGENT] = userAgent
}
if (headersBuilder[HEADER_REFERER] == null && parser != null) {
headersBuilder[HEADER_REFERER] = "https://${parser.domain}/"
}
val newRequest = request.newBuilder().headers(headersBuilder.build()).build()
return if (parser is Interceptor) {
parser.intercept(ProxyChain(chain, newRequest))
} else {
return chain.proceed(newRequest)
}
}
private class ProxyChain(
private val delegate: Interceptor.Chain,
private val request: Request,
) : Interceptor.Chain by delegate {
private class ProxyChain(
private val delegate: Interceptor.Chain,
private val request: Request,
) : Interceptor.Chain by delegate {
override fun request(): Request = request
}
override fun request(): Request = request
}
}

Loading…
Cancel
Save