diff --git a/multisrc/overrides/heancms/default/AndroidManifest.xml b/multisrc/overrides/heancms/default/AndroidManifest.xml new file mode 100644 index 000000000..2c45301bc --- /dev/null +++ b/multisrc/overrides/heancms/default/AndroidManifest.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + \ No newline at end of file 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 2e0b38a3f..593b9f698 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 @@ -117,6 +117,17 @@ abstract class HeanCms( override fun latestUpdatesParse(response: Response): MangasPage = popularMangaParse(response) + override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable { + if (!query.startsWith(SEARCH_PREFIX)) { + return super.fetchSearchManga(page, query, filters) + } + + val slug = query.substringAfter(SEARCH_PREFIX) + val manga = SManga.create().apply { url = "/series/$slug" } + + return fetchMangaDetails(manga).map { MangasPage(listOf(it), false) } + } + override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { /** * Their query search endpoint doesn't return the thumbnails, so we need to do @@ -224,7 +235,8 @@ abstract class HeanCms( ?: throw Exception(intl.urlChangedError(name)) return seriesDetails.apply { - status = response.request.url.fragment?.toIntOrNull() ?: SManga.UNKNOWN + status = status.takeUnless { it == SManga.UNKNOWN } + ?: response.request.url.fragment?.toIntOrNull() ?: SManga.UNKNOWN } } @@ -395,5 +407,7 @@ abstract class HeanCms( private val JSON_MEDIA_TYPE = "application/json".toMediaType() val TIMESTAMP_REGEX = "-\\d+$".toRegex() + + const val SEARCH_PREFIX = "slug:" } } diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/heancms/HeanCmsDto.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/heancms/HeanCmsDto.kt index ff64432a7..9695f5cf9 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/heancms/HeanCmsDto.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/heancms/HeanCmsDto.kt @@ -29,6 +29,7 @@ data class HeanCmsSearchDto( @SerialName("series_slug") val slug: String, @SerialName("series_type") val type: String, val title: String, + val thumbnail: String? = null, ) { fun toSManga( @@ -40,7 +41,8 @@ data class HeanCmsSearchDto( val thumbnailFileName = slugMap[slugOnly]?.thumbnailFileName title = this@HeanCmsSearchDto.title - thumbnail_url = thumbnailFileName?.toAbsoluteThumbnailUrl(apiUrl, coverPath) + thumbnail_url = thumbnail?.toAbsoluteThumbnailUrl(apiUrl, coverPath) + ?: thumbnailFileName?.toAbsoluteThumbnailUrl(apiUrl, coverPath) url = "/series/$slugOnly" } } diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/heancms/HeanCmsGenerator.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/heancms/HeanCmsGenerator.kt index d00387a96..38a07327b 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/heancms/HeanCmsGenerator.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/heancms/HeanCmsGenerator.kt @@ -9,7 +9,7 @@ class HeanCmsGenerator : ThemeSourceGenerator { override val themeClass = "HeanCms" - override val baseVersionCode: Int = 12 + override val baseVersionCode: Int = 13 override val sources = listOf( SingleLang("Omega Scans", "https://omegascans.org", "en", isNsfw = true, overrideVersionCode = 16), diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/heancms/HeanCmsIntl.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/heancms/HeanCmsIntl.kt index 232774310..433a13b0f 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/heancms/HeanCmsIntl.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/heancms/HeanCmsIntl.kt @@ -25,7 +25,7 @@ class HeanCmsIntl(lang: String) { val statusOnHiatus: String = when (availableLang) { BRAZILIAN_PORTUGUESE -> "Em hiato" SPANISH -> "En hiatus" - else -> "Ongoing" + else -> "On Hiatus" } val statusDropped: String = when (availableLang) { diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/heancms/HeanCmsUrlActivity.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/heancms/HeanCmsUrlActivity.kt new file mode 100644 index 000000000..cd94c7a8a --- /dev/null +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/heancms/HeanCmsUrlActivity.kt @@ -0,0 +1,42 @@ +package eu.kanade.tachiyomi.multisrc.heancms + +import android.app.Activity +import android.content.ActivityNotFoundException +import android.content.Intent +import android.os.Bundle +import android.util.Log +import kotlin.system.exitProcess + +class HeanCmsUrlActivity : Activity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + val pathSegments = intent?.data?.pathSegments + + if (pathSegments != null && pathSegments.size >= 2) { + val mainIntent = Intent().apply { + action = "eu.kanade.tachiyomi.SEARCH" + putExtra("query", createQuery(pathSegments)) + putExtra("filter", packageName) + } + try { + startActivity(mainIntent) + } catch (e: ActivityNotFoundException) { + Log.e("HeanCmsUrlActivity", e.toString()) + } + } else { + Log.e("HeanCmsUrlActivity", "could not parse uri from intent $intent") + } + + finish() + exitProcess(0) + } + + private fun createQuery(pathSegments: MutableList): String? { + return if (pathSegments.size >= 2) { + val slug = pathSegments[1] + "${HeanCms.SEARCH_PREFIX}$slug" + } else { + null + } + } +}