From 8ce11b816b377dcc96aef714dab36d2fd45e543e Mon Sep 17 00:00:00 2001 From: mobi2002 <48650614+mobi2002@users.noreply.github.com> Date: Wed, 1 Mar 2023 20:21:10 +0500 Subject: [PATCH] Comick: fix deep links (#15535) * Comick: slug/hid search for deep linking * bump --- src/all/comickfun/build.gradle | 2 +- .../extension/all/comickfun/ComickFun.kt | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/all/comickfun/build.gradle b/src/all/comickfun/build.gradle index db39a53cd..388f6c53e 100644 --- a/src/all/comickfun/build.gradle +++ b/src/all/comickfun/build.gradle @@ -6,7 +6,7 @@ ext { extName = 'Comick' pkgNameSuffix = 'all.comickfun' extClass = '.ComickFunFactory' - extVersionCode = 21 + extVersionCode = 22 isNsfw = true } diff --git a/src/all/comickfun/src/eu/kanade/tachiyomi/extension/all/comickfun/ComickFun.kt b/src/all/comickfun/src/eu/kanade/tachiyomi/extension/all/comickfun/ComickFun.kt index b6b25e0f6..ce93eaf62 100644 --- a/src/all/comickfun/src/eu/kanade/tachiyomi/extension/all/comickfun/ComickFun.kt +++ b/src/all/comickfun/src/eu/kanade/tachiyomi/extension/all/comickfun/ComickFun.kt @@ -15,6 +15,7 @@ import okhttp3.HttpUrl.Companion.toHttpUrl import okhttp3.OkHttpClient import okhttp3.Request import okhttp3.Response +import rx.Observable import java.text.ParseException import java.text.SimpleDateFormat import java.util.Locale @@ -53,6 +54,7 @@ abstract class ComickFun(override val lang: String, private val comickFunLang: S ), ) } + override fun popularMangaParse(response: Response) = searchMangaParse(response) /** Latest Manga **/ @@ -69,6 +71,17 @@ abstract class ComickFun(override val lang: String, private val comickFunLang: S override fun latestUpdatesParse(response: Response) = searchMangaParse(response) /** Manga Search **/ + override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable { + if (!query.startsWith(SLUG_SEARCH_PREFIX)) { + return super.fetchSearchManga(page, query, filters) + } + + val slugOrHid = query.substringAfter(SLUG_SEARCH_PREFIX) + return fetchMangaDetails(SManga.create().apply { this.url = "/comic/$slugOrHid#" }).map { + MangasPage(listOf(it), false) + } + } + override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { val url = apiUrl.toHttpUrl().newBuilder().apply { addPathSegment("search") @@ -195,7 +208,7 @@ abstract class ComickFun(override val lang: String, private val comickFunLang: S } override fun getMangaUrl(manga: SManga): String { - return "$baseUrl${manga.url}" + return "$baseUrl${manga.url.removeSuffix("#")}" } /** Manga Chapter List **/ @@ -288,6 +301,7 @@ abstract class ComickFun(override val lang: String, private val comickFunLang: S protected open val defaultPopularSort: Int = 0 protected open val defaultLatestSort: Int = 4 + override fun getFilterList() = FilterList( getFilters(), )