Mangadex: View all Manga by a Group (+handle group links) (#10060)

* search Manga from a group using their id

* add group deeplink support

* linting

* increment mangadex.extVersionCode

* respect `dexLang`

eg: MangaDex (EN) needn't show a group's non-EN releases

* you cannot use filters on chapter endpoint

fixes HTTP 400 while trying to filter on chapter endpoint

* rewrite to use /manga endpoint instead of /chapter

ends up removing a lot of stuff I had previously but that's a good thing

* add check for valid UUID

if a UUID wasn't being provided, then the group queryParameter wouldn't
work and end up throwing Error 400. Might as well prevent that
This commit is contained in:
nicki 2021-12-14 00:38:33 +05:30 committed by GitHub
parent 024e84b6f7
commit b210902b2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 35 additions and 11 deletions

View File

@ -38,6 +38,14 @@
android:host="www.mangadex.org"
android:pathPattern="/chapter/..*"
android:scheme="https" />
<data
android:host="mangadex.org"
android:pathPattern="/group/..*"
android:scheme="https" />
<data
android:host="www.mangadex.org"
android:pathPattern="/group/..*"
android:scheme="https" />
</intent-filter>
</activity>
</application>

View File

@ -6,7 +6,7 @@ ext {
extName = 'MangaDex'
pkgNameSuffix = 'all.mangadex'
extClass = '.MangaDexFactory'
extVersionCode = 146
extVersionCode = 147
isNsfw = true
}

View File

@ -34,6 +34,7 @@ object MDConstants {
const val prefixIdSearch = "id:"
const val prefixChSearch = "ch:"
const val prefixGrpSearch = "grp:"
const val coverQualityPref = "thumbnailQuality"

View File

@ -216,15 +216,28 @@ abstract class MangaDex(override val lang: String, val dexLang: String) :
return GET(url, headers, CacheControl.FORCE_NETWORK)
}
val tempUrl = MDConstants.apiMangaUrl.toHttpUrl().newBuilder()
tempUrl.apply {
val tempUrl = MDConstants.apiMangaUrl.toHttpUrl().newBuilder().apply {
addQueryParameter("limit", MDConstants.mangaLimit.toString())
addQueryParameter("offset", (helper.getMangaListOffset(page)))
addQueryParameter("includes[]", MDConstants.coverArt)
val actualQuery = query.replace(MDConstants.whitespaceRegex, " ")
if (actualQuery.isNotBlank()) {
addQueryParameter("title", actualQuery)
}
if (query.startsWith(MDConstants.prefixGrpSearch)) {
val groupID = query.removePrefix(MDConstants.prefixGrpSearch)
if (!helper.containsUuid(groupID)) {
throw Exception("Not a valid group ID")
}
tempUrl.apply {
addQueryParameter("group", groupID)
}
}
else {
tempUrl.apply {
val actualQuery = query.replace(MDConstants.whitespaceRegex, " ")
if (actualQuery.isNotBlank()) {
addQueryParameter("title", actualQuery)
}
}
}

View File

@ -25,10 +25,12 @@ class MangadexUrlActivity : Activity() {
val titleid = pathSegments[1]
val mainIntent = Intent().apply {
action = "eu.kanade.tachiyomi.SEARCH"
if (pathSegments[0].equals("chapter")) {
putExtra("query", "${MDConstants.prefixChSearch}$titleid")
} else {
putExtra("query", "${MDConstants.prefixIdSearch}$titleid")
with(pathSegments[0]) {
when {
equals("chapter") -> putExtra("query", "${MDConstants.prefixChSearch}$titleid")
equals("group") -> putExtra("query", "${MDConstants.prefixGrpSearch}$titleid")
else -> putExtra("query", "${MDConstants.prefixIdSearch}$titleid")
}
}
putExtra("filter", packageName)
}