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 -->
<data
android:host="hentai.cafe"
android:pathPattern="/.*/.*"
android:pathPrefix="/hc.fyi/"
android:scheme="http" />
<data
android:host="hentai.cafe"
android:pathPattern="/.*/.*"
android:pathPrefix="/hc.fyi/"
android:scheme="https" />
<!-- Tsumino -->

View File

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