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:
parent
024e84b6f7
commit
b210902b2c
|
@ -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>
|
||||
|
|
|
@ -6,7 +6,7 @@ ext {
|
|||
extName = 'MangaDex'
|
||||
pkgNameSuffix = 'all.mangadex'
|
||||
extClass = '.MangaDexFactory'
|
||||
extVersionCode = 146
|
||||
extVersionCode = 147
|
||||
isNsfw = true
|
||||
}
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ object MDConstants {
|
|||
|
||||
const val prefixIdSearch = "id:"
|
||||
const val prefixChSearch = "ch:"
|
||||
const val prefixGrpSearch = "grp:"
|
||||
|
||||
const val coverQualityPref = "thumbnailQuality"
|
||||
|
||||
|
|
|
@ -216,17 +216,30 @@ 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)
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val finalUrl = helper.mdFilters.addFiltersToUrl(tempUrl, filters)
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue