Fix Hentai Cafe deeplinking, fixes other deeplinks

This commit is contained in:
Jobobby04 2020-12-25 23:58:40 -05:00
parent dfabe1d2fa
commit 1dcf161131
2 changed files with 7 additions and 9 deletions

View File

@ -234,11 +234,11 @@
<!-- Hentai Cafe --> <!-- Hentai Cafe -->
<data <data
android:host="hentai.cafe" android:host="hentai.cafe"
android:pathPattern="/.*/.*" android:pathPrefix="/hc.fyi/"
android:scheme="http" /> android:scheme="http" />
<data <data
android:host="hentai.cafe" android:host="hentai.cafe"
android:pathPattern="/.*/.*" android:pathPrefix="/hc.fyi/"
android:scheme="https" /> android:scheme="https" />
<!-- Tsumino --> <!-- Tsumino -->

View File

@ -94,7 +94,7 @@ class HentaiCafe(delegate: HttpSource, val context: Context) :
}.map { }.map {
listOf( listOf(
SChapter.create().apply { SChapter.create().apply {
setUrlWithoutDomain("/manga/read/${it.readerId}/en/0/1/") url = "/manga/read/${it.readerId}/en/0/1/"
name = "Chapter" name = "Chapter"
chapter_number = 0.0f chapter_number = 0.0f
} }
@ -106,13 +106,11 @@ class HentaiCafe(delegate: HttpSource, val context: Context) :
) )
override fun mapUrlToMangaUrl(uri: Uri): String? { override fun mapUrlToMangaUrl(uri: Uri): String? {
val lcFirstPathSegment = uri.pathSegments.firstOrNull()?.toLowerCase() ?: return null val lcFirstPathSegment = uri.pathSegments.firstOrNull()?.takeUnless { it.equals("manga", true) } ?: return null
return if (lcFirstPathSegment == "manga") { return if (lcFirstPathSegment.equals("hc.fyi", true)) {
"https://hentai.cafe/${uri.pathSegments[2]}" "/$lcFirstPathSegment/${uri.pathSegments[1]}"
} else { } else null
"https://hentai.cafe/$lcFirstPathSegment"
}
} }
override fun getDescriptionAdapter(controller: MangaController): HentaiCafeDescriptionAdapter { override fun getDescriptionAdapter(controller: MangaController): HentaiCafeDescriptionAdapter {