diff --git a/common.gradle b/common.gradle
index 07a73d20c..9d652843c 100644
--- a/common.gradle
+++ b/common.gradle
@@ -78,7 +78,7 @@ android {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
- freeCompilerArgs += "-Xopt-in=kotlinx.serialization.ExperimentalSerializationApi"
+ freeCompilerArgs += "-opt-in=kotlinx.serialization.ExperimentalSerializationApi"
}
kotlinter {
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index e80a3e9d9..c1d31ff7b 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -9,7 +9,7 @@ gradle-kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.
gradle-serialization = { module = "org.jetbrains.kotlin:kotlin-serialization", version.ref = "kotlin_version" }
gradle-kotlinter = { module = "org.jmailen.gradle:kotlinter-gradle", version = "3.13.0" }
-tachiyomi-lib = { module = "com.github.tachiyomiorg:extensions-lib", version = "1.4.0" }
+tachiyomi-lib = { module = "com.github.tachiyomiorg:extensions-lib", version = "1.4.1" }
kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "kotlin_version" }
kotlin-protobuf = { module = "org.jetbrains.kotlinx:kotlinx-serialization-protobuf", version.ref = "serialization_version" }
@@ -19,11 +19,11 @@ coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", ve
coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "coroutines_version" }
injekt-core = { module = "com.github.inorichi.injekt:injekt-core", version = "65b0440" }
-jsoup = { module = "org.jsoup:jsoup", version = "1.13.1" }
-quickjs = { module = "app.cash.quickjs:quickjs-android", version = "0.9.2" }
-okhttp = { module = "com.squareup.okhttp3:okhttp", version = "4.9.1" }
rxandroid = { module = "io.reactivex:rxandroid", version = "1.2.1" }
rxjava = { module = "io.reactivex:rxjava", version = "1.3.8" }
+jsoup = { module = "org.jsoup:jsoup", version = "1.13.1" }
+okhttp = { module = "com.squareup.okhttp3:okhttp", version = "5.0.0-alpha.11" }
+quickjs = { module = "app.cash.quickjs:quickjs-android", version = "0.9.2" }
[bundles]
common = ["kotlin-stdlib", "coroutines-core", "coroutines-android", "injekt-core", "rxjava", "kotlin-protobuf", "kotlin-json", "jsoup", "okhttp", "tachiyomi-lib", "quickjs"]
diff --git a/multisrc/build.gradle.kts b/multisrc/build.gradle.kts
index 72ab83962..47a76f489 100644
--- a/multisrc/build.gradle.kts
+++ b/multisrc/build.gradle.kts
@@ -16,7 +16,7 @@ android {
}
kotlinOptions {
- freeCompilerArgs += "-Xopt-in=kotlinx.serialization.ExperimentalSerializationApi"
+ freeCompilerArgs += "-opt-in=kotlinx.serialization.ExperimentalSerializationApi"
}
}
diff --git a/multisrc/overrides/libgroup/hentailib/src/HentaiLib.kt b/multisrc/overrides/libgroup/hentailib/src/HentaiLib.kt
index a8219f6f2..43a826d30 100644
--- a/multisrc/overrides/libgroup/hentailib/src/HentaiLib.kt
+++ b/multisrc/overrides/libgroup/hentailib/src/HentaiLib.kt
@@ -29,7 +29,7 @@ class HentaiLib : LibGroup("HentaiLib", "https://hentailib.me", "ru") {
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
if (csrfToken.isEmpty()) {
val tokenResponse = client.newCall(popularMangaRequest(page)).execute()
- val resBody = tokenResponse.body!!.string()
+ val resBody = tokenResponse.body.string()
csrfToken = "_token\" content=\"(.*)\"".toRegex().find(resBody)!!.groups[1]!!.value
}
val url = super.searchMangaRequest(page, query, filters).url.newBuilder()
diff --git a/multisrc/overrides/libgroup/mangalib/src/MangaLib.kt b/multisrc/overrides/libgroup/mangalib/src/MangaLib.kt
index 8bce9f001..c676706ca 100644
--- a/multisrc/overrides/libgroup/mangalib/src/MangaLib.kt
+++ b/multisrc/overrides/libgroup/mangalib/src/MangaLib.kt
@@ -45,7 +45,7 @@ class MangaLib : LibGroup("MangaLib", "https://mangalib.me", "ru") {
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
if (csrfToken.isEmpty()) {
val tokenResponse = client.newCall(popularMangaRequest(page)).execute()
- val resBody = tokenResponse.body!!.string()
+ val resBody = tokenResponse.body.string()
csrfToken = "_token\" content=\"(.*)\"".toRegex().find(resBody)!!.groups[1]!!.value
}
val url = super.searchMangaRequest(page, query, filters).url.newBuilder()
diff --git a/multisrc/overrides/libgroup/yaoilib/src/YaoiLib.kt b/multisrc/overrides/libgroup/yaoilib/src/YaoiLib.kt
index b559b8c26..d96dea964 100644
--- a/multisrc/overrides/libgroup/yaoilib/src/YaoiLib.kt
+++ b/multisrc/overrides/libgroup/yaoilib/src/YaoiLib.kt
@@ -27,7 +27,7 @@ class YaoiLib : LibGroup("YaoiLib", "https://v1.yaoilib.net", "ru") {
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
if (csrfToken.isEmpty()) {
val tokenResponse = client.newCall(popularMangaRequest(page)).execute()
- val resBody = tokenResponse.body!!.string()
+ val resBody = tokenResponse.body.string()
csrfToken = "_token\" content=\"(.*)\"".toRegex().find(resBody)!!.groups[1]!!.value
}
val url = super.searchMangaRequest(page, query, filters).url.newBuilder()
diff --git a/multisrc/overrides/madara/immortalupdates/src/ImmortalUpdates.kt b/multisrc/overrides/madara/immortalupdates/src/ImmortalUpdates.kt
index c060a3dfc..2ede5176b 100644
--- a/multisrc/overrides/madara/immortalupdates/src/ImmortalUpdates.kt
+++ b/multisrc/overrides/madara/immortalupdates/src/ImmortalUpdates.kt
@@ -35,7 +35,7 @@ class ImmortalUpdates : Madara("Immortal Updates", "https://immortalupdates.com"
val fragment = response.request.url.fragment!!
val args = fragment.substringAfter("$DESCRAMBLE=").split(",")
- val image = unscrambleImage(response.body!!.byteStream(), args)
+ val image = unscrambleImage(response.body.byteStream(), args)
val body = image.toResponseBody("image/jpeg".toMediaTypeOrNull())
return@addInterceptor response.newBuilder()
.body(body)
@@ -50,7 +50,7 @@ class ImmortalUpdates : Madara("Immortal Updates", "https://immortalupdates.com"
val unscramblingCalls = client.newCall(GET(unscramblingCallsPage.imageUrl!!, headers))
.execute()
- .use { it.body!!.string() }
+ .use { it.body.string() }
unscramblingCalls.replace("\r", "").split("\n").filter { !it.isNullOrBlank() }.forEach {
val args = unfuckJs(it)
diff --git a/multisrc/overrides/mangabz/mangabz/src/Mangabz.kt b/multisrc/overrides/mangabz/mangabz/src/Mangabz.kt
index 7e321eca3..d28bef540 100644
--- a/multisrc/overrides/mangabz/mangabz/src/Mangabz.kt
+++ b/multisrc/overrides/mangabz/mangabz/src/Mangabz.kt
@@ -127,7 +127,7 @@ class Mangabz : MangabzTheme("Mangabz", ""), ConfigurableSource {
}
return client.newCall(GET(page.url, headers)).asObservableSuccess().map {
- val script = Unpacker.unpack(it.body!!.string())
+ val script = Unpacker.unpack(it.body.string())
val parser = SubstringExtractor(script)
val prefix = parser.substringBetween("pix=\"", "\"")
// 2 pages, or 15 if server cache is ready
diff --git a/multisrc/overrides/mangabz/vomic/src/Vomic.kt b/multisrc/overrides/mangabz/vomic/src/Vomic.kt
index c729858ad..a6fb925eb 100644
--- a/multisrc/overrides/mangabz/vomic/src/Vomic.kt
+++ b/multisrc/overrides/mangabz/vomic/src/Vomic.kt
@@ -95,7 +95,7 @@ class Vomic : MangabzTheme("vomic", ""), ConfigurableSource {
override fun getChapterElements(document: Document): Elements {
val chapterId = document.location().removeSuffix("_c/").substringAfterLast('/')
val response = client.newCall(GET("$baseUrl/chapter-$chapterId-s2/", headers)).execute()
- return Jsoup.parseBodyFragment(response.body!!.string()).body().children()
+ return Jsoup.parseBodyFragment(response.body.string()).body().children()
}
override val needPageCount = false
@@ -106,7 +106,7 @@ class Vomic : MangabzTheme("vomic", ""), ConfigurableSource {
}
override fun pageListParse(response: Response): List {
- val urls = response.body!!.string().run {
+ val urls = response.body.string().run {
val left = indexOf('[')
val right = lastIndexOf(']')
if (left + 1 == right) return emptyList()
diff --git a/multisrc/overrides/mangaraw/manga9co/src/MangaRaw.kt b/multisrc/overrides/mangaraw/manga9co/src/MangaRaw.kt
index 65e3090a0..7f30e3cb1 100644
--- a/multisrc/overrides/mangaraw/manga9co/src/MangaRaw.kt
+++ b/multisrc/overrides/mangaraw/manga9co/src/MangaRaw.kt
@@ -71,7 +71,7 @@ class MangaRaw : MangaRawTheme("MangaRaw", ""), ConfigurableSource {
override fun pageListParse(response: Response): List {
if (!isPagesShuffled) return super.pageListParse(response)
- val html = response.body!!.string()
+ val html = response.body.string()
val imageList = ImageListParser(html, 32).getImageList() ?: return emptyList()
return imageList.mapIndexed { index, imageUrl ->
Page(index, imageUrl = imageUrl)
diff --git a/multisrc/overrides/mangathemesia/constellarscans/src/ConstellarScans.kt b/multisrc/overrides/mangathemesia/constellarscans/src/ConstellarScans.kt
index 47b647980..7e96a214d 100644
--- a/multisrc/overrides/mangathemesia/constellarscans/src/ConstellarScans.kt
+++ b/multisrc/overrides/mangathemesia/constellarscans/src/ConstellarScans.kt
@@ -45,7 +45,7 @@ class ConstellarScans : MangaThemesia("Constellar Scans", "https://constellarsca
private val mobileUserAgent by lazy {
val req = GET(UA_DB_URL)
- val data = client.newCall(req).execute().body!!.use {
+ val data = client.newCall(req).execute().body.use {
json.parseToJsonElement(it.string()).jsonArray
}.mapNotNull {
it.jsonObject["user-agent"]?.jsonPrimitive?.content?.takeIf { ua ->
@@ -88,7 +88,7 @@ class ConstellarScans : MangaThemesia("Constellar Scans", "https://constellarsca
}
private val funkyScript by lazy {
- client.newCall(GET(FUNKY_SCRIPT_URL)).execute().body!!.string()
+ client.newCall(GET(FUNKY_SCRIPT_URL)).execute().body.string()
}
@SuppressLint("SetJavaScriptEnabled")
diff --git a/multisrc/overrides/mangathemesia/flamescans/src/FlameScans.kt b/multisrc/overrides/mangathemesia/flamescans/src/FlameScans.kt
index 89187f6f3..bb1e4de7d 100644
--- a/multisrc/overrides/mangathemesia/flamescans/src/FlameScans.kt
+++ b/multisrc/overrides/mangathemesia/flamescans/src/FlameScans.kt
@@ -100,7 +100,7 @@ open class FlameScans(
val request = chain.request().newBuilder().url(imageUrl).build()
val response = chain.proceed(request)
- val bitmap = BitmapFactory.decodeStream(response.body!!.byteStream())
+ val bitmap = BitmapFactory.decodeStream(response.body.byteStream())
width += bitmap.width
height = bitmap.height
diff --git a/multisrc/overrides/mangathemesia/mangkomik/src/MangKomik.kt b/multisrc/overrides/mangathemesia/mangkomik/src/MangKomik.kt
index cd466067b..4f067ffbe 100644
--- a/multisrc/overrides/mangathemesia/mangkomik/src/MangKomik.kt
+++ b/multisrc/overrides/mangathemesia/mangkomik/src/MangKomik.kt
@@ -21,7 +21,7 @@ class MangKomik : MangaThemesia("MangKomik", "https://mangkomik.net", "id") {
).execute()
// Inject external JS
- scriptEl.text(scriptResponse.body!!.string())
+ scriptEl.text(scriptResponse.body.string())
return super.pageListParse(document)
}
}
diff --git a/multisrc/overrides/mangathemesia/xcalibrscans/src/AntiScrapInterceptor.kt b/multisrc/overrides/mangathemesia/xcalibrscans/src/AntiScrapInterceptor.kt
index 72f99c080..548ea0c78 100644
--- a/multisrc/overrides/mangathemesia/xcalibrscans/src/AntiScrapInterceptor.kt
+++ b/multisrc/overrides/mangathemesia/xcalibrscans/src/AntiScrapInterceptor.kt
@@ -30,7 +30,7 @@ class AntiScrapInterceptor : Interceptor {
val newRequest = request.newBuilder().url(imageUrl).build()
val response = chain.proceed(newRequest)
- val bitmap = BitmapFactory.decodeStream(response.body!!.byteStream())
+ val bitmap = BitmapFactory.decodeStream(response.body.byteStream())
response.close()
width += bitmap.width
diff --git a/multisrc/overrides/multichan/henchan/src/HenChan.kt b/multisrc/overrides/multichan/henchan/src/HenChan.kt
index 8ee7ec2fc..ae3e2648e 100644
--- a/multisrc/overrides/multichan/henchan/src/HenChan.kt
+++ b/multisrc/overrides/multichan/henchan/src/HenChan.kt
@@ -234,7 +234,7 @@ class HenChan : MultiChan("HenChan", "http://y.hchan.live", "ru"), ConfigurableS
}
override fun pageListParse(response: Response): List {
- val html = response.body!!.string()
+ val html = response.body.string()
val prefix = "fullimg\": ["
val beginIndex = html.indexOf(prefix) + prefix.length
val endIndex = html.indexOf("]", beginIndex)
diff --git a/multisrc/overrides/sinmh/gufengmh/src/Gufengmh.kt b/multisrc/overrides/sinmh/gufengmh/src/Gufengmh.kt
index 8a703cc90..ee9548db9 100644
--- a/multisrc/overrides/sinmh/gufengmh/src/Gufengmh.kt
+++ b/multisrc/overrides/sinmh/gufengmh/src/Gufengmh.kt
@@ -41,7 +41,7 @@ class Gufengmh : SinMH("古风漫画网", "https://www.123gf.com") {
val response = client.newCall(GET(baseUrl + prevUrl, headers)).execute()
chapter.url = buildString {
append(prevUrl, 0, prevUrl.lastIndexOf('/') + 1)
- append(ProgressiveParser(response.body!!.string()).substringBetween("""nextChapterData = {"id":""", ","))
+ append(ProgressiveParser(response.body.string()).substringBetween("""nextChapterData = {"id":""", ","))
append(".html")
}
}
diff --git a/multisrc/overrides/sinmh/wuqimanga/src/WuqiManga.kt b/multisrc/overrides/sinmh/wuqimanga/src/WuqiManga.kt
index 20ed9df20..b582138ab 100644
--- a/multisrc/overrides/sinmh/wuqimanga/src/WuqiManga.kt
+++ b/multisrc/overrides/sinmh/wuqimanga/src/WuqiManga.kt
@@ -55,7 +55,7 @@ class WuqiManga : SinMH("57漫画", "http://www.wuqimh.net") {
override val imageHost: String by lazy {
client.newCall(GET("$mobileUrl/templates_pc/default/scripts/configs.js", headers)).execute().let {
- Regex("""\['(.+?)']""").find(it.body!!.string())!!.groupValues[1].run { "http://$this" }
+ Regex("""\['(.+?)']""").find(it.body.string())!!.groupValues[1].run { "http://$this" }
}
}
diff --git a/multisrc/overrides/webtoons/webtoons/src/WebtoonsSrc.kt b/multisrc/overrides/webtoons/webtoons/src/WebtoonsSrc.kt
index 6218bf040..77f480844 100644
--- a/multisrc/overrides/webtoons/webtoons/src/WebtoonsSrc.kt
+++ b/multisrc/overrides/webtoons/webtoons/src/WebtoonsSrc.kt
@@ -81,7 +81,7 @@ open class WebtoonsSrc(
val motiontoonPath = motiontoonPathRegex.find(docString)!!.destructured.toList()[0]
val motiontoonResponse = client.newCall(GET(docUrl, headers)).execute()
- val motiontoonJson = json.parseToJsonElement(motiontoonResponse.body!!.string()).jsonObject
+ val motiontoonJson = json.parseToJsonElement(motiontoonResponse.body.string()).jsonObject
val motiontoonImages = motiontoonJson["assets"]!!.jsonObject["image"]!!.jsonObject
return motiontoonImages.entries
diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/a3manga/A3Manga.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/a3manga/A3Manga.kt
index e446544f1..b0e5511b6 100644
--- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/a3manga/A3Manga.kt
+++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/a3manga/A3Manga.kt
@@ -183,7 +183,7 @@ open class A3Manga(
override fun imageUrlParse(document: Document) = throw UnsupportedOperationException("Not used")
private inline fun Response.parseAs(): T {
- return json.decodeFromString(body?.string().orEmpty())
+ return json.decodeFromString(body.string())
}
// https://stackoverflow.com/a/66614516
diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/bakkin/BakkinReaderX.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/bakkin/BakkinReaderX.kt
index b9e627d8f..757d2b153 100644
--- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/bakkin/BakkinReaderX.kt
+++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/bakkin/BakkinReaderX.kt
@@ -49,7 +49,7 @@ abstract class BakkinReaderX(
rx.Observable.just(block(seriesCache))!!
} else {
client.newCall(GET(mainUrl, headers)).asObservableSuccess().map {
- seriesCache = json.parseToJsonElement(it.body!!.string())
+ seriesCache = json.parseToJsonElement(it.body.string())
.jsonObject.values.map(json::decodeFromJsonElement)
block(seriesCache)
}!!
diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/bilibili/Bilibili.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/bilibili/Bilibili.kt
index 42f3067c2..a072d55c4 100644
--- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/bilibili/Bilibili.kt
+++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/bilibili/Bilibili.kt
@@ -412,7 +412,7 @@ abstract class Bilibili(
}
protected inline fun Response.parseAs(): BilibiliResultDto = use {
- json.decodeFromString(it.body?.string().orEmpty())
+ json.decodeFromString(it.body.string())
}
private fun String.toDate(): Long {
diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/comicake/ComiCake.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/comicake/ComiCake.kt
index 078115c1e..316f420e0 100644
--- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/comicake/ComiCake.kt
+++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/comicake/ComiCake.kt
@@ -45,7 +45,7 @@ abstract class ComiCake(
}
override fun popularMangaParse(response: Response): MangasPage {
- val res = response.body!!.string()
+ val res = response.body.string()
return getMangasPageFromComicsResponse(res)
}
@@ -99,7 +99,7 @@ abstract class ComiCake(
}
override fun mangaDetailsParse(response: Response): SManga {
- val comicJson = JSONObject(response.body!!.string())
+ val comicJson = JSONObject(response.body.string())
return parseComicJson(comicJson, true)
}
@@ -132,7 +132,7 @@ abstract class ComiCake(
}
override fun searchMangaParse(response: Response): MangasPage {
- val res = response.body!!.string()
+ val res = response.body.string()
return getMangasPageFromComicsResponse(res)
}
@@ -141,7 +141,7 @@ abstract class ComiCake(
}
override fun latestUpdatesParse(response: Response): MangasPage {
- val res = response.body!!.string()
+ val res = response.body.string()
return getMangasPageFromComicsResponse(res, true)
}
@@ -158,7 +158,7 @@ abstract class ComiCake(
}
override fun chapterListParse(response: Response): List {
- val chapterJson = JSONObject(response.body!!.string())
+ val chapterJson = JSONObject(response.body.string())
val results = chapterJson.getJSONArray("results")
val ret = ArrayList()
for (i in 0 until results.length()) {
@@ -168,7 +168,7 @@ abstract class ComiCake(
}
override fun pageListParse(response: Response): List {
- val webPub = JSONObject(response.body!!.string())
+ val webPub = JSONObject(response.body.string())
val readingOrder = webPub.getJSONArray("readingOrder")
val ret = ArrayList()
for (i in 0 until readingOrder.length()) {
diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/comicgamma/PtImgInterceptor.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/comicgamma/PtImgInterceptor.kt
index a006809b0..fde055bf6 100644
--- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/comicgamma/PtImgInterceptor.kt
+++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/comicgamma/PtImgInterceptor.kt
@@ -24,11 +24,11 @@ object PtImgInterceptor : Interceptor {
val path = url.pathSegments
if (!path.last().endsWith(".ptimg.json")) return response
- val metadata = json.decodeFromString(response.body!!.string())
+ val metadata = json.decodeFromString(response.body.string())
val imageUrl = url.newBuilder().setEncodedPathSegment(path.size - 1, metadata.getFilename()).build()
val imgRequest = request.newBuilder().url(imageUrl).build()
val imgResponse = chain.proceed(imgRequest)
- val image = BitmapFactory.decodeStream(imgResponse.body!!.byteStream())
+ val image = BitmapFactory.decodeStream(imgResponse.body.byteStream())
val (width, height) = metadata.getViewSize()
val result = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888)
val view = Canvas(result)
diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/gigaviewer/GigaViewer.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/gigaviewer/GigaViewer.kt
index 80fa62acf..77c83b9bd 100644
--- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/gigaviewer/GigaViewer.kt
+++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/gigaviewer/GigaViewer.kt
@@ -157,7 +157,7 @@ abstract class GigaViewer(
var result = client.newCall(request).execute()
while (result.code != 404) {
- val jsonResult = json.parseToJsonElement(result.body!!.string()).jsonObject
+ val jsonResult = json.parseToJsonElement(result.body.string()).jsonObject
readMoreEndpoint = jsonResult["nextUrl"]!!.jsonPrimitive.content
val tempDocument = Jsoup.parse(
jsonResult["html"]!!.jsonPrimitive.content,
@@ -265,7 +265,7 @@ abstract class GigaViewer(
request = request.newBuilder().url(newUrl).build()
val response = chain.proceed(request)
- val image = decodeImage(response.body!!.byteStream(), width, height)
+ val image = decodeImage(response.body.byteStream(), width, height)
val body = image.toResponseBody(jpegMediaType)
response.close()
diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/grouple/GroupLe.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/grouple/GroupLe.kt
index 9ff758c68..b0029aaa7 100644
--- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/grouple/GroupLe.kt
+++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/grouple/GroupLe.kt
@@ -251,7 +251,7 @@ abstract class GroupLe(
}
override fun pageListParse(response: Response): List {
- val html = response.body!!.string()
+ val html = response.body.string()
var readerMark = "rm_h.initReader( ["
diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/guya/Guya.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/guya/Guya.kt
index a0f578be6..c28be0347 100644
--- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/guya/Guya.kt
+++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/guya/Guya.kt
@@ -59,7 +59,7 @@ abstract class Guya(
// Gets the response object from the request
override fun popularMangaParse(response: Response): MangasPage {
- val res = response.body!!.string()
+ val res = response.body.string()
return parseManga(JSONObject(res))
}
@@ -68,7 +68,7 @@ abstract class Guya(
}
override fun latestUpdatesParse(response: Response): MangasPage {
- val payload = JSONObject(response.body!!.string())
+ val payload = JSONObject(response.body.string())
val mangas = sortedMapOf()
for (series in payload.keys()) {
@@ -109,7 +109,7 @@ abstract class Guya(
}
private fun mangaDetailsParse(response: Response, manga: SManga): SManga {
- val res = response.body!!.string()
+ val res = response.body.string()
return parseMangaFromJson(JSONObject(res), "", manga.title)
}
@@ -139,7 +139,7 @@ abstract class Guya(
// Called after the request
private fun chapterListParse(response: Response, manga: SManga): List {
- return parseChapterList(response.body!!.string(), manga)
+ return parseChapterList(response.body.string(), manga)
}
// Overridden fetch so that we use our overloaded method instead
@@ -167,7 +167,7 @@ abstract class Guya(
}
private fun pageListParse(response: Response, chapter: SChapter): List {
- val res = response.body!!.string()
+ val res = response.body.string()
val json = JSONObject(res)
val chapterNum = chapter.name.split(" - ")[0]
@@ -221,7 +221,7 @@ abstract class Guya(
}
protected open fun searchMangaParseWithSlug(response: Response, slug: String): MangasPage {
- val results = JSONObject(response.body!!.string())
+ val results = JSONObject(response.body.string())
val truncatedJSON = JSONObject()
for (mangaTitle in results.keys()) {
@@ -236,7 +236,7 @@ abstract class Guya(
}
protected open fun searchMangaParse(response: Response, query: String): MangasPage {
- val res = response.body!!.string()
+ val res = response.body.string()
val json = JSONObject(res)
val truncatedJSON = JSONObject()
@@ -310,7 +310,7 @@ abstract class Guya(
}
private fun proxyPageListParse(response: Response, chapter: SChapter): List {
- val res = response.body!!.string()
+ val res = response.body.string()
val pages = if (chapter.url.removePrefix(PROXY_PREFIX).startsWith(NESTED_PROXY_API_PREFIX)) {
JSONArray(res)
} else {
@@ -338,7 +338,7 @@ abstract class Guya(
}
protected open fun proxySearchMangaParse(response: Response, query: String): MangasPage {
- val json = JSONObject(response.body!!.string())
+ val json = JSONObject(response.body.string())
return MangasPage(listOf(parseMangaFromJson(json, query)), false)
}
@@ -531,7 +531,7 @@ abstract class Guya(
if (!response.isSuccessful) {
retryCount++
} else {
- val json = JSONObject(response.body!!.string())
+ val json = JSONObject(response.body.string())
for (scanId in json.keys()) {
scanlatorMap[scanId] = json.getString(scanId)
}
diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/heancms/HeanCms.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/heancms/HeanCms.kt
index cfa2d16e0..929f27004 100644
--- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/heancms/HeanCms.kt
+++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/heancms/HeanCms.kt
@@ -70,7 +70,7 @@ abstract class HeanCms(
}
override fun popularMangaParse(response: Response): MangasPage {
- val json = response.body?.string().orEmpty()
+ val json = response.body.string()
if (json.startsWith("{")) {
val result = json.parseAs()
@@ -153,7 +153,7 @@ abstract class HeanCms(
}
override fun searchMangaParse(response: Response): MangasPage {
- val json = response.body?.string().orEmpty()
+ val json = response.body.string()
if (response.request.url.pathSegments.last() == "search") {
fetchAllTitles()
@@ -300,7 +300,7 @@ abstract class HeanCms(
while (hasNextPage) {
val response = client.newCall(allTitlesRequest(page)).execute()
- val json = response.body?.string().orEmpty()
+ val json = response.body.string()
if (json.startsWith("{")) {
val result = json.parseAs()
@@ -368,7 +368,7 @@ abstract class HeanCms(
}
private inline fun Response.parseAs(): T = use {
- it.body?.string().orEmpty().parseAs()
+ it.body.string().parseAs()
}
private inline fun String.parseAs(): T = json.decodeFromString(this)
diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/hentaihand/HentaiHand.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/hentaihand/HentaiHand.kt
index 2115e4cfe..36232327d 100644
--- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/hentaihand/HentaiHand.kt
+++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/hentaihand/HentaiHand.kt
@@ -65,7 +65,7 @@ abstract class HentaiHand(
// Popular
override fun popularMangaParse(response: Response): MangasPage {
- val jsonResponse = json.parseToJsonElement(response.body!!.string())
+ val jsonResponse = json.parseToJsonElement(response.body.string())
val mangaList = jsonResponse.jsonObject["data"]!!.jsonArray.map {
val obj = it.jsonObject
SManga.create().apply {
@@ -118,7 +118,7 @@ abstract class HentaiHand(
.subscribeOn(Schedulers.io())
.map { response ->
// Returns the first matched id, or null if there are no results
- val idList = json.parseToJsonElement(response.body!!.string()).jsonObject["data"]!!.jsonArray.map {
+ val idList = json.parseToJsonElement(response.body.string()).jsonObject["data"]!!.jsonArray.map {
it.jsonObject["id"]!!.jsonPrimitive.content
}
if (idList.isEmpty()) {
@@ -179,7 +179,7 @@ abstract class HentaiHand(
}
override fun mangaDetailsParse(response: Response): SManga {
- val obj = json.parseToJsonElement(response.body!!.string()).jsonObject
+ val obj = json.parseToJsonElement(response.body.string()).jsonObject
return SManga.create().apply {
url = slugToUrl(obj)
title = obj["title"]!!.jsonPrimitive.content
@@ -224,7 +224,7 @@ abstract class HentaiHand(
override fun chapterListParse(response: Response): List {
val slug = response.request.url.toString().substringAfter("/api/comics/").removeSuffix("/chapters")
return if (chapters) {
- val array = json.parseToJsonElement(response.body!!.string()).jsonArray
+ val array = json.parseToJsonElement(response.body.string()).jsonArray
array.map {
SChapter.create().apply {
url = "$slug/${it.jsonObject["slug"]!!.jsonPrimitive.content}"
@@ -240,7 +240,7 @@ abstract class HentaiHand(
}
}
} else {
- val obj = json.parseToJsonElement(response.body!!.string()).jsonObject
+ val obj = json.parseToJsonElement(response.body.string()).jsonObject
listOf(
SChapter.create().apply {
url = obj["slug"]!!.jsonPrimitive.content
@@ -267,7 +267,7 @@ abstract class HentaiHand(
}
override fun pageListParse(response: Response): List =
- json.parseToJsonElement(response.body!!.string()).jsonObject["images"]!!.jsonArray.map {
+ json.parseToJsonElement(response.body.string()).jsonObject["images"]!!.jsonArray.map {
val imgObj = it.jsonObject
val index = imgObj["page"]!!.jsonPrimitive.int
val imgUrl = imgObj["source_url"]!!.jsonPrimitive.content
@@ -304,13 +304,9 @@ abstract class HentaiHand(
if (response.code == 401) {
throw IOException("Failed to login, check if username and password are correct")
}
-
- if (response.body == null) {
- throw IOException("Login response body is empty")
- }
try {
// Returns access token as a string, unless unparseable
- return json.parseToJsonElement(response.body!!.string()).jsonObject["auth"]!!.jsonObject["access-token"]!!.jsonPrimitive.content
+ return json.parseToJsonElement(response.body.string()).jsonObject["auth"]!!.jsonObject["access-token"]!!.jsonPrimitive.content
} catch (e: IllegalArgumentException) {
throw IOException("Cannot parse login response body")
}
diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/kemono/Kemono.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/kemono/Kemono.kt
index 21d3b35a0..09fcbad4a 100644
--- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/kemono/Kemono.kt
+++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/kemono/Kemono.kt
@@ -150,7 +150,7 @@ open class Kemono(
private fun cacheCreators() {
val callback = object : Callback {
override fun onResponse(call: Call, response: Response) =
- response.body!!.source().run {
+ response.body.source().run {
readAll(blackholeSink())
close()
}
@@ -200,7 +200,7 @@ open class Kemono(
override fun imageUrlParse(response: Response) = throw UnsupportedOperationException("Not used.")
private inline fun Response.parseAs(): T = use {
- json.decodeFromStream(it.body!!.byteStream())
+ json.decodeFromStream(it.body.byteStream())
}
override fun setupPreferenceScreen(screen: PreferenceScreen) {
diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/libgroup/LibGenerator.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/libgroup/LibGenerator.kt
index 9cc3e8678..99b6e96d2 100644
--- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/libgroup/LibGenerator.kt
+++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/libgroup/LibGenerator.kt
@@ -9,7 +9,7 @@ class LibGenerator : ThemeSourceGenerator {
override val themeClass = "LibGroup"
- override val baseVersionCode: Int = 14
+ override val baseVersionCode: Int = 15
override val sources = listOf(
SingleLang("MangaLib", "https://mangalib.me", "ru", overrideVersionCode = 74),
diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/libgroup/LibGroup.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/libgroup/LibGroup.kt
index 17d4bca18..40e0d1712 100644
--- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/libgroup/LibGroup.kt
+++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/libgroup/LibGroup.kt
@@ -70,7 +70,7 @@ abstract class LibGroup(
val possibleType = urlRequest.substringAfterLast("/").substringBefore("?").split(".")
return if (urlRequest.contains("/chapters/") and (possibleType.size == 2)) {
val realType = possibleType[1]
- val image = response.body?.byteString()?.toResponseBody("image/$realType".toMediaType())
+ val image = response.body.byteString().toResponseBody("image/$realType".toMediaType())
response.newBuilder().body(image).build()
} else {
response
@@ -120,7 +120,7 @@ abstract class LibGroup(
.asObservableSuccess()
.flatMap { response ->
// Obtain token
- val resBody = response.body!!.string()
+ val resBody = response.body.string()
csrfToken = "_token\" content=\"(.*)\"".toRegex().find(resBody)!!.groups[1]!!.value
return@flatMap fetchLatestMangaFromApi(page)
}
@@ -147,7 +147,7 @@ abstract class LibGroup(
.asObservableSuccess()
.flatMap { response ->
// Obtain token
- val resBody = response.body!!.string()
+ val resBody = response.body.string()
csrfToken = "_token\" content=\"(.*)\"".toRegex().find(resBody)!!.groups[1]!!.value
return@flatMap fetchPopularMangaFromApi(page)
}
@@ -164,7 +164,7 @@ abstract class LibGroup(
}
override fun popularMangaParse(response: Response): MangasPage {
- val resBody = response.body!!.string()
+ val resBody = response.body.string()
val result = json.decodeFromString(resBody)
val items = result["items"]!!.jsonObject
val popularMangas = items["data"]?.jsonArray?.map { popularMangaFromElement(it) }
@@ -266,15 +266,15 @@ abstract class LibGroup(
}
manga.genre = category + ", " + rawAgeStop + ", " + genres.joinToString { it.trim() }
- val altName = if (dataManga!!.jsonObject["altNames"]?.jsonArray.orEmpty().isNotEmpty()) {
+ val altName = if (dataManga.jsonObject["altNames"]?.jsonArray.orEmpty().isNotEmpty()) {
"Альтернативные названия:\n" + dataManga.jsonObject["altNames"]!!.jsonArray.joinToString(" / ") { it.jsonPrimitive.content } + "\n\n"
} else {
""
}
val mediaNameLanguage = when {
- isEng.equals("eng") && dataManga!!.jsonObject["rusName"]?.jsonPrimitive?.content.orEmpty().isNotEmpty() -> dataManga.jsonObject["rusName"]!!.jsonPrimitive.content + "\n"
- isEng.equals("rus") && dataManga!!.jsonObject["engName"]?.jsonPrimitive?.content.orEmpty().isNotEmpty() -> dataManga.jsonObject["engName"]!!.jsonPrimitive.content + "\n"
+ isEng.equals("eng") && dataManga.jsonObject["rusName"]?.jsonPrimitive?.content.orEmpty().isNotEmpty() -> dataManga.jsonObject["rusName"]!!.jsonPrimitive.content + "\n"
+ isEng.equals("rus") && dataManga.jsonObject["engName"]?.jsonPrimitive?.content.orEmpty().isNotEmpty() -> dataManga.jsonObject["engName"]!!.jsonPrimitive.content + "\n"
else -> ""
}
manga.description = mediaNameLanguage + ratingStar + " " + ratingValue + " (голосов: " + ratingVotes + ")\n" + altName + document.select(".media-description__text").text()
@@ -536,7 +536,7 @@ abstract class LibGroup(
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
if (csrfToken.isEmpty()) {
val tokenResponse = client.newCall(popularMangaRequest(page)).execute()
- val resBody = tokenResponse.body!!.string()
+ val resBody = tokenResponse.body.string()
csrfToken = "_token\" content=\"(.*)\"".toRegex().find(resBody)!!.groups[1]!!.value
}
val url = "$baseUrl/filterlist?page=$page".toHttpUrlOrNull()!!.newBuilder()
diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/Madara.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/Madara.kt
index 9d96aad6d..a81b564dd 100644
--- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/Madara.kt
+++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/Madara.kt
@@ -95,7 +95,7 @@ abstract class Madara(
if (uaResponse.isSuccessful) {
var listUserAgentString =
- json.decodeFromString
", "").replace("", "\n").replace("", "")
diff --git a/src/all/littlegarden/src/eu/kanade/tachiyomi/extension/all/littlegarden/LittleGarden.kt b/src/all/littlegarden/src/eu/kanade/tachiyomi/extension/all/littlegarden/LittleGarden.kt
index 77e4f4e00..33de7bc11 100644
--- a/src/all/littlegarden/src/eu/kanade/tachiyomi/extension/all/littlegarden/LittleGarden.kt
+++ b/src/all/littlegarden/src/eu/kanade/tachiyomi/extension/all/littlegarden/LittleGarden.kt
@@ -153,7 +153,7 @@ class LittleGarden : ParsedHttpSource() {
.headers(newHeaders)
.build()
val resp = client.newCall(request).execute()
- val chapters = Json.parseToJsonElement(resp.body?.string().toString()).jsonObject["data"]?.jsonObject?.get("chapters")?.jsonArray
+ val chapters = Json.parseToJsonElement(resp.body.string()).jsonObject["data"]?.jsonObject?.get("chapters")?.jsonArray
if (chapters != null) {
return chapters.map {
SChapter.create().apply {
diff --git a/src/all/luscious/src/eu/kanade/tachiyomi/extension/all/luscious/Luscious.kt b/src/all/luscious/src/eu/kanade/tachiyomi/extension/all/luscious/Luscious.kt
index 1349a7d72..e0db253ad 100644
--- a/src/all/luscious/src/eu/kanade/tachiyomi/extension/all/luscious/Luscious.kt
+++ b/src/all/luscious/src/eu/kanade/tachiyomi/extension/all/luscious/Luscious.kt
@@ -67,7 +67,7 @@ abstract class Luscious(
private val rewriteOctetStream: Interceptor = Interceptor { chain ->
val originalResponse: Response = chain.proceed(chain.request())
if (originalResponse.headers("Content-Type").contains("application/octet-stream") && originalResponse.request.url.toString().contains(".webp")) {
- val orgBody = originalResponse.body!!.bytes()
+ val orgBody = originalResponse.body.bytes()
val newBody = orgBody.toResponseBody("image/webp".toMediaTypeOrNull())
originalResponse.newBuilder()
.body(newBody)
@@ -215,7 +215,7 @@ abstract class Luscious(
}
private fun parseAlbumListResponse(response: Response): MangasPage {
- val data = json.decodeFromString(response.body!!.string())
+ val data = json.decodeFromString(response.body.string())
with(data["data"]!!.jsonObject["album"]!!.jsonObject["list"]) {
return MangasPage(
this!!.jsonObject["items"]!!.jsonArray.map {
@@ -281,7 +281,7 @@ abstract class Luscious(
.let { it.first { f -> f.jsonObject["name"]!!.jsonPrimitive.content == "album_id" } }
.let { it.jsonObject["value"]!!.jsonPrimitive.content }
- var data = json.decodeFromString(response.body!!.string())
+ var data = json.decodeFromString(response.body.string())
.let { it.jsonObject["data"]!!.jsonObject["picture"]!!.jsonObject["list"]!!.jsonObject }
while (nextPage) {
@@ -303,7 +303,7 @@ abstract class Luscious(
}
if (nextPage) {
val newPage = client.newCall(GET(buildAlbumPicturesPageUrl(id, page))).execute()
- data = json.decodeFromString(newPage.body!!.string())
+ data = json.decodeFromString(newPage.body.string())
.let { it["data"]!!.jsonObject["picture"]!!.jsonObject["list"]!!.jsonObject }
}
page++
@@ -353,7 +353,7 @@ abstract class Luscious(
.let { it.first { f -> f.jsonObject["name"]!!.jsonPrimitive.content == "album_id" } }
.let { it.jsonObject["value"]!!.jsonPrimitive.content }
- var data = json.decodeFromString(response.body!!.string())
+ var data = json.decodeFromString(response.body.string())
.let { it["data"]!!.jsonObject["picture"]!!.jsonObject["list"]!!.jsonObject }
while (nextPage) {
@@ -371,7 +371,7 @@ abstract class Luscious(
}
if (nextPage) {
val newPage = client.newCall(GET(buildAlbumPicturesPageUrl(id, page))).execute()
- data = json.decodeFromString(newPage.body!!.string())
+ data = json.decodeFromString(newPage.body.string())
.let { it["data"]!!.jsonObject["picture"]!!.jsonObject["list"]!!.jsonObject }
}
page++
@@ -406,7 +406,7 @@ abstract class Luscious(
return client.newCall(GET(page.url, headers))
.asObservableSuccess()
.map {
- val data = json.decodeFromString(it.body!!.string()).let { data ->
+ val data = json.decodeFromString(it.body.string()).let { data ->
data["data"]!!.jsonObject["picture"]!!.jsonObject["list"]!!.jsonObject
}
when (getResolutionPref()) {
@@ -430,7 +430,7 @@ abstract class Luscious(
}
private fun detailsParse(response: Response): SManga {
- val data = json.decodeFromString(response.body!!.string())
+ val data = json.decodeFromString(response.body.string())
with(data["data"]!!.jsonObject["album"]!!.jsonObject["get"]!!.jsonObject) {
val manga = SManga.create()
manga.url = this["url"]!!.jsonPrimitive.content
@@ -498,10 +498,10 @@ abstract class Luscious(
class TriStateFilterOption(name: String, val value: String) : Filter.TriState(name)
abstract class TriStateGroupFilter(name: String, options: List) : Filter.Group(name, options) {
- val included: List
+ private val included: List
get() = state.filter { it.isIncluded() }.map { it.value }
- val excluded: List
+ private val excluded: List
get() = state.filter { it.isExcluded() }.map { it.value }
fun anyNotIgnored(): Boolean = state.any { !it.isIgnored() }
diff --git a/src/all/mangadex/src/eu/kanade/tachiyomi/extension/all/mangadex/MangaDex.kt b/src/all/mangadex/src/eu/kanade/tachiyomi/extension/all/mangadex/MangaDex.kt
index 37b231619..4d1f2fc45 100644
--- a/src/all/mangadex/src/eu/kanade/tachiyomi/extension/all/mangadex/MangaDex.kt
+++ b/src/all/mangadex/src/eu/kanade/tachiyomi/extension/all/mangadex/MangaDex.kt
@@ -745,7 +745,7 @@ abstract class MangaDex(final override val lang: String, private val dexLang: St
}
private inline fun Response.parseAs(): T = use {
- helper.json.decodeFromString(body?.string().orEmpty())
+ helper.json.decodeFromString(body.string())
}
private val SharedPreferences.contentRating
diff --git a/src/all/mangadex/src/eu/kanade/tachiyomi/extension/all/mangadex/MangaDexHelper.kt b/src/all/mangadex/src/eu/kanade/tachiyomi/extension/all/mangadex/MangaDexHelper.kt
index 53f6b90be..2109aecbc 100644
--- a/src/all/mangadex/src/eu/kanade/tachiyomi/extension/all/mangadex/MangaDexHelper.kt
+++ b/src/all/mangadex/src/eu/kanade/tachiyomi/extension/all/mangadex/MangaDexHelper.kt
@@ -237,7 +237,7 @@ class MangaDexHelper(lang: String) {
return getMdAtHomeUrl(tokenRequestUrl, client, headers, CacheControl.FORCE_NETWORK)
}
- return response.use { json.decodeFromString(it.body!!.string()).baseUrl }
+ return response.use { json.decodeFromString(it.body.string()).baseUrl }
}
/**
diff --git a/src/all/mangaplus/src/eu/kanade/tachiyomi/extension/all/mangaplus/MangaPlus.kt b/src/all/mangaplus/src/eu/kanade/tachiyomi/extension/all/mangaplus/MangaPlus.kt
index beb9a905a..75f16885c 100644
--- a/src/all/mangaplus/src/eu/kanade/tachiyomi/extension/all/mangaplus/MangaPlus.kt
+++ b/src/all/mangaplus/src/eu/kanade/tachiyomi/extension/all/mangaplus/MangaPlus.kt
@@ -350,7 +350,7 @@ class MangaPlus(
}
val contentType = response.headers["Content-Type"] ?: "image/jpeg"
- val image = response.body!!.bytes().decodeXorCipher(encryptionKey)
+ val image = response.body.bytes().decodeXorCipher(encryptionKey)
val body = image.toResponseBody(contentType.toMediaTypeOrNull())
return response.newBuilder()
@@ -390,7 +390,7 @@ class MangaPlus(
}
private fun Response.asMangaPlusResponse(): MangaPlusResponse = use {
- json.decodeFromString(body?.string().orEmpty())
+ json.decodeFromString(body.string())
}
private val SharedPreferences.imageQuality: String
diff --git a/src/all/mangapluscreators/src/eu/kanade/tachiyomi/extension/all/mangapluscreators/MangaPlusCreators.kt b/src/all/mangapluscreators/src/eu/kanade/tachiyomi/extension/all/mangapluscreators/MangaPlusCreators.kt
index c5131d1d9..33188d7e9 100644
--- a/src/all/mangapluscreators/src/eu/kanade/tachiyomi/extension/all/mangapluscreators/MangaPlusCreators.kt
+++ b/src/all/mangapluscreators/src/eu/kanade/tachiyomi/extension/all/mangapluscreators/MangaPlusCreators.kt
@@ -192,7 +192,7 @@ class MangaPlusCreators(override val lang: String) : HttpSource() {
}
private fun Response.asMpcResponse(): MpcResponse = use {
- json.decodeFromString(body!!.string())
+ json.decodeFromString(body.string())
}
companion object {
diff --git a/src/all/mangareaderto/src/eu/kanade/tachiyomi/extension/all/mangareaderto/MangaReader.kt b/src/all/mangareaderto/src/eu/kanade/tachiyomi/extension/all/mangareaderto/MangaReader.kt
index ddf7c28a3..36fc4fa70 100644
--- a/src/all/mangareaderto/src/eu/kanade/tachiyomi/extension/all/mangareaderto/MangaReader.kt
+++ b/src/all/mangareaderto/src/eu/kanade/tachiyomi/extension/all/mangareaderto/MangaReader.kt
@@ -251,7 +251,7 @@ open class MangaReader(
)
private fun Response.parseHtmlProperty(): Document {
- val html = Json.parseToJsonElement(body!!.string()).jsonObject["html"]!!.jsonPrimitive.content
+ val html = Json.parseToJsonElement(body.string()).jsonObject["html"]!!.jsonPrimitive.content
return Jsoup.parseBodyFragment(html)
}
}
diff --git a/src/all/mangareaderto/src/eu/kanade/tachiyomi/extension/all/mangareaderto/MangaReaderImageInterceptor.kt b/src/all/mangareaderto/src/eu/kanade/tachiyomi/extension/all/mangareaderto/MangaReaderImageInterceptor.kt
index 1844f6032..d0f86d0ca 100644
--- a/src/all/mangareaderto/src/eu/kanade/tachiyomi/extension/all/mangareaderto/MangaReaderImageInterceptor.kt
+++ b/src/all/mangareaderto/src/eu/kanade/tachiyomi/extension/all/mangareaderto/MangaReaderImageInterceptor.kt
@@ -26,7 +26,7 @@ object MangaReaderImageInterceptor : Interceptor {
// TODO: remove the query parameter check (legacy) in later versions
if (url.fragment != SCRAMBLED && url.queryParameter("shuffled") == null) return response
- val image = descramble(response.body!!.byteStream())
+ val image = descramble(response.body.byteStream())
val body = image.toResponseBody("image/jpeg".toMediaType())
return response.newBuilder()
.body(body)
diff --git a/src/all/mangaup/src/eu/kanade/tachiyomi/extension/all/mangaup/MangaUp.kt b/src/all/mangaup/src/eu/kanade/tachiyomi/extension/all/mangaup/MangaUp.kt
index 6ddd22300..d79ec194e 100644
--- a/src/all/mangaup/src/eu/kanade/tachiyomi/extension/all/mangaup/MangaUp.kt
+++ b/src/all/mangaup/src/eu/kanade/tachiyomi/extension/all/mangaup/MangaUp.kt
@@ -173,7 +173,7 @@ class MangaUp(override val lang: String) : HttpSource() {
}
private inline fun Response.parseAs(): T = use {
- json.decodeFromString(body?.string().orEmpty())
+ json.decodeFromString(body.string())
}
companion object {
diff --git a/src/all/mango/src/eu/kanade/tachiyomi/extension/all/mango/Mango.kt b/src/all/mango/src/eu/kanade/tachiyomi/extension/all/mango/Mango.kt
index 50872ecd9..93551ae39 100644
--- a/src/all/mango/src/eu/kanade/tachiyomi/extension/all/mango/Mango.kt
+++ b/src/all/mango/src/eu/kanade/tachiyomi/extension/all/mango/Mango.kt
@@ -47,7 +47,7 @@ class Mango : ConfigurableSource, UnmeteredSource, HttpSource() {
// Our popular manga are just our library of manga
override fun popularMangaParse(response: Response): MangasPage {
val result = try {
- json.decodeFromString(response.body!!.string())
+ json.decodeFromString(response.body.string())
} catch (e: Exception) {
apiCookies = ""
throw Exception("Login Likely Failed. Try Refreshing.")
@@ -122,7 +122,7 @@ class Mango : ConfigurableSource, UnmeteredSource, HttpSource() {
// This will just return the same thing as the main library endpoint
override fun mangaDetailsParse(response: Response): SManga {
val result = try {
- json.decodeFromString(response.body!!.string())
+ json.decodeFromString(response.body.string())
} catch (e: Exception) {
apiCookies = ""
throw Exception("Login Likely Failed. Try Refreshing.")
@@ -140,7 +140,7 @@ class Mango : ConfigurableSource, UnmeteredSource, HttpSource() {
// The chapter url will contain how many pages the chapter contains for our page list endpoint
override fun chapterListParse(response: Response): List {
val result = try {
- json.decodeFromString(response.body!!.string())
+ json.decodeFromString(response.body.string())
} catch (e: Exception) {
apiCookies = ""
throw Exception("Login Likely Failed. Try Refreshing.")
diff --git a/src/all/myreadingmanga/src/eu/kanade/tachiyomi/extension/all/myreadingmanga/MyReadingManga.kt b/src/all/myreadingmanga/src/eu/kanade/tachiyomi/extension/all/myreadingmanga/MyReadingManga.kt
index f6874feef..a04c3f3b0 100644
--- a/src/all/myreadingmanga/src/eu/kanade/tachiyomi/extension/all/myreadingmanga/MyReadingManga.kt
+++ b/src/all/myreadingmanga/src/eu/kanade/tachiyomi/extension/all/myreadingmanga/MyReadingManga.kt
@@ -231,7 +231,7 @@ open class MyReadingManga(override val lang: String, private val siteLang: Strin
// Grabs page containing filters and puts it into cache
private fun filterAssist(url: String): String {
val response = client.newCall(GET(url, headers)).execute()
- return response.body!!.string()
+ return response.body.string()
}
private fun cacheAssistant() {
diff --git a/src/all/netcomics/src/eu/kanade/tachiyomi/extension/all/netcomics/Netcomics.kt b/src/all/netcomics/src/eu/kanade/tachiyomi/extension/all/netcomics/Netcomics.kt
index d124e925e..7c1c477fa 100644
--- a/src/all/netcomics/src/eu/kanade/tachiyomi/extension/all/netcomics/Netcomics.kt
+++ b/src/all/netcomics/src/eu/kanade/tachiyomi/extension/all/netcomics/Netcomics.kt
@@ -242,7 +242,7 @@ class Netcomics(
private inline fun Response.data() =
json.decodeFromJsonElement(
- json.parseToJsonElement(body!!.string()).run {
+ json.parseToJsonElement(body.string()).run {
jsonObject["data"] ?: throw Error(
jsonObject["message"]!!.jsonPrimitive.content,
)
diff --git a/src/all/peppercarrot/src/eu/kanade/tachiyomi/extension/all/peppercarrot/Preferences.kt b/src/all/peppercarrot/src/eu/kanade/tachiyomi/extension/all/peppercarrot/Preferences.kt
index e7b803dc2..4d22ce6ef 100644
--- a/src/all/peppercarrot/src/eu/kanade/tachiyomi/extension/all/peppercarrot/Preferences.kt
+++ b/src/all/peppercarrot/src/eu/kanade/tachiyomi/extension/all/peppercarrot/Preferences.kt
@@ -52,7 +52,7 @@ val SharedPreferences.langData: List
@Synchronized
fun updateLangData(client: OkHttpClient, headers: Headers, preferences: SharedPreferences) {
val lastUpdated = client.newCall(GET("$BASE_URL/0_sources/last_updated.txt", headers))
- .execute().body!!.string().substringBefore('\n').toLong()
+ .execute().body.string().substringBefore('\n').toLong()
if (lastUpdated <= preferences.lastUpdated) return
val editor = preferences.edit().putLong(LAST_UPDATED_PREF, lastUpdated)
@@ -125,7 +125,7 @@ private fun fetchTitles(client: OkHttpClient, headers: Headers): Map Response.parseAs(): T = json.decodeFromString(body!!.string())
+private inline fun Response.parseAs(): T = json.decodeFromString(body.string())
private inline fun ProtoBuf.decodeFromBase64(base64: String): T =
decodeFromByteArray(Base64.decode(base64, Base64.NO_WRAP))
diff --git a/src/all/simplyhentai/src/eu/kanade/tachiyomi/extension/all/simplyhentai/SimplyHentai.kt b/src/all/simplyhentai/src/eu/kanade/tachiyomi/extension/all/simplyhentai/SimplyHentai.kt
index d0ef8ba95..195c7c1ff 100644
--- a/src/all/simplyhentai/src/eu/kanade/tachiyomi/extension/all/simplyhentai/SimplyHentai.kt
+++ b/src/all/simplyhentai/src/eu/kanade/tachiyomi/extension/all/simplyhentai/SimplyHentai.kt
@@ -216,7 +216,7 @@ open class SimplyHentai(override val lang: String) : ConfigurableSource, HttpSou
get() = preferences.getString("blacklist", "")!!
private inline fun Response.decode() =
- json.decodeFromString(body!!.string())
+ json.decodeFromString(body.string())
override fun imageUrlParse(response: Response) =
throw UnsupportedOperationException("Not used")
diff --git a/src/all/tachidesk/src/eu/kanade/tachiyomi/extension/all/tachidesk/Tachidesk.kt b/src/all/tachidesk/src/eu/kanade/tachiyomi/extension/all/tachidesk/Tachidesk.kt
index 66e796b49..73f15a232 100644
--- a/src/all/tachidesk/src/eu/kanade/tachiyomi/extension/all/tachidesk/Tachidesk.kt
+++ b/src/all/tachidesk/src/eu/kanade/tachiyomi/extension/all/tachidesk/Tachidesk.kt
@@ -65,7 +65,7 @@ class Tachidesk : ConfigurableSource, UnmeteredSource, HttpSource() {
override fun popularMangaParse(response: Response): MangasPage =
MangasPage(
- json.decodeFromString>(response.body!!.string()).map {
+ json.decodeFromString>(response.body.string()).map {
it.toSManga()
},
false,
@@ -76,7 +76,7 @@ class Tachidesk : ConfigurableSource, UnmeteredSource, HttpSource() {
GET("$checkedBaseUrl/api/v1/manga/${manga.url}/?onlineFetch=true", headers)
override fun mangaDetailsParse(response: Response): SManga =
- json.decodeFromString(response.body!!.string()).let { it.toSManga() }
+ json.decodeFromString(response.body.string()).let { it.toSManga() }
// ------------- Chapter -------------
@@ -84,7 +84,7 @@ class Tachidesk : ConfigurableSource, UnmeteredSource, HttpSource() {
GET("$checkedBaseUrl/api/v1/manga/${manga.url}/chapters?onlineFetch=true", headers)
override fun chapterListParse(response: Response): List =
- json.decodeFromString>(response.body!!.string()).map {
+ json.decodeFromString>(response.body.string()).map {
it.toSChapter()
}
@@ -109,7 +109,7 @@ class Tachidesk : ConfigurableSource, UnmeteredSource, HttpSource() {
val mangaId = sChapter.url.split(" ").first()
val chapterIndex = sChapter.url.split(" ").last()
- val chapter = json.decodeFromString(response.body!!.string())
+ val chapter = json.decodeFromString(response.body.string())
return List(chapter.pageCount) {
Page(it + 1, "", "$checkedBaseUrl/api/v1/manga/$mangaId/chapter/$chapterIndex/page/$it/")
@@ -135,7 +135,7 @@ class Tachidesk : ConfigurableSource, UnmeteredSource, HttpSource() {
.subscribe(
{ response ->
categoryList = try {
- json.decodeFromString>(response.body!!.string())
+ json.decodeFromString>(response.body.string())
} catch (e: Exception) {
emptyList()
}
diff --git a/src/all/tappytoon/src/eu/kanade/tachiyomi/extension/all/tappytoon/Tappytoon.kt b/src/all/tappytoon/src/eu/kanade/tachiyomi/extension/all/tappytoon/Tappytoon.kt
index 4aefdc44d..7e663a3ab 100644
--- a/src/all/tappytoon/src/eu/kanade/tachiyomi/extension/all/tappytoon/Tappytoon.kt
+++ b/src/all/tappytoon/src/eu/kanade/tachiyomi/extension/all/tappytoon/Tappytoon.kt
@@ -40,13 +40,13 @@ class Tappytoon(override val lang: String) : HttpSource() {
}
// Fix image content type
val type = IMG_CONTENT_TYPE.toMediaType()
- val body = res.body!!.bytes().toResponseBody(type)
+ val body = res.body.bytes().toResponseBody(type)
return@addInterceptor res.newBuilder().body(body)
.header("Content-Type", IMG_CONTENT_TYPE).build()
}
// Throw JSON error if available
if (mime == "application/json") {
- res.body?.string()?.let(json::parseToJsonElement)?.run {
+ res.body.string().let(json::parseToJsonElement).run {
throw IOException(jsonObject["message"]!!.jsonPrimitive.content)
}
}
@@ -185,7 +185,7 @@ class Tappytoon(override val lang: String) : HttpSource() {
)
private inline fun Response.parse() =
- json.decodeFromJsonElement(json.parseToJsonElement(body!!.string()))
+ json.decodeFromJsonElement(json.parseToJsonElement(body.string()))
class Genre(values: Array) : Filter.Select("Genre", values)
diff --git a/src/all/xinmeitulu/src/eu/kanade/tachiyomi/extension/all/xinmeitulu/Xinmeitulu.kt b/src/all/xinmeitulu/src/eu/kanade/tachiyomi/extension/all/xinmeitulu/Xinmeitulu.kt
index b62b7c403..cfd03aa46 100644
--- a/src/all/xinmeitulu/src/eu/kanade/tachiyomi/extension/all/xinmeitulu/Xinmeitulu.kt
+++ b/src/all/xinmeitulu/src/eu/kanade/tachiyomi/extension/all/xinmeitulu/Xinmeitulu.kt
@@ -92,7 +92,7 @@ class Xinmeitulu : ParsedHttpSource() {
private fun contentTypeIntercept(chain: Interceptor.Chain): Response {
val response = chain.proceed(chain.request())
if (response.header("content-type")?.startsWith("image") == true) {
- val body = response.body!!.source().asResponseBody(jpegMediaType)
+ val body = response.body.source().asResponseBody(jpegMediaType)
return response.newBuilder().body(body).build()
}
return response
diff --git a/src/all/xkcd/src/eu/kanade/tachiyomi/extension/all/xkcd/translations/XkcdZH.kt b/src/all/xkcd/src/eu/kanade/tachiyomi/extension/all/xkcd/translations/XkcdZH.kt
index 9ed173179..e65f15aaa 100644
--- a/src/all/xkcd/src/eu/kanade/tachiyomi/extension/all/xkcd/translations/XkcdZH.kt
+++ b/src/all/xkcd/src/eu/kanade/tachiyomi/extension/all/xkcd/translations/XkcdZH.kt
@@ -34,7 +34,7 @@ class XkcdZH : Xkcd("https://xkcd.tw", "zh", "yyyy-MM-dd HH:mm:ss") {
override fun mangaDetailsRequest(manga: SManga) = GET(baseUrl, headers)
override fun chapterListParse(response: Response) =
- json.parseToJsonElement(response.body!!.string()).jsonObject.values.map {
+ json.parseToJsonElement(response.body.string()).jsonObject.values.map {
val obj = it.jsonObject
val number = obj["id"]!!.jsonPrimitive.content
val title = obj["title"]!!.jsonPrimitive.content
diff --git a/src/ar/asgardteam/src/eu/kanade/tachiyomi/extension/ar/asgardteam/AsgardTeam.kt b/src/ar/asgardteam/src/eu/kanade/tachiyomi/extension/ar/asgardteam/AsgardTeam.kt
index 7fdb0ef07..2fa2e61da 100644
--- a/src/ar/asgardteam/src/eu/kanade/tachiyomi/extension/ar/asgardteam/AsgardTeam.kt
+++ b/src/ar/asgardteam/src/eu/kanade/tachiyomi/extension/ar/asgardteam/AsgardTeam.kt
@@ -151,7 +151,7 @@ class AsgardTeam : ParsedHttpSource() {
private class TypeFilter(vals: Array>) : UriPartFilter("Type", vals)
- open fun getTypeFilter(): Array> = arrayOf(
+ private fun getTypeFilter(): Array> = arrayOf(
Pair("", "