diff --git a/src/all/mangadex/AndroidManifest.xml b/src/all/mangadex/AndroidManifest.xml index 5adfe1d82..8ab5cd68f 100644 --- a/src/all/mangadex/AndroidManifest.xml +++ b/src/all/mangadex/AndroidManifest.xml @@ -8,42 +8,25 @@ android:excludeFromRecents="true" android:exported="true" android:theme="@android:style/Theme.NoDisplay"> - + + + + - - - - diff --git a/src/all/mangadex/build.gradle b/src/all/mangadex/build.gradle index 4807b1cfe..265424192 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 = 152 + extVersionCode = 153 isNsfw = true } diff --git a/src/all/mangadex/src/eu/kanade/tachiyomi/extension/all/mangadex/MangaDex.kt b/src/all/mangadex/src/eu/kanade/tachiyomi/extension/all/mangadex/MangaDex.kt index 807c220fd..7436206fc 100644 --- a/src/all/mangadex/src/eu/kanade/tachiyomi/extension/all/mangadex/MangaDex.kt +++ b/src/all/mangadex/src/eu/kanade/tachiyomi/extension/all/mangadex/MangaDex.kt @@ -272,7 +272,10 @@ abstract class MangaDex(override val lang: String, val dexLang: String) : override fun mangaDetailsRequest(manga: SManga): Request { // remove once redirect for /manga is fixed - return GET("${baseUrl}${manga.url.replace("manga", "title")}", headers) + val title = manga.title + val url = "${baseUrl}${manga.url.replace("manga", "title")}" + val shareUrl = "$url/" + helper.titleToSlug(title) + return GET(shareUrl, headers) } /** 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 41ecf24c2..a85afa7d6 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 @@ -190,6 +190,7 @@ class MangaDexHelper() { val titleMap = mangaDataDto.attributes.title.asMdMap() val dirtyTitle = titleMap[lang] ?: titleMap["en"] + ?: titleMap["ja-ro"] ?: mangaDataDto.attributes.altTitles.jsonArray .find { val altTitle = it.asMdMap() @@ -348,4 +349,18 @@ class MangaDexHelper() { throw(e) } } + + fun titleToSlug(title: String) = title.trim() + .toLowerCase(Locale.US) + .replace("[^a-z0-9]+".toRegex(), "-") + .replace("-+$".toRegex(), "") + .split("-") + .reduce { accumulator, element -> + val currentSlug = "$accumulator-$element" + if (currentSlug.length > 100) { + accumulator + } else { + currentSlug + } + } }