diff --git a/src/all/mangadex/build.gradle b/src/all/mangadex/build.gradle index 34e5e0e63..dad7aa22c 100644 --- a/src/all/mangadex/build.gradle +++ b/src/all/mangadex/build.gradle @@ -6,7 +6,7 @@ ext { extName = 'MangaDex' pkgNameSuffix = 'all.mangadex' extClass = '.MangaDexFactory' - extVersionCode = 145 + extVersionCode = 146 isNsfw = true } diff --git a/src/all/mangadex/src/eu/kanade/tachiyomi/extension/all/mangadex/MDConstants.kt b/src/all/mangadex/src/eu/kanade/tachiyomi/extension/all/mangadex/MDConstants.kt index 2a41bf63f..858aa67dd 100644 --- a/src/all/mangadex/src/eu/kanade/tachiyomi/extension/all/mangadex/MDConstants.kt +++ b/src/all/mangadex/src/eu/kanade/tachiyomi/extension/all/mangadex/MDConstants.kt @@ -15,8 +15,10 @@ object MDConstants { const val manga = "manga" const val coverArt = "cover_art" const val scanlator = "scanlation_group" + const val uploader = "user" const val author = "author" const val artist = "artist" + const val legacyNoGroupId = "00e03853-1b96-4f41-9542-c71b8692033b" const val cdnUrl = "https://uploads.mangadex.org" const val apiUrl = "https://api.mangadex.org" diff --git a/src/all/mangadex/src/eu/kanade/tachiyomi/extension/all/mangadex/MangaDexHelper.kt b/src/all/mangadex/src/eu/kanade/tachiyomi/extension/all/mangadex/MangaDexHelper.kt index 7a4d4567e..a7b0876f9 100644 --- a/src/all/mangadex/src/eu/kanade/tachiyomi/extension/all/mangadex/MangaDexHelper.kt +++ b/src/all/mangadex/src/eu/kanade/tachiyomi/extension/all/mangadex/MangaDexHelper.kt @@ -43,7 +43,7 @@ class MangaDexHelper() { * get chapters for manga (aka manga/$id/feed endpoint) */ fun getChapterEndpoint(mangaId: String, offset: Int, langCode: String) = - "${MDConstants.apiMangaUrl}/$mangaId/feed?includes[]=${MDConstants.scanlator}&limit=500&offset=$offset&translatedLanguage[]=$langCode&order[volume]=desc&order[chapter]=desc" + "${MDConstants.apiMangaUrl}/$mangaId/feed?includes[]=${MDConstants.scanlator}&includes[]=${MDConstants.uploader}&limit=500&offset=$offset&translatedLanguage[]=$langCode&order[volume]=desc&order[chapter]=desc" /** * Check if the manga url is a valid uuid @@ -276,10 +276,19 @@ class MangaDexHelper() { MDConstants.scanlator, true ) - }.mapNotNull { it.attributes!!.name } + }.filterNot { it.id == MDConstants.legacyNoGroupId } // 'no group' left over from MDv3 + .mapNotNull { it.attributes!!.name } .joinToString(" & ") - .replace("no group", "No Group") - .ifEmpty { "No Group" } + .ifEmpty { + // fall back to uploader name if no group + val users = chapterDataDto.relationships.filter { relationshipDto -> + relationshipDto.type.equals( + MDConstants.uploader, + true + ) + }.mapNotNull { it.attributes!!.username } + users.joinToString(" & ", if (users.isNotEmpty()) "Uploaded by " else "") + }.ifEmpty { "No Group" } // "No Group" as final resort val chapterName = mutableListOf() // Build chapter name diff --git a/src/all/mangadex/src/eu/kanade/tachiyomi/extension/all/mangadex/dto/MangaDto.kt b/src/all/mangadex/src/eu/kanade/tachiyomi/extension/all/mangadex/dto/MangaDto.kt index d2e997ba5..ebf2aa4ae 100644 --- a/src/all/mangadex/src/eu/kanade/tachiyomi/extension/all/mangadex/dto/MangaDto.kt +++ b/src/all/mangadex/src/eu/kanade/tachiyomi/extension/all/mangadex/dto/MangaDto.kt @@ -31,6 +31,7 @@ data class RelationshipDto( data class IncludesAttributesDto( val name: String? = null, val fileName: String? = null, + val username: String? = null ) @Serializable