From fc000a50583170a581d4d2754c7a54a734661ca7 Mon Sep 17 00:00:00 2001 From: stevenyomi <95685115+stevenyomi@users.noreply.github.com> Date: Mon, 19 Feb 2024 14:20:20 +0000 Subject: [PATCH] Remove Kuaikuai Manhua 3 (#1393) --- src/zh/kuaikuai3/build.gradle | 9 -- .../zh/kuaikuai3/DecryptInterceptor.kt | 50 --------- .../extension/zh/kuaikuai3/Kuaikuai3.kt | 7 -- .../extension/zh/kuaikuai3/MCCMSReduced.kt | 104 ------------------ 4 files changed, 170 deletions(-) delete mode 100644 src/zh/kuaikuai3/build.gradle delete mode 100644 src/zh/kuaikuai3/src/eu/kanade/tachiyomi/extension/zh/kuaikuai3/DecryptInterceptor.kt delete mode 100644 src/zh/kuaikuai3/src/eu/kanade/tachiyomi/extension/zh/kuaikuai3/Kuaikuai3.kt delete mode 100644 src/zh/kuaikuai3/src/eu/kanade/tachiyomi/extension/zh/kuaikuai3/MCCMSReduced.kt diff --git a/src/zh/kuaikuai3/build.gradle b/src/zh/kuaikuai3/build.gradle deleted file mode 100644 index c8a7773d1..000000000 --- a/src/zh/kuaikuai3/build.gradle +++ /dev/null @@ -1,9 +0,0 @@ -ext { - extName = 'Kuaikuai Manhua 3' - extClass = '.Kuaikuai3' - themePkg = 'mccms' - baseUrl = 'https://mobile3.manhuaorg.com' - overrideVersionCode = 0 -} - -apply from: "$rootDir/common.gradle" diff --git a/src/zh/kuaikuai3/src/eu/kanade/tachiyomi/extension/zh/kuaikuai3/DecryptInterceptor.kt b/src/zh/kuaikuai3/src/eu/kanade/tachiyomi/extension/zh/kuaikuai3/DecryptInterceptor.kt deleted file mode 100644 index b1f5eac76..000000000 --- a/src/zh/kuaikuai3/src/eu/kanade/tachiyomi/extension/zh/kuaikuai3/DecryptInterceptor.kt +++ /dev/null @@ -1,50 +0,0 @@ -package eu.kanade.tachiyomi.extension.zh.kuaikuai3 - -import android.util.Base64 -import okhttp3.Interceptor -import okhttp3.MediaType.Companion.toMediaType -import okhttp3.Response -import okhttp3.ResponseBody.Companion.toResponseBody -import javax.crypto.Cipher -import javax.crypto.spec.IvParameterSpec -import javax.crypto.spec.SecretKeySpec - -object DecryptInterceptor : Interceptor { - override fun intercept(chain: Interceptor.Chain): Response { - val request = chain.request() - val response = chain.proceed(request) - val host = request.url.host - val type = when { - host.endsWith("bcebos.com") -> 1 - host.endsWith("mhrsrc.com") -> 2 - else -> return response - } - val data = decrypt(response.body.bytes(), type) - val body = data.toResponseBody("image/jpeg".toMediaType()) - return response.newBuilder().body(body).build() - } - - @Synchronized - private fun decrypt(input: ByteArray, type: Int): ByteArray { - val cipher = cipher - val decodedInput: ByteArray - when (type) { - 1 -> { - decodedInput = input - cipher.init(Cipher.DECRYPT_MODE, key1, iv) - } - 2 -> { - decodedInput = Base64.decode(input, Base64.DEFAULT) - cipher.init(Cipher.DECRYPT_MODE, key2, iv2) - } - else -> return input - } - return cipher.doFinal(decodedInput) - } - - private val cipher by lazy(LazyThreadSafetyMode.NONE) { Cipher.getInstance("DESede/CBC/PKCS5Padding") } - private val key1 by lazy(LazyThreadSafetyMode.NONE) { SecretKeySpec("OW84U8Eerdb99rtsTXWSILDO".toByteArray(), "DESede") } - private val key2 by lazy(LazyThreadSafetyMode.NONE) { SecretKeySpec("ys6n2GvmgEyB3rELDX1gaTBf".toByteArray(), "DESede") } - private val iv by lazy(LazyThreadSafetyMode.NONE) { IvParameterSpec("SK8bncVu".toByteArray()) } - private val iv2 by lazy(LazyThreadSafetyMode.NONE) { IvParameterSpec("2pnB3NI2".toByteArray()) } -} diff --git a/src/zh/kuaikuai3/src/eu/kanade/tachiyomi/extension/zh/kuaikuai3/Kuaikuai3.kt b/src/zh/kuaikuai3/src/eu/kanade/tachiyomi/extension/zh/kuaikuai3/Kuaikuai3.kt deleted file mode 100644 index d5992be4d..000000000 --- a/src/zh/kuaikuai3/src/eu/kanade/tachiyomi/extension/zh/kuaikuai3/Kuaikuai3.kt +++ /dev/null @@ -1,7 +0,0 @@ -package eu.kanade.tachiyomi.extension.zh.kuaikuai3 - -class Kuaikuai3 : MCCMSReduced("快快漫画3", "https://mobile3.manhuaorg.com") { - - override fun headersBuilder() = super.headersBuilder() - .set("User-Agent", "okhttp/3.14.7") -} diff --git a/src/zh/kuaikuai3/src/eu/kanade/tachiyomi/extension/zh/kuaikuai3/MCCMSReduced.kt b/src/zh/kuaikuai3/src/eu/kanade/tachiyomi/extension/zh/kuaikuai3/MCCMSReduced.kt deleted file mode 100644 index 303e9fc4b..000000000 --- a/src/zh/kuaikuai3/src/eu/kanade/tachiyomi/extension/zh/kuaikuai3/MCCMSReduced.kt +++ /dev/null @@ -1,104 +0,0 @@ -package eu.kanade.tachiyomi.extension.zh.kuaikuai3 - -import eu.kanade.tachiyomi.network.GET -import eu.kanade.tachiyomi.network.interceptor.rateLimitHost -import eu.kanade.tachiyomi.source.model.FilterList -import eu.kanade.tachiyomi.source.model.MangasPage -import eu.kanade.tachiyomi.source.model.Page -import eu.kanade.tachiyomi.source.model.SChapter -import eu.kanade.tachiyomi.source.model.SManga -import eu.kanade.tachiyomi.source.online.HttpSource -import eu.kanade.tachiyomi.util.asJsoup -import okhttp3.HttpUrl.Companion.toHttpUrl -import okhttp3.Request -import okhttp3.Response -import org.jsoup.select.Evaluator - -open class MCCMSReduced( - override val name: String, - override val baseUrl: String, -) : HttpSource() { - override val lang = "zh" - override val supportsLatest get() = false - - override val client by lazy { - network.client.newBuilder() - .rateLimitHost(baseUrl.toHttpUrl(), 2) - .addInterceptor(DecryptInterceptor) - .build() - } - - private fun searchOnly(): Nothing = throw Exception("此图源只支持搜索") - private val noWebView = "https://stevenyomi.github.io/echo#本图源不支持网页查看" - - override fun popularMangaRequest(page: Int) = searchOnly() - override fun popularMangaParse(response: Response) = searchOnly() - override fun latestUpdatesRequest(page: Int) = searchOnly() - override fun latestUpdatesParse(response: Response) = searchOnly() - - override fun getMangaUrl(manga: SManga) = noWebView - override fun getChapterUrl(chapter: SChapter) = noWebView - - override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { - val url = "$baseUrl/index.php/search".toHttpUrl().newBuilder() - .addQueryParameter("key", query) - .build() - return GET(url, headers) - } - - override fun searchMangaParse(response: Response): MangasPage { - val document = response.asJsoup() - val placeholder = "$baseUrl/template/pc/default/images/bg_loadimg_3x4.png" - val entries = document.select(Evaluator.Tag("a")).map { link -> - SManga.create().apply { - url = link.attr("href") - title = link.ownText() - thumbnail_url = placeholder - } - } - return MangasPage(entries, false) - } - - override fun mangaDetailsParse(response: Response): SManga { - val document = response.asJsoup() - val metaProperties = HashMap() - for (element in document.head().children()) { - if (element.tagName() == "meta" && element.hasAttr("property")) { - val key = element.attr("property").removePrefix("og:") - metaProperties[key] = element.attr("content") - } - } - return SManga.create().apply { - title = metaProperties["title"]!! - author = metaProperties["novel:author"] - description = metaProperties["description"] - val statusText = metaProperties["novel:status"] - status = when { - statusText == null -> SManga.UNKNOWN - '连' in statusText -> SManga.ONGOING - '完' in statusText -> SManga.COMPLETED - else -> SManga.UNKNOWN - } - thumbnail_url = metaProperties["image"] - } - } - - override fun chapterListParse(response: Response): List { - val document = response.asJsoup() - return document.select(Evaluator.Class("j-chapter-link")).asReversed().map { link -> - SChapter.create().apply { - url = link.attr("href") - name = link.ownText() - } - } - } - - override fun pageListParse(response: Response): List { - val document = response.asJsoup() - return document.select(Evaluator.Tag("img")).mapIndexed { index, img -> - Page(index, imageUrl = img.attr("data-original")) - } - } - - override fun imageUrlParse(response: Response) = throw UnsupportedOperationException() -}