diff --git a/build.gradle b/build.gradle index 09a87e5e6..3ee68695b 100644 --- a/build.gradle +++ b/build.gradle @@ -10,7 +10,7 @@ buildscript { classpath 'com.android.tools.build:gradle:4.2.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version" - classpath 'org.jmailen.gradle:kotlinter-gradle:3.3.0' + classpath 'org.jmailen.gradle:kotlinter-gradle:3.4.0' } } diff --git a/common.gradle b/common.gradle index 17dcf07fa..89b5ecb14 100644 --- a/common.gradle +++ b/common.gradle @@ -57,6 +57,7 @@ android { kotlinOptions { jvmTarget = JavaVersion.VERSION_1_8.toString() + freeCompilerArgs += "-Xopt-in=kotlinx.serialization.ExperimentalSerializationApi" } } diff --git a/src/all/cubari/src/eu/kanade/tachiyomi/extension/all/cubari/RemoteStorageUtils.kt b/src/all/cubari/src/eu/kanade/tachiyomi/extension/all/cubari/RemoteStorageUtils.kt index 0184dac56..ac47e7b53 100644 --- a/src/all/cubari/src/eu/kanade/tachiyomi/extension/all/cubari/RemoteStorageUtils.kt +++ b/src/all/cubari/src/eu/kanade/tachiyomi/extension/all/cubari/RemoteStorageUtils.kt @@ -10,7 +10,7 @@ import android.webkit.WebViewClient import okhttp3.Interceptor import okhttp3.Request import okhttp3.Response -import okhttp3.ResponseBody +import okhttp3.ResponseBody.Companion.toResponseBody import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get import java.io.IOException @@ -72,9 +72,7 @@ class RemoteStorageUtils { webview.webViewClient = object : WebViewClient() { override fun onPageFinished(view: WebView, url: String) { - if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) { - view.evaluateJavascript(jsScript) {} - } + view.evaluateJavascript(jsScript) {} if (transparent) { latch.countDown() } @@ -94,7 +92,7 @@ class RemoteStorageUtils { return if (transparent) { response } else { - response.newBuilder().body(ResponseBody.create(response.body?.contentType(), jsInterface.payload)).build() + response.newBuilder().body(jsInterface.payload.toResponseBody(response.body?.contentType())).build() } } } diff --git a/src/all/myreadingmanga/src/eu/kanade/tachiyomi/extension/all/myreadingmanga/CloudflareWafInterceptor.kt b/src/all/myreadingmanga/src/eu/kanade/tachiyomi/extension/all/myreadingmanga/CloudflareWafInterceptor.kt index 39809a054..2a5a37bfb 100644 --- a/src/all/myreadingmanga/src/eu/kanade/tachiyomi/extension/all/myreadingmanga/CloudflareWafInterceptor.kt +++ b/src/all/myreadingmanga/src/eu/kanade/tachiyomi/extension/all/myreadingmanga/CloudflareWafInterceptor.kt @@ -19,6 +19,7 @@ import java.io.IOException import java.util.concurrent.CountDownLatch import java.util.concurrent.TimeUnit +// TODO: remove after new stable release class CloudflareWafInterceptor(private val cookieDomain: String) : Interceptor { private val context = Injekt.get() private val handler by lazy { Handler(Looper.getMainLooper()) } diff --git a/src/ar/gmanga/src/eu/kanade/tachiyomi/extension/ar/gmanga/Gmanga.kt b/src/ar/gmanga/src/eu/kanade/tachiyomi/extension/ar/gmanga/Gmanga.kt index bda21d9b8..d2329c11f 100644 --- a/src/ar/gmanga/src/eu/kanade/tachiyomi/extension/ar/gmanga/Gmanga.kt +++ b/src/ar/gmanga/src/eu/kanade/tachiyomi/extension/ar/gmanga/Gmanga.kt @@ -28,7 +28,6 @@ import okhttp3.Headers import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.OkHttpClient import okhttp3.Request -import okhttp3.RequestBody import okhttp3.RequestBody.Companion.toRequestBody import okhttp3.Response import uy.kohesive.injekt.injectLazy diff --git a/src/en/mangadoom/src/eu/kanade/tachiyomi/extension/en/mangadoom/MangaDoom.kt b/src/en/mangadoom/src/eu/kanade/tachiyomi/extension/en/mangadoom/MangaDoom.kt index b1cf3ab47..2a2b0467c 100644 --- a/src/en/mangadoom/src/eu/kanade/tachiyomi/extension/en/mangadoom/MangaDoom.kt +++ b/src/en/mangadoom/src/eu/kanade/tachiyomi/extension/en/mangadoom/MangaDoom.kt @@ -499,15 +499,15 @@ class MangaDoom : HttpSource() { private fun generateFilterContent(): List>? { fun responseToGenreFilterContentPair(genreResponse: Response): List> { - val document = genreResponse.asJsoup() + val document = genreResponse.asJsoup() - return document.select("ul.manga-cat > li").map { - Pair( - it.select("span.fa").first().attr("data-id"), - it.ownText() - ) - } + return document.select("ul.manga-cat > li").map { + Pair( + it.select("span.fa").first().attr("data-id"), + it.ownText() + ) } + } val genreResponse = client .newCall( diff --git a/src/en/vizshonenjump/src/eu/kanade/tachiyomi/extension/en/vizshonenjump/VizImageInterceptor.kt b/src/en/vizshonenjump/src/eu/kanade/tachiyomi/extension/en/vizshonenjump/VizImageInterceptor.kt index 6cf25bc6a..54ac90bfb 100644 --- a/src/en/vizshonenjump/src/eu/kanade/tachiyomi/extension/en/vizshonenjump/VizImageInterceptor.kt +++ b/src/en/vizshonenjump/src/eu/kanade/tachiyomi/extension/en/vizshonenjump/VizImageInterceptor.kt @@ -9,7 +9,7 @@ import com.drew.metadata.exif.ExifSubIFDDirectory import okhttp3.Interceptor import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.Response -import okhttp3.ResponseBody +import okhttp3.ResponseBody.Companion.toResponseBody import java.io.ByteArrayInputStream import java.io.ByteArrayOutputStream import java.io.InputStream @@ -23,7 +23,7 @@ class VizImageInterceptor : Interceptor { return response val image = decodeImage(response.body!!.byteStream()) - val body = ResponseBody.create(MEDIA_TYPE, image) + val body = image.toResponseBody(MEDIA_TYPE) return response.newBuilder() .body(body) .build() diff --git a/src/fr/japscan/src/eu/kanade/tachiyomi/extension/fr/japscan/Japscan.kt b/src/fr/japscan/src/eu/kanade/tachiyomi/extension/fr/japscan/Japscan.kt index 3d27bd256..1d5ede348 100644 --- a/src/fr/japscan/src/eu/kanade/tachiyomi/extension/fr/japscan/Japscan.kt +++ b/src/fr/japscan/src/eu/kanade/tachiyomi/extension/fr/japscan/Japscan.kt @@ -1,13 +1,11 @@ package eu.kanade.tachiyomi.extension.fr.japscan import android.annotation.SuppressLint -import android.annotation.TargetApi import android.app.Application import android.content.SharedPreferences import android.graphics.Bitmap import android.graphics.Canvas import android.net.Uri -import android.os.Build import android.os.Handler import android.os.Looper import android.util.Log @@ -377,7 +375,6 @@ class Japscan : ConfigurableSource, ParsedHttpSource() { webview.settings.domStorageEnabled = true webview.settings.userAgentString = webview.settings.userAgentString.replace("Mobile", "eliboM").replace("Android", "diordnA") webview.webViewClient = object : WebViewClient() { - @TargetApi(Build.VERSION_CODES.LOLLIPOP) override fun shouldInterceptRequest( view: WebView, request: WebResourceRequest diff --git a/src/ru/comx/src/eu/kanade/tachiyomi/extension/ru/comx/ComX.kt b/src/ru/comx/src/eu/kanade/tachiyomi/extension/ru/comx/ComX.kt index cd491ea82..e262a6d66 100644 --- a/src/ru/comx/src/eu/kanade/tachiyomi/extension/ru/comx/ComX.kt +++ b/src/ru/comx/src/eu/kanade/tachiyomi/extension/ru/comx/ComX.kt @@ -122,25 +122,25 @@ class ComX : ParsedHttpSource() { override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { /** val url = "$baseUrl/index.php?do=xsearch&searchCat=comix-read&page=$page".toHttpUrlOrNull()!!.newBuilder() - (if (filters.isEmpty()) getFilterList() else filters).forEach { filter -> - when (filter) { - is TypeList -> filter.state.forEach { type -> - if (type.state) { - url.addQueryParameter("field[type][${type.id}]", 1.toString()) - } - } - is PubList -> filter.state.forEach { publisher -> - if (publisher.state) { - url.addQueryParameter("subCat[]", publisher.id) - } - } - is GenreList -> filter.state.forEach { genre -> - if (genre.state) { - url.addQueryParameter("field[genre][${genre.id}]", 1.toString()) - } - } - } - }**/ + (if (filters.isEmpty()) getFilterList() else filters).forEach { filter -> + when (filter) { + is TypeList -> filter.state.forEach { type -> + if (type.state) { + url.addQueryParameter("field[type][${type.id}]", 1.toString()) + } + } + is PubList -> filter.state.forEach { publisher -> + if (publisher.state) { + url.addQueryParameter("subCat[]", publisher.id) + } + } + is GenreList -> filter.state.forEach { genre -> + if (genre.state) { + url.addQueryParameter("field[genre][${genre.id}]", 1.toString()) + } + } + } + }**/ if (query.isNotEmpty()) { return POST( "$baseUrl/index.php?do=search&search_start=$page", @@ -259,102 +259,102 @@ class ComX : ParsedHttpSource() { return GET(page.imageUrl!!, headers) } /** - private class CheckFilter(name: String, val id: String) : Filter.CheckBox(name) + private class CheckFilter(name: String, val id: String) : Filter.CheckBox(name) - private class TypeList(types: List) : Filter.Group("Тип выпуска", types) - private class PubList(publishers: List) : Filter.Group("Разделы", publishers) - private class GenreList(genres: List) : Filter.Group("Жанры", genres) + private class TypeList(types: List) : Filter.Group("Тип выпуска", types) + private class PubList(publishers: List) : Filter.Group("Разделы", publishers) + private class GenreList(genres: List) : Filter.Group("Жанры", genres) - override fun getFilterList() = FilterList( - TypeList(getTypeList()), - PubList(getPubList()), - GenreList(getGenreList()), - ) + override fun getFilterList() = FilterList( + TypeList(getTypeList()), + PubList(getPubList()), + GenreList(getGenreList()), + ) - private fun getTypeList() = listOf( - CheckFilter("Лимитка", "1"), - CheckFilter("Ван шот", "2"), - CheckFilter("Графический Роман", "3"), - CheckFilter("Онгоинг", "4"), - ) + private fun getTypeList() = listOf( + CheckFilter("Лимитка", "1"), + CheckFilter("Ван шот", "2"), + CheckFilter("Графический Роман", "3"), + CheckFilter("Онгоинг", "4"), + ) - private fun getPubList() = listOf( - CheckFilter("Marvel", "2"), - CheckFilter("DC Comics", "14"), - CheckFilter("Dark Horse", "7"), - CheckFilter("IDW Publishing", "6"), - CheckFilter("Image", "4"), - CheckFilter("Vertigo", "8"), - CheckFilter("Dynamite Entertainment", "10"), - CheckFilter("Wildstorm", "5"), - CheckFilter("Avatar Press", "11"), - CheckFilter("Boom! Studios", "12"), - CheckFilter("Top Cow", "9"), - CheckFilter("Oni Press", "13"), - CheckFilter("Valiant", "15"), - CheckFilter("Icon Comics", "16"), - CheckFilter("Manga", "3"), - CheckFilter("Manhua", "45"), - CheckFilter("Manhwa", "44"), - CheckFilter("Разные комиксы", "18") - ) + private fun getPubList() = listOf( + CheckFilter("Marvel", "2"), + CheckFilter("DC Comics", "14"), + CheckFilter("Dark Horse", "7"), + CheckFilter("IDW Publishing", "6"), + CheckFilter("Image", "4"), + CheckFilter("Vertigo", "8"), + CheckFilter("Dynamite Entertainment", "10"), + CheckFilter("Wildstorm", "5"), + CheckFilter("Avatar Press", "11"), + CheckFilter("Boom! Studios", "12"), + CheckFilter("Top Cow", "9"), + CheckFilter("Oni Press", "13"), + CheckFilter("Valiant", "15"), + CheckFilter("Icon Comics", "16"), + CheckFilter("Manga", "3"), + CheckFilter("Manhua", "45"), + CheckFilter("Manhwa", "44"), + CheckFilter("Разные комиксы", "18") + ) - private fun getGenreList() = listOf( - CheckFilter("Sci-Fi", "2"), - CheckFilter("Антиутопия", "3"), - CheckFilter("Апокалипсис", "4"), - CheckFilter("Боевик", "5"), - CheckFilter("Боевые искусства", "6"), - CheckFilter("Вампиры", "7"), - CheckFilter("Вестерн", "8"), - CheckFilter("Военный", "9"), - CheckFilter("Детектив", "10"), - CheckFilter("Драма", "11"), - CheckFilter("Зомби", "12"), - CheckFilter("Игры", "13"), - CheckFilter("Исекай", "14"), - CheckFilter("Исторический", "15"), - CheckFilter("Киберпанк", "16"), - CheckFilter("Комедия", "17"), - CheckFilter("Космоопера", "18"), - CheckFilter("Космос", "19"), - CheckFilter("Криминал", "20"), - CheckFilter("МелоДрама", "21"), - CheckFilter("Мистика", "22"), - CheckFilter("Научная Фантастика", "23"), - CheckFilter("Неотвратимость", "24"), - CheckFilter("Нуар", "25"), - CheckFilter("Паника", "26"), - CheckFilter("Пародия", "27"), - CheckFilter("Повседневность", "28"), - CheckFilter("Постапокалиптика", "29"), - CheckFilter("ПредательСредиНас", "30"), - CheckFilter("Приключения", "31"), - CheckFilter("Путешествия во времени", "32"), - CheckFilter("Сверхъестественное", "33"), - CheckFilter("Слэшер", "34"), - CheckFilter("Смерть", "35"), - CheckFilter("Супергерои", "36"), - CheckFilter("Супергероика", "37"), - CheckFilter("Сёнен", "38"), - CheckFilter("Тревога", "39"), - CheckFilter("Триллер", "40"), - CheckFilter("Ужасы", "41"), - CheckFilter("Фантасмагория", "42"), - CheckFilter("Фантастика", "43"), - CheckFilter("Фэнтези", "44"), - CheckFilter("Экшен", "45"), - CheckFilter("Экшн", "46"), - CheckFilter("Эротика", "47"), - CheckFilter("сэйнэн", "66"), - CheckFilter("сёдзё", "67"), - CheckFilter("сёнэн", "68"), - CheckFilter("сёнэн-ай", "69"), - CheckFilter("трагедия", "70"), - CheckFilter("фэнтези", "73"), - CheckFilter("школа", "74"), - CheckFilter("этти", "76"), - CheckFilter("яой", "77"), + private fun getGenreList() = listOf( + CheckFilter("Sci-Fi", "2"), + CheckFilter("Антиутопия", "3"), + CheckFilter("Апокалипсис", "4"), + CheckFilter("Боевик", "5"), + CheckFilter("Боевые искусства", "6"), + CheckFilter("Вампиры", "7"), + CheckFilter("Вестерн", "8"), + CheckFilter("Военный", "9"), + CheckFilter("Детектив", "10"), + CheckFilter("Драма", "11"), + CheckFilter("Зомби", "12"), + CheckFilter("Игры", "13"), + CheckFilter("Исекай", "14"), + CheckFilter("Исторический", "15"), + CheckFilter("Киберпанк", "16"), + CheckFilter("Комедия", "17"), + CheckFilter("Космоопера", "18"), + CheckFilter("Космос", "19"), + CheckFilter("Криминал", "20"), + CheckFilter("МелоДрама", "21"), + CheckFilter("Мистика", "22"), + CheckFilter("Научная Фантастика", "23"), + CheckFilter("Неотвратимость", "24"), + CheckFilter("Нуар", "25"), + CheckFilter("Паника", "26"), + CheckFilter("Пародия", "27"), + CheckFilter("Повседневность", "28"), + CheckFilter("Постапокалиптика", "29"), + CheckFilter("ПредательСредиНас", "30"), + CheckFilter("Приключения", "31"), + CheckFilter("Путешествия во времени", "32"), + CheckFilter("Сверхъестественное", "33"), + CheckFilter("Слэшер", "34"), + CheckFilter("Смерть", "35"), + CheckFilter("Супергерои", "36"), + CheckFilter("Супергероика", "37"), + CheckFilter("Сёнен", "38"), + CheckFilter("Тревога", "39"), + CheckFilter("Триллер", "40"), + CheckFilter("Ужасы", "41"), + CheckFilter("Фантасмагория", "42"), + CheckFilter("Фантастика", "43"), + CheckFilter("Фэнтези", "44"), + CheckFilter("Экшен", "45"), + CheckFilter("Экшн", "46"), + CheckFilter("Эротика", "47"), + CheckFilter("сэйнэн", "66"), + CheckFilter("сёдзё", "67"), + CheckFilter("сёнэн", "68"), + CheckFilter("сёнэн-ай", "69"), + CheckFilter("трагедия", "70"), + CheckFilter("фэнтези", "73"), + CheckFilter("школа", "74"), + CheckFilter("этти", "76"), + CheckFilter("яой", "77"), - )**/ + )**/ } diff --git a/src/zh/tencentcomics/src/eu/kanade/tachiyomi/extension/zh/tencentcomics/TencentComics.kt b/src/zh/tencentcomics/src/eu/kanade/tachiyomi/extension/zh/tencentcomics/TencentComics.kt index 54013305f..c5f8e11bf 100644 --- a/src/zh/tencentcomics/src/eu/kanade/tachiyomi/extension/zh/tencentcomics/TencentComics.kt +++ b/src/zh/tencentcomics/src/eu/kanade/tachiyomi/extension/zh/tencentcomics/TencentComics.kt @@ -37,7 +37,7 @@ class TencentComics : ParsedHttpSource() { override val lang = "zh" override val supportsLatest = true - + override val id: Long = 6353436350537369479 override val client: OkHttpClient = network.cloudflareClient